Changeset 7037 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2014-05-01T16:28:25+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r7033 r7037 153 153 */ 154 154 protected String downloadPluginList(String site, final ProgressMonitor monitor) { 155 BufferedReader in = null;156 157 155 /* replace %<x> with empty string or x=plugins (separated with comma) */ 158 156 String pl = Utils.join(",", Main.pref.getCollection("plugins")); … … 174 172 connection.setRequestProperty("Accept-Charset", "utf-8"); 175 173 } 176 in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8)); 177 StringBuilder sb = new StringBuilder(); 178 String line; 179 while ((line = in.readLine()) != null) { 180 sb.append(line).append("\n"); 181 } 182 return sb.toString(); 174 try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8))) { 175 StringBuilder sb = new StringBuilder(); 176 String line; 177 while ((line = in.readLine()) != null) { 178 sb.append(line).append("\n"); 179 } 180 return sb.toString(); 181 } 183 182 } catch (MalformedURLException e) { 184 183 if (canceled) return null; … … 197 196 connection = null; 198 197 } 199 Utils.close(in);200 198 monitor.finishTask(); 201 199 } … … 206 204 try (InputStream errStream = connection.getErrorStream()) { 207 205 if (errStream != null) { 208 BufferedReader err = null; 209 try { 206 try (BufferedReader err = new BufferedReader(new InputStreamReader(errStream, Utils.UTF_8))) { 210 207 String line; 211 err = new BufferedReader(new InputStreamReader(errStream, Utils.UTF_8));212 208 while ((line = err.readLine()) != null) { 213 209 sb.append(line).append("\n"); … … 216 212 Main.error(e); 217 213 Main.error(ex); 218 } finally {219 Utils.close(err);220 214 } 221 215 }
Note:
See TracChangeset
for help on using the changeset viewer.