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

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

File:
1 edited

Legend:

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

    r6830 r7033  
    1414import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1515import org.openstreetmap.josm.tools.CheckParameterUtil;
    16 import org.openstreetmap.josm.tools.Utils;
    1716
    1817/**
     
    116115        }
    117116        progressMonitor.beginTask("", 1);
    118         InputStream in = null;
    119117        try {
    120118            progressMonitor.indeterminateSubTask(tr("Downloading OSM data..."));
     
    129127            }
    130128
    131             in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true));
    132             if (in == null)
    133                 return null;
    134             return OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
     129            try (InputStream in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true))) {
     130                if (in == null)
     131                    return null;
     132                return OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
     133            }
    135134        } catch(OsmTransferException e) {
    136135            if (cancel) return null;
     
    141140        } finally {
    142141            progressMonitor.finishTask();
    143             Utils.close(in);
    144142            activeConnection = null;
    145143        }
Note: See TracChangeset for help on using the changeset viewer.