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

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

Location:
trunk/src/org/openstreetmap/josm/data/projection
Files:
2 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    }
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java

    r6883 r7033  
    4848    public NTV2GridShiftFile getShiftFile() {
    4949        if (instance == null) {
    50             try {
    51                 InputStream is = new MirroredInputStream(gridFileName);
     50            try (InputStream is = new MirroredInputStream(gridFileName)) {
    5251                instance = new NTV2GridShiftFile();
    5352                instance.loadGridShiftFile(is, false);
     
    5857        return instance;
    5958    }
    60 
    6159}
Note: See TracChangeset for help on using the changeset viewer.