Ignore:
Timestamp:
2014-05-01T02:34:43+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - global use of try-with-resources, according to

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r7005 r7033  
    132132    private static void loadInits() {
    133133        Pattern epsgPattern = Pattern.compile("<(\\d+)>(.*)<>");
    134         BufferedReader r = null;
    135         try {
     134        try (
    136135            InputStream in = new MirroredInputStream("resource://data/projection/epsg");
    137             r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));
     136            BufferedReader r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));
     137        ) {
    138138            String line, lastline = "";
    139139            while ((line = r.readLine()) != null) {
    140140                line = line.trim();
    141141                if (!line.startsWith("#") && !line.isEmpty()) {
    142                     if (!lastline.startsWith("#")) throw new AssertionError();
     142                    if (!lastline.startsWith("#")) throw new AssertionError("EPSG file seems corrupted");
    143143                    String name = lastline.substring(1).trim();
    144144                    Matcher m = epsgPattern.matcher(line);
     
    153153        } catch (IOException ex) {
    154154            throw new RuntimeException(ex);
    155         } finally {
    156             Utils.close(r);
    157155        }
    158156    }
Note: See TracChangeset for help on using the changeset viewer.