@@ -359,34 +359,34 @@ public void testUUIDInvalid() throws Exception
359359
360360 public void testUUIDAux () throws Exception
361361 {
362- // [JACKSON-393] fix:
363362 final UUID value = UUID .fromString ("76e6d183-5f68-4afa-b94a-922c1fdb83f8" );
364363
365364 // first, null should come as null
366- TokenBuffer buf = new TokenBuffer (null , false );
367- buf .writeObject (null );
368- assertNull (MAPPER .readValue (buf .asParser (), UUID .class ));
369- buf . close ();
365+ try ( TokenBuffer buf = new TokenBuffer (null , false )) {
366+ buf .writeObject (null );
367+ assertNull (MAPPER .readValue (buf .asParser (), UUID .class ));
368+ }
370369
371370 // then, UUID itself come as is:
372- buf = new TokenBuffer (null , false );
373- buf .writeObject (value );
374- assertSame (value , MAPPER .readValue (buf .asParser (), UUID .class ));
375-
376- // and finally from byte[]
377- // oh crap; JDK UUID just... sucks. Not even byte[] accessors or constructors? Huh?
378- ByteArrayOutputStream bytes = new ByteArrayOutputStream ();
379- DataOutputStream out = new DataOutputStream (bytes );
380- out .writeLong (value .getMostSignificantBits ());
381- out .writeLong (value .getLeastSignificantBits ());
382- byte [] data = bytes .toByteArray ();
383- assertEquals (16 , data .length );
384-
385- buf .writeObject (data );
386-
387- UUID value2 = MAPPER .readValue (buf .asParser (), UUID .class );
388-
389- assertEquals (value , value2 );
390- buf .close ();
371+ try (TokenBuffer buf = new TokenBuffer (null , false )) {
372+ buf .writeObject (value );
373+ assertSame (value , MAPPER .readValue (buf .asParser (), UUID .class ));
374+
375+ // and finally from byte[]
376+ // oh crap; JDK UUID just... sucks. Not even byte[] accessors or constructors? Huh?
377+ ByteArrayOutputStream bytes = new ByteArrayOutputStream ();
378+ DataOutputStream out = new DataOutputStream (bytes );
379+ out .writeLong (value .getMostSignificantBits ());
380+ out .writeLong (value .getLeastSignificantBits ());
381+ out .close ();
382+ byte [] data = bytes .toByteArray ();
383+ assertEquals (16 , data .length );
384+
385+ buf .writeObject (data );
386+
387+ UUID value2 = MAPPER .readValue (buf .asParser (), UUID .class );
388+
389+ assertEquals (value , value2 );
390+ }
391391 }
392392}
0 commit comments