Changeset 19374 in josm for trunk/src


Ignore:
Timestamp:
2025-04-02T17:56:18+02:00 (2 months ago)
Author:
stoecker
Message:

fix last checkins

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  
    291291        ParseResult result;
    292292        try (CachedFile cache = new CachedFile(url)) {
    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))) {
     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))) {
    296296                if (zip != null)
    297297                    I18n.addTexts(cache.getFile());
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r19372 r19374  
    377377        try (
    378378            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_with
    380379        ) {
    381             Pair <ZipFile, InputStream> zip = cf.findZipEntryInputStream("xml", "preset");
    382             if (zip != null) {
    383                 try {
     380            Pair<ZipFile, InputStream> zip = cf.findZipEntryInputStream("xml", "preset");
     381            try {
     382                if (zip != null) {
    384383                    zipIcons = cf.getFile();
    385384                    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) {
    387391                    Utils.close(zip.b);
    388392                    Utils.close(zip.a);
    389393                }
    390             }
    391             try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip.b)) {
    392                 tp = readAll(new BufferedReader(r), validate, all);
    393394            }
    394395        }
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r19372 r19374  
    348348        if (file == null)
    349349            return null;
    350         Pair<String, Pair <ZipFile, InputStream>> res = null;
     350        Pair<String, Pair<ZipFile, InputStream>> res = null;
    351351        try {
    352             ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8);
     352            ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8); // NOPMD
    353353            ZipEntry resentry = null;
    354354            Enumeration<? extends ZipEntry> entries = zipFile.entries();
     
    361361            }
    362362            if (resentry != null) {
    363                 InputStream is = zipFile.getInputStream(resentry);
     363                InputStream is = zipFile.getInputStream(resentry); // NOPMD
    364364                res = Pair.create(resentry.getName(), Pair.create(zipFile, is));
    365365            } else {
Note: See TracChangeset for help on using the changeset viewer.