Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/dataimport/src/org/openstreetmap/josm/plugins/dataimport/io/TangoGPS.java

    r30737 r30738  
    3030
    3131/**
    32  * @author dmuecke Data import for TangoGPS file format.
     32 * Data import for TangoGPS file format.
     33 * @author dmuecke
    3334 */
    3435public class TangoGPS extends FileImporter {
     
    4041    /**
    4142     * @author cbrill
    42      * This function imports data from file and adds trackpoints
    43      *         to a layer.
     43     * This function imports data from file and adds trackpoints to a layer.
    4444     * Read a log file from TangoGPS. These are simple text files in the
    4545     * form: <lat>,<lon>,<elevation>,<speed>,<course>,<hdop>,<datetime>
     
    5353        int failure = 0;
    5454
    55         BufferedReader rd = null;
    56         try {
     55        try (
    5756            InputStream source = new FileInputStream(file);
    58             rd = new BufferedReader(new InputStreamReader(source));
    59 
     57            BufferedReader rd = new BufferedReader(new InputStreamReader(source));
     58         ) {
    6059            String line;
    6160            while ((line = rd.readLine()) != null) {
     
    7271                        imported++;
    7372                    } catch (NumberFormatException e) {
    74                         e.printStackTrace();
     73                        Main.error(e);
    7574                    }
    7675                }
     
    9291            }
    9392            showInfobox(imported,failure);
    94         } finally {
    95             if (rd != null) {
    96                 rd.close();
    97             }
    9893        }
    9994    }
     
    106101        if (lineElements.length < 2)
    107102            return null;
    108         return new LatLon(parseCoord(lineElements[0]),
    109                 parseCoord(lineElements[1]));
     103        return new LatLon(parseCoord(lineElements[0]), parseCoord(lineElements[1]));
    110104    }
    111105
     
    118112        }
    119113    }
    120 
    121 
    122114}
Note: See TracChangeset for help on using the changeset viewer.