Changeset 6268 in josm for trunk/test


Ignore:
Timestamp:
2013-09-27T19:50:29+02:00 (6 years ago)
Author:
Don-vip
Message:

Sonar/FindBugs - Bad practice - Method may fail to close stream

Location:
trunk/test/functional/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java

    r5556 r6268  
    66import java.awt.BorderLayout;
    77import java.io.File;
     8import java.io.InputStream;
    89import java.text.MessageFormat;
    910import java.util.Properties;
     
    3738        //
    3839        try {
    39             testProperties.load(HistoryBrowserTest.class.getResourceAsStream("/test-functional-env.properties"));
     40            InputStream is = HistoryBrowserTest.class.getResourceAsStream("/test-functional-env.properties");
     41            testProperties.load(is);
     42            is.close();
    4043        } catch(Exception e){
    4144            logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
     
    8386    }
    8487
     88    /**
     89     * Constructs a new {@code HistoryBrowserTest}.
     90     */
    8591    public HistoryBrowserTest(){
    8692        build();
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r5556 r6268  
    1212import java.io.FileWriter;
    1313import java.io.IOException;
     14import java.io.InputStream;
    1415import java.io.PrintWriter;
    1516import java.text.MessageFormat;
     
    138139        //
    139140        try {
    140             testProperties.load(MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties"));
     141            InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties");
     142            testProperties.load(is);
     143            is.close();
    141144        } catch(Exception e){
    142145            logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r5556 r6268  
    1010import java.io.FileWriter;
    1111import java.io.IOException;
     12import java.io.InputStream;
    1213import java.io.PrintWriter;
    1314import java.text.MessageFormat;
     
    145146        //
    146147        try {
    147             testProperties.load(MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties"));
     148            InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties");
     149            testProperties.load(is);
     150            is.close();
    148151        } catch(Exception e){
    149152            logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties"));
Note: See TracChangeset for help on using the changeset viewer.