Changeset 5205 in josm for trunk


Ignore:
Timestamp:
2012-04-29T15:47:20+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #7641 - JOSM does not close file handle when parsing fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r4815 r5205  
    5151    @Override
    5252    public void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
     53        FileInputStream in = null;
    5354        try {
    54             FileInputStream in = new FileInputStream(file);
     55            in = new FileInputStream(file);
    5556            importData(in, file);
    5657        } catch (FileNotFoundException e) {
    5758            e.printStackTrace();
    5859            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()));
     60        } finally {
     61            if (in != null) {
     62                in.close();
     63            }
    5964        }
    6065    }
Note: See TracChangeset for help on using the changeset viewer.