Changeset 6552 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2013-12-28T00:30:15+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java
r6296 r6552 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins; 3 4 import org.openstreetmap.josm.tools.Utils; 3 5 4 6 import static org.openstreetmap.josm.tools.I18n.tr; … … 9 11 import java.io.InputStream; 10 12 import java.io.InputStreamReader; 11 import java.io.UnsupportedEncodingException;12 13 import java.util.LinkedList; 13 14 import java.util.List; … … 35 36 try { 36 37 return new PluginInformation( 37 new ByteArrayInputStream(manifest.getBytes( "utf-8")),38 new ByteArrayInputStream(manifest.getBytes(Utils.UTF_8)), 38 39 name.substring(0, name.length() - 4), 39 40 url 40 41 ); 41 } catch(UnsupportedEncodingException e) {42 throw new PluginListParseException(tr("Failed to create plugin information from manifest for plugin ''{0}''", name), e);43 42 } catch (PluginException e) { 44 43 throw new PluginListParseException(tr("Failed to create plugin information from manifest for plugin ''{0}''", name), e); … … 61 60 BufferedReader r = null; 62 61 try { 63 r = new BufferedReader(new InputStreamReader(in, "utf-8"));62 r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8)); 64 63 String name = null; 65 64 String url = null; -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r6257 r6552 17 17 import java.io.OutputStreamWriter; 18 18 import java.io.PrintWriter; 19 import java.io.UnsupportedEncodingException;20 19 import java.net.HttpURLConnection; 21 20 import java.net.MalformedURLException; … … 174 173 connection.setRequestProperty("Accept-Charset", "utf-8"); 175 174 } 176 in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));175 in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8)); 177 176 StringBuilder sb = new StringBuilder(); 178 177 while ((line = in.readLine()) != null) { … … 207 206 try { 208 207 String line; 209 err = new BufferedReader(new InputStreamReader(errStream, "UTF-8"));208 err = new BufferedReader(new InputStreamReader(errStream, Utils.UTF_8)); 210 209 while ((line = err.readLine()) != null) { 211 210 sb.append(line).append("\n"); … … 319 318 File cacheFile = createSiteCacheFile(pluginDir, site, CacheType.PLUGIN_LIST); 320 319 getProgressMonitor().subTask(tr("Writing plugin list to local cache ''{0}''", cacheFile.toString())); 321 writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), "utf-8"));320 writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), Utils.UTF_8)); 322 321 writer.write(list); 323 322 } catch(IOException e) { … … 363 362 try { 364 363 getProgressMonitor().subTask(tr("Parsing plugin list from site ''{0}''", site)); 365 InputStream in = new ByteArrayInputStream(doc.getBytes( "UTF-8"));364 InputStream in = new ByteArrayInputStream(doc.getBytes(Utils.UTF_8)); 366 365 List<PluginInformation> pis = new PluginListParser().parse(in); 367 366 availablePlugins.addAll(filterDeprecatedPlugins(pis)); 368 } catch (UnsupportedEncodingException e) {369 Main.error(tr("Failed to parse plugin list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));370 e.printStackTrace();371 367 } catch (PluginListParseException e) { 372 368 Main.error(tr("Failed to parse plugin list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));
Note:
See TracChangeset
for help on using the changeset viewer.