Changeset 11456 in josm


Ignore:
Timestamp:
2017-01-12T02:15:33+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2095 - Resources should be closed

File:
1 edited

Legend:

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

    r7937 r11456  
    3939        Main.info("exporting notes to file: " + file);
    4040        if (layer instanceof NoteLayer) {
    41             OutputStream os = new FileOutputStream(file);
    42             NoteWriter writer = new NoteWriter(os);
    43             writer.write(((NoteLayer) layer).getNoteData());
    44             os.flush();
    45             writer.close();
     41            try (OutputStream os = new FileOutputStream(file);
     42                 NoteWriter writer = new NoteWriter(os)) {
     43                writer.write(((NoteLayer) layer).getNoteData());
     44            }
    4645        }
    4746    }
Note: See TracChangeset for help on using the changeset viewer.