Ignore:
Timestamp:
2016-05-16T04:05:58+02:00 (4 years ago)
Author:
Don-vip
Message:

findbugs: DP_DO_INSIDE_DO_PRIVILEGED + UWF_UNWRITTEN_FIELD + RC_REF_COMPARISON + OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/Compression.java

    r9720 r10223  
    9696     * @throws IOException if any I/O error occurs
    9797     */
    98     @SuppressWarnings("resource")
    9998    public static InputStream getUncompressedFileInputStream(File file) throws IOException {
    100         return byExtension(file.getName()).getUncompressedInputStream(new FileInputStream(file));
     99        FileInputStream in = new FileInputStream(file);
     100        try {
     101            return byExtension(file.getName()).getUncompressedInputStream(in);
     102        } catch (IOException e) {
     103            Utils.close(in);
     104            throw e;
     105        }
    101106    }
    102107
     
    129134     * @throws IOException if any I/O error occurs
    130135     */
    131     @SuppressWarnings("resource")
    132136    public static OutputStream getCompressedFileOutputStream(File file) throws IOException {
    133         return byExtension(file.getName()).getCompressedOutputStream(new FileOutputStream(file));
     137        FileOutputStream out = new FileOutputStream(file);
     138        try {
     139            return byExtension(file.getName()).getCompressedOutputStream(out);
     140        } catch (IOException e) {
     141            Utils.close(out);
     142            throw e;
     143        }
    134144    }
    135145}
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r10212 r10223  
    1111import java.util.Collection;
    1212import java.util.List;
     13import java.util.Objects;
    1314import java.util.regex.Matcher;
    1415import java.util.regex.Pattern;
     
    355356        }
    356357        // Read changeset info if neither upload-changeset nor id are set, or if they are both set to the same value
    357         if (id == uploadChangesetId || (id != null && id.equals(uploadChangesetId))) {
     358        if (Objects.equals(id, uploadChangesetId)) {
    358359            uploadChangeset = new Changeset(id != null ? id.intValue() : 0);
    359360            while (true) {
Note: See TracChangeset for help on using the changeset viewer.