- Timestamp:
- 2025-04-02T17:56:18+02:00 (2 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r19372 r19374 291 291 ParseResult result; 292 292 try (CachedFile cache = new CachedFile(url)) { 293 Pair<ZipFile, InputStream> zip = cache.findZipEntryInputStream("validator.mapcss", "");294 295 293 Pair<ZipFile, InputStream> zip = cache.findZipEntryInputStream("validator.mapcss", ""); 294 try (InputStream s = zip != null ? zip.b : cache.getInputStream(); 295 Reader reader = new BufferedReader(UTFInputStreamReader.create(s))) { 296 296 if (zip != null) 297 297 I18n.addTexts(cache.getFile()); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r19372 r19374 377 377 try ( 378 378 CachedFile cf = new CachedFile(source).setHttpAccept(PRESET_MIME_TYPES); 379 // zip may be null, but Java 7 allows it: https://blogs.oracle.com/darcy/entry/project_coin_null_try_with380 379 ) { 381 Pair 382 if (zip != null){383 try{380 Pair<ZipFile, InputStream> zip = cf.findZipEntryInputStream("xml", "preset"); 381 try { 382 if (zip != null) { 384 383 zipIcons = cf.getFile(); 385 384 I18n.addTexts(zipIcons); 386 } finally { 385 } 386 try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip.b)) { 387 tp = readAll(new BufferedReader(r), validate, all); 388 } 389 } finally { 390 if (zip != null) { 387 391 Utils.close(zip.b); 388 392 Utils.close(zip.a); 389 393 } 390 }391 try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip.b)) {392 tp = readAll(new BufferedReader(r), validate, all);393 394 } 394 395 } -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r19372 r19374 348 348 if (file == null) 349 349 return null; 350 Pair<String, Pair 350 Pair<String, Pair<ZipFile, InputStream>> res = null; 351 351 try { 352 ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8); 352 ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8); // NOPMD 353 353 ZipEntry resentry = null; 354 354 Enumeration<? extends ZipEntry> entries = zipFile.entries(); … … 361 361 } 362 362 if (resentry != null) { 363 InputStream is = zipFile.getInputStream(resentry); 363 InputStream is = zipFile.getInputStream(resentry); // NOPMD 364 364 res = Pair.create(resentry.getName(), Pair.create(zipFile, is)); 365 365 } else {
Note:
See TracChangeset
for help on using the changeset viewer.