Changeset 9799 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-02-14T20:49:43+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r9768 r9799 293 293 factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); 294 294 295 InputStream in = new CachedFile(baseUrl). 296 setHttpHeaders(headers). 295 try (CachedFile cf = new CachedFile(baseUrl); InputStream in = cf.setHttpHeaders(headers). 297 296 setMaxAge(7 * CachedFile.DAYS). 298 297 setCachingStrategy(CachedFile.CachingStrategy.IfModifiedSince). 299 getInputStream(); 300 try { 298 getInputStream()) { 301 299 byte[] data = Utils.readBytesFromStream(in); 302 300 if (data == null || data.length == 0) { -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r9597 r9799 269 269 public static List<ProjectionDefinition> loadProjectionDefinitions(String path) throws IOException { 270 270 try ( 271 InputStream in = new CachedFile(path).getInputStream(); 271 CachedFile cf = new CachedFile(path); 272 InputStream in = cf.getInputStream(); 272 273 BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); 273 274 ) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r9371 r9799 719 719 } 720 720 } 721 } finally { 722 cache.close(); 721 723 } 722 724 return result; -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r8958 r9799 53 53 super.initialize(); 54 54 if (ENGINE != null) { 55 try ( Reader reader = new InputStreamReader(56 new CachedFile("resource://data/validator/opening_hours.js").getInputStream(), StandardCharsets.UTF_8)) {55 try (CachedFile cf = new CachedFile("resource://data/validator/opening_hours.js"); 56 Reader reader = new InputStreamReader(cf.getInputStream(), StandardCharsets.UTF_8)) { 57 57 ENGINE.eval(reader); 58 58 ENGINE.eval("var opening_hours = require('opening_hours');"); -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r9744 r9799 166 166 for (String source : Main.pref.getCollection(PREF_SOURCES, DEFAULT_SOURCES)) { 167 167 try ( 168 InputStream s = new CachedFile(source).getInputStream(); 168 CachedFile cf = new CachedFile(source); 169 InputStream s = cf.getInputStream(); 169 170 BufferedReader reader = new BufferedReader(UTFInputStreamReader.create(s)); 170 171 ) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r9400 r9799 324 324 Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString())); 325 325 Main.error(e); 326 } finally { 327 if (cf != null) { 328 cf.close(); 329 } 326 330 } 327 331 return null; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r8958 r9799 323 323 throws SAXException, IOException { 324 324 Collection<TaggingPreset> tp; 325 CachedFile cf = new CachedFile(source).setHttpAccept(PRESET_MIME_TYPES);326 325 try ( 326 CachedFile cf = new CachedFile(source).setHttpAccept(PRESET_MIME_TYPES); 327 327 // zip may be null, but Java 7 allows it: https://blogs.oracle.com/darcy/entry/project_coin_null_try_with 328 328 InputStream zip = cf.findZipEntryInputStream("xml", "preset") -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r9078 r9799 289 289 public Iterable<Object> startWithValidation(final Reader in, String namespace, String schemaSource) throws SAXException { 290 290 SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); 291 try ( InputStream mis = new CachedFile(schemaSource).getInputStream()) {291 try (CachedFile cf = new CachedFile(schemaSource); InputStream mis = cf.getInputStream()) { 292 292 Schema schema = factory.newSchema(new StreamSource(mis)); 293 293 ValidatorHandler validator = schema.newValidatorHandler();
Note:
See TracChangeset
for help on using the changeset viewer.