Changeset 5834 in josm for trunk/src


Ignore:
Timestamp:
2013-04-07T19:56:52+02:00 (12 years ago)
Author:
Don-vip
Message:

see #8570 - close stream after reading page from wiki

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r5275 r5834  
    3737    public String read(String url) throws IOException {
    3838        BufferedReader in = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "utf-8"));
    39         if (url.startsWith(baseurl) && !url.endsWith("?format=txt"))
    40             return readFromTrac(in);
    41         return readNormal(in);
     39        try {
     40            if (url.startsWith(baseurl) && !url.endsWith("?format=txt"))
     41                return readFromTrac(in);
     42            return readNormal(in);
     43        } finally {
     44            in.close();
     45        }
    4246    }
    4347
     
    5761    private String readLang(URL url) throws IOException {
    5862        InputStream in = url.openStream();
    59         return readFromTrac(new BufferedReader(new InputStreamReader(in, "utf-8")));
     63        try {
     64            return readFromTrac(new BufferedReader(new InputStreamReader(in, "utf-8")));
     65        } finally {
     66            in.close();
     67        }
    6068    }
    6169
Note: See TracChangeset for help on using the changeset viewer.