Ignore:
Timestamp:
2014-04-29T18:06:29+02:00 (5 years ago)
Author:
Don-vip
Message:

see #8465 - use of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java

    r6920 r7030  
    7979    public void testOpenUrlGzip() throws Exception {
    8080        Main.initApplicationPreferences();
    81         final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true);
    82         Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    83         x.close();
     81        try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true)) {
     82            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
     83        }
    8484    }
    8585
     
    8787    public void testOpenUrlBzip() throws Exception {
    8888        Main.initApplicationPreferences();
    89         final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true);
    90         Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    91         x.close();
     89        try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true)) {
     90            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
     91        }
    9292    }
    9393
Note: See TracChangeset for help on using the changeset viewer.