test/java/util/Locale/LocaleEnhanceTest.java

Print this page
rev 3509 : 7021209: convert lang, math, util to use try-with-resources
Reviewed-by: XXX

*** 1185,1202 **** String country = (fields.length >= 2) ? fields[1] : ""; String variant = (fields.length == 3) ? fields[2] : ""; locale = new Locale(lang, country, variant); } ! // desrialize ! try { ! FileInputStream fis = new FileInputStream(testfile); ! ObjectInputStream ois = new ObjectInputStream(fis); ! Object o = ois.readObject(); assertEquals("Deserialize Java 6 Locale " + locale, o, locale); - ois.close(); } catch (Exception e) { errln("Exception while reading " + testfile.getAbsolutePath() + " - " + e.getMessage()); } } } --- 1185,1200 ---- String country = (fields.length >= 2) ? fields[1] : ""; String variant = (fields.length == 3) ? fields[2] : ""; locale = new Locale(lang, country, variant); } ! // deserialize ! try (FileInputStream fis = new FileInputStream(testfile); ! ObjectInputStream ois = new ObjectInputStream(fis)) ! { Object o = ois.readObject(); assertEquals("Deserialize Java 6 Locale " + locale, o, locale); } catch (Exception e) { errln("Exception while reading " + testfile.getAbsolutePath() + " - " + e.getMessage()); } } }