Index: trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java	(revision 7027)
+++ trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java	(revision 7030)
@@ -38,11 +38,6 @@
         // load properties
         //
-        try {
-            InputStream is = HistoryBrowserTest.class.getResourceAsStream("/test-functional-env.properties");
-            try {
-                testProperties.load(is);
-            } finally {
-                is.close();
-            }
+        try (InputStream is = HistoryBrowserTest.class.getResourceAsStream("/test-functional-env.properties");) {
+            testProperties.load(is);
         } catch(IOException e){
             logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
Index: trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 7027)
+++ trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 7030)
@@ -134,5 +134,5 @@
 
     @BeforeClass
-    public static void  init() throws OsmTransferException {
+    public static void init() throws OsmTransferException {
         logger.info("initializing ...");
         testProperties = new Properties();
@@ -140,11 +140,6 @@
         // load properties
         //
-        try {
-            InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties");
-            try {
-                testProperties.load(is);
-            } finally {
-                is.close();
-            }
+        try (InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties")) {
+            testProperties.load(is);
         } catch(IOException e){
             logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
@@ -211,16 +206,15 @@
         createDataSetOnServer(testDataSet);
 
-        try {
+        try (
             PrintWriter pw = new PrintWriter(
                     new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8)
-            );
+        )) {
             logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
-            OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion());
-            w.header();
-            w.writeDataSources(testDataSet);
-            w.writeContent(testDataSet);
-            w.footer();
-            w.close();
-            pw.close();
+            try (OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion())) {
+                w.header();
+                w.writeDataSources(testDataSet);
+                w.writeContent(testDataSet);
+                w.footer();
+            }
         } catch(IOException e) {
             fail(MessageFormat.format("failed to open file ''{0}'' for writing", dataSetCacheOutputFile.toString()));
@@ -238,7 +232,7 @@
         logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
         ds = new DataSet();
-        FileInputStream fis = new FileInputStream(f);
-        ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
-        fis.close();
+        try (FileInputStream fis = new FileInputStream(f)) {
+            ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
     }
 
Index: trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 7027)
+++ trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 7030)
@@ -147,11 +147,6 @@
         // load properties
         //
-        try {
-            InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties");
-            try {
-                testProperties.load(is);
-            } finally {
-                is.close();
-            }
+        try (InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties")) {
+            testProperties.load(is);
         } catch(IOException e){
             logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
@@ -218,16 +213,15 @@
         createDataSetOnServer(testDataSet);
 
-        try {
+        try (
             PrintWriter pw = new PrintWriter(
                     new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8)
-            );
+        )) {
             logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
-            OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion());
-            w.header();
-            w.writeDataSources(testDataSet);
-            w.writeContent(testDataSet);
-            w.footer();
-            w.close();
-            pw.close();
+            try (OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion())) {
+                w.header();
+                w.writeDataSources(testDataSet);
+                w.writeContent(testDataSet);
+                w.footer();
+            }
         } catch(IOException e) {
             fail(MessageFormat.format("failed to open file ''{0}'' for writing", dataSetCacheOutputFile.toString()));
@@ -245,7 +239,7 @@
         logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
         ds = new DataSet();
-        FileInputStream fis = new FileInputStream(f);
-        ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
-        fis.close();
+        try (FileInputStream fis = new FileInputStream(f)) {
+            ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 7027)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 7030)
@@ -18,5 +18,4 @@
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Random;
 import java.util.Set;
@@ -90,51 +89,49 @@
 
         Random rand = new Random();
-        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(PROJECTION_DATA_FILE), Utils.UTF_8));
-        out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
-        out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
-        for (Entry<String, Projection> e : supportedCodesMap.entrySet()) {
-        }
-        for (String code : codesToWrite) {
-            Projection proj = supportedCodesMap.get(code);
-            Bounds b = proj.getWorldBoundsLatLon();
-            double lat, lon;
-            TestData prev = prevCodesMap.get(proj.toCode());
-            if (prev != null) {
-                lat = prev.ll.lat();
-                lon = prev.ll.lon();
-            } else {
-                lat = b.getMin().lat() + rand.nextDouble() * (b.getMax().lat() - b.getMin().lat());
-                lon = b.getMin().lon() + rand.nextDouble() * (b.getMax().lon() - b.getMin().lon());
-            }
-            EastNorth en = proj.latlon2eastNorth(new LatLon(lat, lon));
-            LatLon ll2 = proj.eastNorth2latlon(en);
-            out.write(String.format("%s%n  ll  %s %s%n  en  %s %s%n  ll2 %s %s%n", proj.toCode(), lat, lon, en.east(), en.north(), ll2.lat(), ll2.lon()));
-        }
-        out.close();
+        try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(PROJECTION_DATA_FILE), Utils.UTF_8))) {
+            out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
+            out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
+            for (String code : codesToWrite) {
+                Projection proj = supportedCodesMap.get(code);
+                Bounds b = proj.getWorldBoundsLatLon();
+                double lat, lon;
+                TestData prev = prevCodesMap.get(proj.toCode());
+                if (prev != null) {
+                    lat = prev.ll.lat();
+                    lon = prev.ll.lon();
+                } else {
+                    lat = b.getMin().lat() + rand.nextDouble() * (b.getMax().lat() - b.getMin().lat());
+                    lon = b.getMin().lon() + rand.nextDouble() * (b.getMax().lon() - b.getMin().lon());
+                }
+                EastNorth en = proj.latlon2eastNorth(new LatLon(lat, lon));
+                LatLon ll2 = proj.eastNorth2latlon(en);
+                out.write(String.format("%s%n  ll  %s %s%n  en  %s %s%n  ll2 %s %s%n", proj.toCode(), lat, lon, en.east(), en.north(), ll2.lat(), ll2.lon()));
+            }
+        }
     }
 
     private static List<TestData> readData() throws IOException, FileNotFoundException {
-        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), Utils.UTF_8));
-        List<TestData> result = new ArrayList<>();
-        String line;
-        while ((line = in.readLine()) != null) {
-            if (line.startsWith("#")) {
-                continue;
-            }
-            TestData next = new TestData();
-
-            Pair<Double,Double> ll = readLine("ll", in.readLine());
-            Pair<Double,Double> en = readLine("en", in.readLine());
-            Pair<Double,Double> ll2 = readLine("ll2", in.readLine());
-
-            next.code = line;
-            next.ll = new LatLon(ll.a, ll.b);
-            next.en = new EastNorth(en.a, en.b);
-            next.ll2 = new LatLon(ll2.a, ll2.b);
-
-            result.add(next);
-        }
-        in.close();
-        return result;
+        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), Utils.UTF_8))) {
+            List<TestData> result = new ArrayList<>();
+            String line;
+            while ((line = in.readLine()) != null) {
+                if (line.startsWith("#")) {
+                    continue;
+                }
+                TestData next = new TestData();
+    
+                Pair<Double,Double> ll = readLine("ll", in.readLine());
+                Pair<Double,Double> en = readLine("en", in.readLine());
+                Pair<Double,Double> ll2 = readLine("ll2", in.readLine());
+    
+                next.code = line;
+                next.ll = new LatLon(ll.a, ll.b);
+                next.en = new EastNorth(en.a, en.b);
+                next.ll2 = new LatLon(ll2.a, ll2.b);
+    
+                result.add(next);
+            }
+            return result;
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java	(revision 7027)
+++ trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java	(revision 7030)
@@ -79,7 +79,7 @@
     public void testOpenUrlGzip() throws Exception {
         Main.initApplicationPreferences();
-        final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true);
-        Assert.assertTrue(x.readLine().startsWith("<?xml version="));
-        x.close();
+        try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true)) {
+            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
+        }
     }
 
@@ -87,7 +87,7 @@
     public void testOpenUrlBzip() throws Exception {
         Main.initApplicationPreferences();
-        final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true);
-        Assert.assertTrue(x.readLine().startsWith("<?xml version="));
-        x.close();
+        try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true)) {
+            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
+        }
     }
 
