Index: trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java	(revision 7033)
@@ -5,5 +5,6 @@
 
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Collection;
@@ -63,7 +64,10 @@
 
     @Test
-    public void filter_test() throws ParseError, IllegalDataException, FileNotFoundException {
+    public void filter_test() throws ParseError, IllegalDataException, IOException {
         for (int i : new int [] {1,2,3, 11,12,13,14, 15}) {
-            DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/filterTests.osm"), NullProgressMonitor.INSTANCE);
+            DataSet ds;
+            try (InputStream is = new FileInputStream("data_nodist/filterTests.osm")) {
+                ds = OsmReader.parseDataSet(is, NullProgressMonitor.INSTANCE);
+            }
 
             List<Filter> filters = new LinkedList<>();
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java	(revision 7033)
@@ -3,4 +3,5 @@
 
 import java.io.FileInputStream;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -66,6 +67,8 @@
     public void testRemove() throws Exception {
         Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/restriction.osm"), NullProgressMonitor.INSTANCE);
-        removeAllTest(ds);
+        try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) {
+            DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+            removeAllTest(ds);
+        }
     }
 
@@ -73,11 +76,13 @@
     public void testMove() throws Exception {
         Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/restriction.osm"), NullProgressMonitor.INSTANCE);
-
-        for (Node n: ds.getNodes()) {
-            n.setCoor(new LatLon(10, 10));
+        try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) {
+            DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+    
+            for (Node n: ds.getNodes()) {
+                n.setCoor(new LatLon(10, 10));
+            }
+    
+            removeAllTest(ds);
         }
-
-        removeAllTest(ds);
     }
 }
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 7033)
@@ -49,47 +49,44 @@
     @Test
     public void test() throws IOException, FileNotFoundException {
-        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("data_nodist/projection-reference-data.csv"), Utils.UTF_8));
-        StringBuilder fail = new StringBuilder();
-        String line;
-        while ((line = in.readLine()) != null) {
-            if (line.startsWith("#")) {
-                continue;
-            }
-            String[] f = line.split(",");
-            String code = f[0];
-            double lat = Double.parseDouble(f[1]);
-            double lon = Double.parseDouble(f[2]);
-            double east = Double.parseDouble(f[3]);
-            double north = Double.parseDouble(f[4]);
-            Projection p = Projections.getProjectionByCode(code);
-            {
+        try (BufferedReader in = new BufferedReader(new InputStreamReader(
+                new FileInputStream("data_nodist/projection-reference-data.csv"), Utils.UTF_8))) {
+            StringBuilder fail = new StringBuilder();
+            String line;
+            while ((line = in.readLine()) != null) {
+                if (line.startsWith("#")) {
+                    continue;
+                }
+                String[] f = line.split(",");
+                String code = f[0];
+                double lat = Double.parseDouble(f[1]);
+                double lon = Double.parseDouble(f[2]);
+                double east = Double.parseDouble(f[3]);
+                double north = Double.parseDouble(f[4]);
+                Projection p = Projections.getProjectionByCode(code);
                 EastNorth en = p.latlon2eastNorth(new LatLon(lat, lon));
-                String error = String.format("%s (%s): Projecting latlon(%s,%s):%n" +
+                String errorEN = String.format("%s (%s): Projecting latlon(%s,%s):%n" +
                         "        expected: eastnorth(%s,%s),%n" +
                         "        but got:  eastnorth(%s,%s)!%n",
                         p.toString(), code, lat, lon, east, north, en.east(), en.north());
-                double EPSILON = 1e-3; // 1 mm accuracy
-                if (Math.abs(east - en.east()) > EPSILON || Math.abs(north - en.north()) > EPSILON) {
-                    fail.append(error);
+                double EPSILON_EN = 1e-3; // 1 mm accuracy
+                if (Math.abs(east - en.east()) > EPSILON_EN || Math.abs(north - en.north()) > EPSILON_EN) {
+                    fail.append(errorEN);
                 }
-            }
-            {
                 LatLon ll = p.eastNorth2latlon(new EastNorth(east, north));
-                String error = String.format("%s (%s): Inverse projecting eastnorth(%s,%s):%n" +
+                String errorLL = String.format("%s (%s): Inverse projecting eastnorth(%s,%s):%n" +
                         "        expected: latlon(%s,%s),%n" +
                         "        but got:  latlon(%s,%s)!%n",
                         p.toString(), code, east, north, lat, lon, ll.lat(), ll.lon());
-                double EPSILON = Math.toDegrees(1e-3 / 6378137); // 1 mm accuracy (or better)
-                if (Math.abs(lat - ll.lat()) > EPSILON || Math.abs(lon - ll.lon()) > EPSILON) {
+                double EPSILON_LL = Math.toDegrees(1e-3 / 6378137); // 1 mm accuracy (or better)
+                if (Math.abs(lat - ll.lat()) > EPSILON_LL || Math.abs(lon - ll.lon()) > EPSILON_LL) {
                     if (!("yes".equals(System.getProperty("suppressPermanentFailure")) && code.equals("EPSG:21781"))) {
-                        fail.append(error);
+                        fail.append(errorLL);
                     }
                 }
             }
-        }
-        Utils.close(in);
-        if (fail.length() > 0) {
-            System.err.println(fail.toString());
-            throw new AssertionError(fail.toString());
+            if (fail.length() > 0) {
+                System.err.println(fail.toString());
+                throw new AssertionError(fail.toString());
+            }
         }
     }
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 7033)
@@ -6,4 +6,5 @@
 
 import java.io.FileInputStream;
+import java.io.InputStream;
 
 import org.junit.Before;
@@ -33,8 +34,10 @@
     @Test
     public void testTicket6313() throws Exception {
-        final DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/UnconnectedWaysTest.osm"), NullProgressMonitor.INSTANCE);
-        bib.visit(ds.allPrimitives());
-        bib.endTest();
-        assertThat(bib.getErrors(), isEmpty());
+        try (InputStream fis = new FileInputStream("data_nodist/UnconnectedWaysTest.osm")) {
+            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+            bib.visit(ds.allPrimitives());
+            bib.endTest();
+            assertThat(bib.getErrors(), isEmpty());
+        }
     }
 }
Index: trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java	(revision 7033)
@@ -3,5 +3,6 @@
 
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.List;
 
@@ -24,8 +25,10 @@
 
     @BeforeClass
-    public static void loadData() throws FileNotFoundException, IllegalDataException {
+    public static void loadData() throws IllegalDataException, IOException {
         Main.initApplicationPreferences();
         Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        testDataset = OsmReader.parseDataSet(new FileInputStream("data_nodist/relation_sort.osm"), NullProgressMonitor.INSTANCE);
+        try (InputStream fis = new FileInputStream("data_nodist/relation_sort.osm")) {
+            testDataset = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java	(revision 7030)
+++ trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java	(revision 7033)
@@ -3,5 +3,6 @@
 
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Arrays;
 import java.util.List;
@@ -25,8 +26,10 @@
 
     @BeforeClass
-    public static void loadData() throws FileNotFoundException, IllegalDataException {
+    public static void loadData() throws IllegalDataException, IOException {
         Main.initApplicationPreferences();
         Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        testDataset = OsmReader.parseDataSet(new FileInputStream("data_nodist/relation_sort.osm"), NullProgressMonitor.INSTANCE);
+        try (InputStream fis = new FileInputStream("data_nodist/relation_sort.osm")) {
+            testDataset = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
     }
 
