Changeset 9639 in josm for trunk/src


Ignore:
Timestamp:
2016-01-26T19:21:58+01:00 (4 years ago)
Author:
stoecker
Message:

fix possible resource leaks

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r9067 r9639  
    5252    public NTV2GridShiftFile getShiftFile() {
    5353        if (instance == null) {
    54             try (InputStream is = new CachedFile(gridFileName).getInputStream()) {
     54            try (CachedFile cf = new CachedFile(gridFileName); InputStream is = cf.getInputStream()) {
    5555                instance = new NTV2GridShiftFile();
    5656                instance.loadGridShiftFile(is, false);
  • trunk/src/org/openstreetmap/josm/tools/FontsManager.java

    r8882 r9639  
    3838        for (String fontFile : INCLUDED_FONTS) {
    3939            String url = "resource://data/fonts/"+fontFile;
    40             try (InputStream i = new CachedFile(url).getInputStream()) {
     40            try (CachedFile cf = new CachedFile(url); InputStream i = cf.getInputStream()) {
    4141                ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, i));
    4242            } catch (IOException | FontFormatException ex) {
  • trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java

    r9070 r9639  
    7272    private static void initialize() {
    7373        leftHandTrafficPolygons = new ArrayList<>();
    74         try (InputStream is = new CachedFile("resource://data/left-right-hand-traffic.osm").getInputStream()) {
     74        try (CachedFile cf = new CachedFile("resource://data/left-right-hand-traffic.osm");
     75                InputStream is = cf.getInputStream()) {
    7576            DataSet data = OsmReader.parseDataSet(is, null);
    7677            for (Way w : data.getWays()) {
Note: See TracChangeset for help on using the changeset viewer.