Changeset 7033 in josm for trunk/src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2014-05-01T02:34:43+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r7024 r7033 326 326 protected byte[] updateData() throws IOException { 327 327 URL u = getAttributionUrl(); 328 UTFInputStreamReader in = UTFInputStreamReader.create(Utils.openURL(u));329 String r = new Scanner(in).useDelimiter("\\A").next();330 Utils.close(in);331 Main.info("Successfully loaded Bing attribution data.");332 return r.getBytes("utf-8");328 try (Scanner scanner = new Scanner(UTFInputStreamReader.create(Utils.openURL(u)))) { 329 String r = scanner.useDelimiter("\\A").next(); 330 Main.info("Successfully loaded Bing attribution data."); 331 return r.getBytes("UTF-8"); 332 } 333 333 } 334 334 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r7025 r7033 21 21 import java.io.File; 22 22 import java.io.FileInputStream; 23 import java.io.FileNotFoundException; 23 24 import java.io.IOException; 24 25 import java.io.InputStream; … … 171 172 } 172 173 GpxData data = null; 173 try { 174 InputStream iStream; 175 if (sel.getName().toLowerCase().endsWith(".gpx.gz")) { 176 iStream = new GZIPInputStream(new FileInputStream(sel)); 177 } else { 178 iStream = new FileInputStream(sel); 179 } 174 try (InputStream iStream = createInputStream(sel)) { 180 175 GpxReader reader = new GpxReader(iStream); 181 176 reader.parse(false); … … 211 206 } finally { 212 207 outerPanel.setCursor(Cursor.getDefaultCursor()); 208 } 209 } 210 211 private InputStream createInputStream(File sel) throws IOException, FileNotFoundException { 212 if (sel.getName().toLowerCase().endsWith(".gpx.gz")) { 213 return new GZIPInputStream(new FileInputStream(sel)); 214 } else { 215 return new FileInputStream(sel); 213 216 } 214 217 }
Note:
See TracChangeset
for help on using the changeset viewer.