Ignore:
Timestamp:
2016-02-14T20:49:43+01:00 (8 years ago)
Author:
stoecker
Message:

fix Coverity issues 1349911, 1349912, 1349913, 1349917, 1349918, 1349919, 1349922, 1349923

Location:
trunk/src/org/openstreetmap/josm/data
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r9768 r9799  
    293293        factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    294294
    295         InputStream in = new CachedFile(baseUrl).
    296                 setHttpHeaders(headers).
     295        try (CachedFile cf = new CachedFile(baseUrl); InputStream in = cf.setHttpHeaders(headers).
    297296                setMaxAge(7 * CachedFile.DAYS).
    298297                setCachingStrategy(CachedFile.CachingStrategy.IfModifiedSince).
    299                 getInputStream();
    300         try {
     298                getInputStream()) {
    301299            byte[] data = Utils.readBytesFromStream(in);
    302300            if (data == null || data.length == 0) {
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r9597 r9799  
    269269    public static List<ProjectionDefinition> loadProjectionDefinitions(String path) throws IOException {
    270270        try (
    271             InputStream in = new CachedFile(path).getInputStream();
     271            CachedFile cf = new CachedFile(path);
     272            InputStream in = cf.getInputStream();
    272273            BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
    273274        ) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r9371 r9799  
    719719                }
    720720            }
     721        } finally {
     722            cache.close();
    721723        }
    722724        return result;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r8958 r9799  
    5353        super.initialize();
    5454        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)) {
    5757                ENGINE.eval(reader);
    5858                ENGINE.eval("var opening_hours = require('opening_hours');");
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r9744 r9799  
    166166        for (String source : Main.pref.getCollection(PREF_SOURCES, DEFAULT_SOURCES)) {
    167167            try (
    168                 InputStream s = new CachedFile(source).getInputStream();
     168                CachedFile cf = new CachedFile(source);
     169                InputStream s = cf.getInputStream();
    169170                BufferedReader reader = new BufferedReader(UTFInputStreamReader.create(s));
    170171            ) {
Note: See TracChangeset for help on using the changeset viewer.