- Timestamp:
- 2014-05-09T05:32:37+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r7037 r7082 13 13 import java.io.IOException; 14 14 import java.io.InputStreamReader; 15 import java.nio.charset.StandardCharsets; 15 16 import java.util.ArrayList; 16 17 import java.util.Arrays; … … 39 40 import org.openstreetmap.josm.tools.MultiMap; 40 41 import org.openstreetmap.josm.tools.Shortcut; 41 import org.openstreetmap.josm.tools.Utils;42 42 import org.xml.sax.SAXException; 43 43 … … 292 292 293 293 for (File urlFile: urlFiles) { 294 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8))) {294 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), StandardCharsets.UTF_8))) { 295 295 String line; 296 296 while ((line = reader.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r7037 r7082 12 12 import java.io.PrintStream; 13 13 import java.lang.management.ManagementFactory; 14 import java.nio.charset.StandardCharsets; 14 15 import java.util.ArrayList; 15 16 import java.util.Date; … … 40 41 import org.openstreetmap.josm.io.OsmExporter; 41 42 import org.openstreetmap.josm.io.OsmImporter; 42 import org.openstreetmap.josm.tools.Utils;43 43 44 44 /** … … 303 303 File pidFile = getPidFile(file); 304 304 if (pidFile.exists()) { 305 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), Utils.UTF_8))) {305 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), StandardCharsets.UTF_8))) { 306 306 String jvmId = reader.readLine(); 307 307 if (jvmId != null) { -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r7033 r7082 11 11 import java.io.FileInputStream; 12 12 import java.io.InputStream; 13 import java.nio.charset.StandardCharsets; 13 14 import java.util.ArrayList; 14 15 import java.util.Collection; … … 236 237 try { 237 238 String toXML = Main.pref.toXML(true); 238 InputStream is = new ByteArrayInputStream(toXML.getBytes( Utils.UTF_8));239 InputStream is = new ByteArrayInputStream(toXML.getBytes(StandardCharsets.UTF_8)); 239 240 DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); 240 241 builderFactory.setValidating(false); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r7033 r7082 19 19 import java.lang.annotation.RetentionPolicy; 20 20 import java.lang.reflect.Field; 21 import java.nio.charset.StandardCharsets; 21 22 import java.util.ArrayList; 22 23 import java.util.Collection; … … 737 738 738 739 try (PrintWriter out = new PrintWriter(new OutputStreamWriter( 739 new FileOutputStream(prefFile + "_tmp"), Utils.UTF_8), false)) {740 new FileOutputStream(prefFile + "_tmp"), StandardCharsets.UTF_8), false)) { 740 741 out.print(toXML(false)); 741 742 } … … 760 761 settingsMap.clear(); 761 762 File pref = getPreferenceFile(); 762 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8))) {763 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), StandardCharsets.UTF_8))) { 763 764 validateXML(in); 764 765 } 765 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8))) {766 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), StandardCharsets.UTF_8))) { 766 767 fromXML(in); 767 768 } -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r7048 r7082 6 6 import java.io.InputStream; 7 7 import java.io.InputStreamReader; 8 import java.nio.charset.StandardCharsets; 8 9 import java.util.Collection; 9 10 import java.util.Collections; … … 33 34 import org.openstreetmap.josm.io.MirroredInputStream; 34 35 import org.openstreetmap.josm.tools.Pair; 35 import org.openstreetmap.josm.tools.Utils;36 36 37 37 /** … … 134 134 try ( 135 135 InputStream in = new MirroredInputStream("resource://data/projection/epsg"); 136 BufferedReader r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));136 BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); 137 137 ) { 138 138 String line, lastline = ""; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r7037 r7082 23 23 import java.io.InputStream; 24 24 import java.io.Serializable; 25 import java.nio.charset.StandardCharsets; 25 26 import java.util.ArrayList; 26 27 import java.util.HashMap; 27 28 import java.util.List; 28 29 import org.openstreetmap.josm.tools.Utils;30 29 31 30 /** … … 104 103 topLevelSubGrid = null; 105 104 in.read(b8); 106 String overviewHeaderCountId = new String(b8, Utils.UTF_8);105 String overviewHeaderCountId = new String(b8, StandardCharsets.UTF_8); 107 106 if (!"NUM_OREC".equals(overviewHeaderCountId)) 108 107 throw new IllegalArgumentException("Input file is not an NTv2 grid shift file"); … … 127 126 in.read(b8); 128 127 in.read(b8); 129 shiftType = new String(b8, Utils.UTF_8);128 shiftType = new String(b8, StandardCharsets.UTF_8); 130 129 in.read(b8); 131 130 in.read(b8); -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r7025 r7082 23 23 import java.io.InputStream; 24 24 import java.io.Serializable; 25 import java.nio.charset.StandardCharsets; 25 26 26 27 import org.openstreetmap.josm.Main; … … 75 76 in.read(b8); 76 77 in.read(b8); 77 subGridName = new String(b8, Utils.UTF_8).trim();78 in.read(b8); 79 in.read(b8); 80 parentSubGridName = new String(b8, Utils.UTF_8).trim();81 in.read(b8); 82 in.read(b8); 83 created = new String(b8, Utils.UTF_8);84 in.read(b8); 85 in.read(b8); 86 updated = new String(b8, Utils.UTF_8);78 subGridName = new String(b8, StandardCharsets.UTF_8).trim(); 79 in.read(b8); 80 in.read(b8); 81 parentSubGridName = new String(b8, StandardCharsets.UTF_8).trim(); 82 in.read(b8); 83 in.read(b8); 84 created = new String(b8, StandardCharsets.UTF_8); 85 in.read(b8); 86 in.read(b8); 87 updated = new String(b8, StandardCharsets.UTF_8); 87 88 in.read(b8); 88 89 in.read(b8); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r7033 r7082 13 13 import java.io.OutputStreamWriter; 14 14 import java.io.PrintWriter; 15 import java.nio.charset.StandardCharsets; 15 16 import java.util.ArrayList; 16 17 import java.util.Arrays; … … 171 172 File file = new File(getValidatorDir() + "ignorederrors"); 172 173 if (file.exists()) { 173 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8))) {174 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { 174 175 for (String line = in.readLine(); line != null; line = in.readLine()) { 175 176 ignoredErrors.add(line); … … 194 195 public static void saveIgnoredErrors() { 195 196 try (PrintWriter out = new PrintWriter(new OutputStreamWriter( 196 new FileOutputStream(getValidatorDir() + "ignorederrors"), Utils.UTF_8), false)) {197 new FileOutputStream(getValidatorDir() + "ignorederrors"), StandardCharsets.UTF_8), false)) { 197 198 for (String e : ignoredErrors) { 198 199 out.println(e); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r7046 r7082 6 6 import java.io.InputStreamReader; 7 7 import java.io.Reader; 8 import java.nio.charset.StandardCharsets; 8 9 import java.util.ArrayList; 9 10 import java.util.Arrays; … … 24 25 import org.openstreetmap.josm.data.validation.TestError; 25 26 import org.openstreetmap.josm.io.MirroredInputStream; 26 import org.openstreetmap.josm.tools.Utils;27 27 28 28 /** … … 53 53 if (ENGINE != null) { 54 54 try (Reader reader = new InputStreamReader( 55 new MirroredInputStream("resource://data/validator/opening_hours.js"), Utils.UTF_8)) {55 new MirroredInputStream("resource://data/validator/opening_hours.js"), StandardCharsets.UTF_8)) { 56 56 ENGINE.eval(reader); 57 57 // fake country/state to not get errors on holidays … … 218 218 return errors; 219 219 } 220 220 221 221 /** 222 222 * Translates and shortens the error/warning message. -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r7075 r7082 12 12 import java.io.IOException; 13 13 import java.net.URL; 14 import java.nio.charset.StandardCharsets; 14 15 import java.util.regex.Matcher; 15 16 import java.util.regex.Pattern; … … 31 32 import org.openstreetmap.josm.tools.LanguageInfo; 32 33 import org.openstreetmap.josm.tools.OpenBrowser; 33 import org.openstreetmap.josm.tools.Utils;34 34 import org.openstreetmap.josm.tools.WikiReader; 35 35 … … 92 92 Main.pref.put("cache.motd.html.java", myJava); 93 93 Main.pref.put("cache.motd.html.lang", myLang); 94 return motd.getBytes( Utils.UTF_8);94 return motd.getBytes(StandardCharsets.UTF_8); 95 95 } 96 96 -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r7005 r7082 9 9 import java.awt.geom.AffineTransform; 10 10 import java.awt.geom.Point2D; 11 import java.nio.charset.StandardCharsets; 11 12 import java.util.ArrayList; 12 13 import java.util.Collection; … … 1328 1329 getWidth() + "_" + getHeight() + "_" + getProjection().toString(); 1329 1330 CRC32 id = new CRC32(); 1330 id.update(x.getBytes( Utils.UTF_8));1331 id.update(x.getBytes(StandardCharsets.UTF_8)); 1331 1332 return (int)id.getValue(); 1332 1333 } … … 1370 1371 1371 1372 private LinkedList<CursorInfo> cursors = new LinkedList<>(); 1372 1373 1373 1374 /** 1374 1375 * Set new cursor. … … 1384 1385 setCursor(cursor); 1385 1386 } 1386 1387 1387 1388 public void setNewCursor(int cursor, Object reference) { 1388 1389 setNewCursor(Cursor.getPredefinedCursor(cursor), reference); 1389 1390 } 1390 1391 1391 1392 /** 1392 1393 * Remove the new cursor and reset to previous -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r7033 r7082 25 25 import java.io.InputStreamReader; 26 26 import java.io.OutputStream; 27 import java.nio.charset.StandardCharsets; 27 28 import java.util.ArrayList; 28 29 import java.util.Arrays; … … 655 656 try { 656 657 InputStream is = s.getSourceInputStream(); 657 try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) {658 try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { 658 659 String line; 659 660 while ((line = reader.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r7033 r7082 18 18 import java.net.HttpURLConnection; 19 19 import java.net.URL; 20 import java.nio.charset.StandardCharsets; 20 21 import java.text.DecimalFormat; 21 22 import java.util.ArrayList; … … 371 372 try ( 372 373 InputStream inputStream = connection.getInputStream(); 373 Reader reader = new InputStreamReader(inputStream, Utils.UTF_8);374 Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); 374 375 ) { 375 376 InputSource inputSource = new InputSource(reader); -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r7033 r7082 16 16 import java.io.InputStreamReader; 17 17 import java.io.StringReader; 18 import java.nio.charset.StandardCharsets; 18 19 import java.util.Locale; 19 20 import java.util.Observable; … … 52 53 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType; 53 54 import org.openstreetmap.josm.tools.OpenBrowser; 54 import org.openstreetmap.josm.tools.Utils;55 55 import org.openstreetmap.josm.tools.WindowGeometry; 56 56 … … 138 138 try (BufferedReader reader = new BufferedReader( 139 139 new InputStreamReader( 140 getClass().getResourceAsStream("/data/help-browser.css"), Utils.UTF_8140 getClass().getResourceAsStream("/data/help-browser.css"), StandardCharsets.UTF_8 141 141 ) 142 142 )) { -
trunk/src/org/openstreetmap/josm/gui/help/HelpContentReader.java
r7037 r7082 8 8 import java.net.MalformedURLException; 9 9 import java.net.URL; 10 import java.nio.charset.StandardCharsets; 10 11 11 12 import org.openstreetmap.josm.tools.Utils; … … 49 50 con = Utils.openHttpConnection(u); 50 51 con.connect(); 51 try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), Utils.UTF_8))) {52 try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) { 52 53 return prepareHelpContent(in, dotest, u); 53 54 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r7030 r7082 7 7 import java.io.IOException; 8 8 import java.io.InputStreamReader; 9 import java.nio.charset.StandardCharsets; 9 10 import java.util.ArrayList; 10 11 import java.util.Arrays; … … 235 236 return new XmlStyleSource(entry); 236 237 else { 237 try (InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8)) {238 try (InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) { 238 239 WHILE: while (true) { 239 240 int c = reader.read(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r7022 r7082 14 14 import java.lang.reflect.Method; 15 15 import java.net.URLEncoder; 16 import java.nio.charset.StandardCharsets; 16 17 import java.util.ArrayList; 17 18 import java.util.Arrays; … … 579 580 public static long CRC32_checksum(String s) { 580 581 CRC32 cs = new CRC32(); 581 cs.update(s.getBytes( Utils.UTF_8));582 cs.update(s.getBytes(StandardCharsets.UTF_8)); 582 583 return cs.getValue(); 583 584 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r7081 r7082 9 9 import java.io.IOException; 10 10 import java.io.InputStream; 11 import java.nio.charset.StandardCharsets; 11 12 import java.util.ArrayList; 12 13 import java.util.List; … … 53 54 public final List<MapCSSRule> multipolygonRules = new ArrayList<>(); 54 55 public final List<MapCSSRule> canvasRules = new ArrayList<>(); 55 56 56 57 private Color backgroundColorOverride; 57 58 private String css = null; … … 93 94 MapCSSParser preprocessor = new MapCSSParser(in, "UTF-8", MapCSSParser.LexicalState.PREPROCESSOR); 94 95 String mapcss = preprocessor.pp_root(this); 95 96 96 97 // do the actual mapcss parsing 97 InputStream in2 = new ByteArrayInputStream(mapcss.getBytes( Utils.UTF_8));98 InputStream in2 = new ByteArrayInputStream(mapcss.getBytes(StandardCharsets.UTF_8)); 98 99 MapCSSParser parser = new MapCSSParser(in2, "UTF-8", MapCSSParser.LexicalState.DEFAULT); 99 100 parser.sheet(this); 100 101 101 102 loadMeta(); 102 103 loadCanvas(); … … 155 156 public InputStream getSourceInputStream() throws IOException { 156 157 if (css != null) { 157 return new ByteArrayInputStream(css.getBytes( Utils.UTF_8));158 return new ByteArrayInputStream(css.getBytes(StandardCharsets.UTF_8)); 158 159 } 159 160 MirroredInputStream in = getMirroredInputStream(); … … 250 251 } 251 252 } 252 253 253 254 // the declaration indices are sorted, so it suffices to save the 254 255 // last used index 255 256 int lastDeclUsed = -1; 256 257 257 258 for (MapCSSRule r : matchingRules) { 258 259 env.clearSelectorMatchingInformation(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r7081 r7082 7 7 import java.io.InputStream; 8 8 import java.io.InputStreamReader; 9 import java.nio.charset.StandardCharsets; 9 10 import java.util.Collection; 10 11 import java.util.Collections; … … 77 78 try ( 78 79 InputStream in = getSourceInputStream(); 79 InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8)80 InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8) 80 81 ) { 81 82 XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this)); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r7037 r7082 15 15 import java.net.URL; 16 16 import java.net.URLEncoder; 17 import java.nio.charset.StandardCharsets; 17 18 import java.util.HashMap; 18 19 import java.util.Iterator; … … 200 201 try ( 201 202 InputStream is = connection.getInputStream(); 202 BufferedReader r = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))203 BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)) 203 204 ) { 204 205 String c; -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r7025 r7082 26 26 import java.net.MalformedURLException; 27 27 import java.net.URL; 28 import java.nio.charset.StandardCharsets; 28 29 import java.util.ArrayList; 29 30 import java.util.Arrays; … … 124 125 this.sourceType = sourceType; 125 126 this.canEnable = sourceType.equals(SourceType.MAP_PAINT_STYLE) || sourceType.equals(SourceType.TAGCHECKER_RULE); 126 127 127 128 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 128 129 this.availableSourcesModel = new AvailableSourcesListModel(selectionModel); … … 718 719 fileChooser.setMargin(new Insets(0, 0, 0, 0)); 719 720 p.add(fileChooser, GBC.eol().insets(0, 0, 5, 5)); 720 721 721 722 if (e != null) { 722 723 if (e.title != null) { … … 1212 1213 static class SourceEntryListCellRenderer extends JLabel implements ListCellRenderer<ExtendedSourceEntry> { 1213 1214 @Override 1214 public Component getListCellRendererComponent(JList<? extends ExtendedSourceEntry> list, ExtendedSourceEntry value, 1215 public Component getListCellRendererComponent(JList<? extends ExtendedSourceEntry> list, ExtendedSourceEntry value, 1215 1216 int index, boolean isSelected, boolean cellHasFocus) { 1216 1217 String s = value.toString(); … … 1280 1281 1281 1282 MirroredInputStream stream = new MirroredInputStream(url); 1282 reader = new BufferedReader(new InputStreamReader(stream, Utils.UTF_8));1283 reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)); 1283 1284 1284 1285 String line; … … 1605 1606 } 1606 1607 } 1607 1608 1608 1609 /** 1609 1610 * Defers loading of sources to the first time the adequate tab is selected. -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
r7037 r7082 11 11 import java.net.MalformedURLException; 12 12 import java.net.URL; 13 import java.nio.charset.StandardCharsets; 13 14 14 15 import javax.swing.JOptionPane; … … 194 195 } 195 196 StringBuilder changesets = new StringBuilder(); 196 try (BufferedReader bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8))) {197 try (BufferedReader bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { 197 198 String line; 198 199 while ((line = bin.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetReader.java
r7033 r7082 10 10 import java.io.InputStreamReader; 11 11 import java.io.Reader; 12 import java.nio.charset.StandardCharsets; 12 13 import java.util.ArrayList; 13 14 import java.util.Collection; … … 25 26 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 26 27 import org.openstreetmap.josm.io.MirroredInputStream; 27 import org.openstreetmap.josm.tools.Utils;28 28 import org.openstreetmap.josm.tools.XmlObjectParser; 29 29 import org.xml.sax.SAXException; … … 40 40 */ 41 41 public static final String PRESET_MIME_TYPES = "application/xml, text/xml, text/plain; q=0.8, application/zip, application/octet-stream; q=0.5"; 42 42 43 43 private TaggingPresetReader() { 44 44 // Hide default constructor for utils classes 45 45 } 46 46 47 47 private static File zipIcons = null; 48 48 49 49 /** 50 50 * Returns the set of preset source URLs. … … 70 70 public String ref; 71 71 } 72 72 73 73 public static List<TaggingPreset> readAll(Reader in, boolean validate) throws SAXException { 74 74 XmlObjectParser parser = new XmlObjectParser(); … … 222 222 return all; 223 223 } 224 224 225 225 public static Collection<TaggingPreset> readAll(String source, boolean validate) throws SAXException, IOException { 226 226 Collection<TaggingPreset> tp; … … 233 233 zipIcons = s.getFile(); 234 234 } 235 try (InputStreamReader r = new InputStreamReader(zip == null ? s : zip, Utils.UTF_8)) {235 try (InputStreamReader r = new InputStreamReader(zip == null ? s : zip, StandardCharsets.UTF_8)) { 236 236 tp = readAll(new BufferedReader(r), validate); 237 237 } … … 289 289 return allPresets; 290 290 } 291 291 292 292 /** 293 293 * Reads all tagging presets from sources stored in preferences. … … 299 299 return readAll(getPresetSources(), validate, displayErrMsg); 300 300 } 301 301 302 302 public static File getZipIcons() { 303 303 return zipIcons; -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r7033 r7082 8 8 import java.io.FileOutputStream; 9 9 import java.io.IOException; 10 import java.nio.charset.StandardCharsets; 10 11 11 12 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.tools.Utils;13 13 14 14 /** … … 119 119 public String updateForceString() throws T { 120 120 updateForce(); 121 return new String(data, Utils.UTF_8);121 return new String(data, StandardCharsets.UTF_8); 122 122 } 123 123 … … 138 138 */ 139 139 public String getDataString() throws T { 140 return new String(getData(), Utils.UTF_8);140 return new String(getData(), StandardCharsets.UTF_8); 141 141 } 142 142 -
trunk/src/org/openstreetmap/josm/io/CacheFiles.java
r7033 r7082 6 6 import java.io.RandomAccessFile; 7 7 import java.math.BigInteger; 8 import java.nio.charset.StandardCharsets; 8 9 import java.security.MessageDigest; 9 10 import java.util.Iterator; … … 14 15 15 16 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.tools.Utils;17 17 18 18 /** … … 321 321 try { 322 322 MessageDigest md = MessageDigest.getInstance("MD5"); 323 BigInteger number = new BigInteger(1, md.digest(ident.getBytes( Utils.UTF_8)));323 BigInteger number = new BigInteger(1, md.digest(ident.getBytes(StandardCharsets.UTF_8))); 324 324 return number.toString(16); 325 325 } catch(Exception e) { -
trunk/src/org/openstreetmap/josm/io/GeoJSONExporter.java
r7033 r7082 10 10 import java.io.OutputStreamWriter; 11 11 import java.io.Writer; 12 import java.nio.charset.StandardCharsets; 12 13 13 14 import org.openstreetmap.josm.actions.ExtensionFileFilter; 14 15 import org.openstreetmap.josm.gui.layer.Layer; 15 16 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 import org.openstreetmap.josm.tools.Utils;17 17 18 18 public class GeoJSONExporter extends FileExporter { … … 32 32 if (layer instanceof OsmDataLayer) { 33 33 String json = new GeoJSONWriter((OsmDataLayer) layer).write(); 34 try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Utils.UTF_8))) {34 try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) { 35 35 out.write(json); 36 36 } -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r7033 r7082 8 8 import java.io.OutputStreamWriter; 9 9 import java.io.PrintWriter; 10 import java.nio.charset.StandardCharsets; 10 11 import java.util.Collection; 11 12 import java.util.Map; … … 25 26 import org.openstreetmap.josm.data.gpx.IWithAttributes; 26 27 import org.openstreetmap.josm.data.gpx.WayPoint; 27 import org.openstreetmap.josm.tools.Utils;28 28 29 29 /** … … 37 37 38 38 public GpxWriter(OutputStream out) { 39 super(new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, Utils.UTF_8))));39 super(new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8)))); 40 40 } 41 41 -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r7049 r7082 5 5 import java.io.InputStream; 6 6 import java.io.InputStreamReader; 7 import java.nio.charset.StandardCharsets; 7 8 import java.text.ParsePosition; 8 9 import java.text.SimpleDateFormat; … … 18 19 import org.openstreetmap.josm.data.gpx.WayPoint; 19 20 import org.openstreetmap.josm.tools.DateUtils; 20 import org.openstreetmap.josm.tools.Utils;21 21 22 22 /** … … 170 170 Collection<Collection<WayPoint>> currentTrack = new ArrayList<>(); 171 171 172 try (BufferedReader rd = new BufferedReader(new InputStreamReader(source, Utils.UTF_8))) {172 try (BufferedReader rd = new BufferedReader(new InputStreamReader(source, StandardCharsets.UTF_8))) { 173 173 StringBuilder sb = new StringBuilder(1024); 174 174 int loopstart_char = rd.read(); … … 235 235 if(chkstrings.length > 1) 236 236 { 237 byte[] chb = chkstrings[0].getBytes( Utils.UTF_8);237 byte[] chb = chkstrings[0].getBytes(StandardCharsets.UTF_8); 238 238 int chk=0; 239 239 for (int i = 1; i < chb.length; i++) { -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r7081 r7082 20 20 import java.net.SocketTimeoutException; 21 21 import java.net.URL; 22 import java.nio.charset.StandardCharsets; 22 23 import java.util.Collection; 23 24 import java.util.Collections; … … 190 191 @Override 191 192 protected byte[] updateData() throws OsmTransferException { 192 return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes( Utils.UTF_8);193 return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes(StandardCharsets.UTF_8); 193 194 } 194 195 } … … 638 639 // even if there is no payload. 639 640 if (requestBody != null) { 640 try (BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, Utils.UTF_8))) {641 try (BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8))) { 641 642 bwr.write(requestBody); 642 643 bwr.flush(); … … 670 671 // 671 672 String s; 672 try (BufferedReader in = new BufferedReader(new InputStreamReader(i, Utils.UTF_8))) {673 try (BufferedReader in = new BufferedReader(new InputStreamReader(i, StandardCharsets.UTF_8))) { 673 674 while((s = in.readLine()) != null) { 674 675 responseBody.append(s); -
trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java
r7033 r7082 8 8 import java.io.InputStreamReader; 9 9 import java.io.StringReader; 10 import java.nio.charset.StandardCharsets; 10 11 11 12 import javax.xml.parsers.ParserConfigurationException; … … 18 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 20 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 import org.openstreetmap.josm.tools.Utils;21 21 import org.openstreetmap.josm.tools.XmlParsingException; 22 22 import org.xml.sax.Attributes; … … 39 39 private ChangesetDataSet.ChangesetModificationType currentModificationType; 40 40 41 @Override 41 42 protected void throwException(String message) throws XmlParsingException { 42 43 throw new XmlParsingException(message).rememberLocation(locator); … … 53 54 return; 54 55 } 55 switch (qName) { 56 switch (qName) { 56 57 case "osmChange": 57 58 // do nothing … … 67 68 break; 68 69 default: 69 Main.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 70 Main.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 70 71 qName, locator.getLineNumber(), locator.getColumnNumber())); 71 72 } … … 101 102 break; 102 103 default: 103 Main.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 104 Main.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 104 105 qName, locator.getLineNumber(), locator.getColumnNumber())); 105 106 } … … 126 127 public OsmChangesetContentParser(InputStream source) { 127 128 CheckParameterUtil.ensureParameterNotNull(source, "source"); 128 this.source = new InputSource(new InputStreamReader(source, Utils.UTF_8));129 this.source = new InputSource(new InputStreamReader(source, StandardCharsets.UTF_8)); 129 130 } 130 131 -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r7033 r7082 6 6 import java.io.InputStream; 7 7 import java.io.InputStreamReader; 8 import java.nio.charset.StandardCharsets; 8 9 import java.text.MessageFormat; 9 10 import java.util.LinkedList; … … 18 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 20 import org.openstreetmap.josm.tools.DateUtils; 20 import org.openstreetmap.josm.tools.Utils;21 21 import org.openstreetmap.josm.tools.XmlParsingException; 22 22 import org.xml.sax.Attributes; … … 225 225 progressMonitor.beginTask(""); 226 226 progressMonitor.indeterminateSubTask(tr("Parsing list of changesets...")); 227 InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, Utils.UTF_8)));227 InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, StandardCharsets.UTF_8))); 228 228 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser.new Parser()); 229 229 return parser.getChangesets(); -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r7012 r7082 10 10 import java.nio.charset.CharacterCodingException; 11 11 import java.nio.charset.CharsetEncoder; 12 import java.nio.charset.StandardCharsets; 12 13 13 14 import oauth.signpost.OAuthConsumer; … … 21 22 import org.openstreetmap.josm.io.auth.CredentialsManager; 22 23 import org.openstreetmap.josm.tools.Base64; 23 import org.openstreetmap.josm.tools.Utils;24 24 25 25 /** … … 76 76 */ 77 77 protected void addBasicAuthorizationHeader(HttpURLConnection con) throws OsmTransferException { 78 CharsetEncoder encoder = Utils.UTF_8.newEncoder();78 CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder(); 79 79 CredentialsAgentResponse response; 80 80 String token; -
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r7033 r7082 11 11 import java.io.PrintWriter; 12 12 import java.io.Writer; 13 import java.nio.charset.StandardCharsets; 13 14 import java.text.MessageFormat; 14 15 … … 72 73 try ( 73 74 OutputStream out = getOutputStream(file); 74 Writer writer = new OutputStreamWriter(out, Utils.UTF_8);75 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 75 76 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion()); 76 77 ) { -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r7012 r7082 7 7 import java.io.InputStream; 8 8 import java.io.InputStreamReader; 9 import java.nio.charset.StandardCharsets; 9 10 10 11 import javax.xml.parsers.ParserConfigurationException; … … 17 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 import org.openstreetmap.josm.tools.Utils;20 20 import org.xml.sax.Attributes; 21 21 import org.xml.sax.InputSource; … … 83 83 */ 84 84 public HistoryDataSet parse(ProgressMonitor progressMonitor) throws SAXException, IOException { 85 InputSource inputSource = new InputSource(new InputStreamReader(in, Utils.UTF_8));85 InputSource inputSource = new InputSource(new InputStreamReader(in, StandardCharsets.UTF_8)); 86 86 progressMonitor.beginTask(tr("Parsing OSM history data ...")); 87 87 try { -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r7033 r7082 11 11 import java.net.MalformedURLException; 12 12 import java.net.URL; 13 import java.nio.charset.StandardCharsets; 13 14 import java.util.List; 14 15 import java.util.Map; … … 175 176 InputStream i = fixEncoding(activeConnection.getErrorStream(), encoding); 176 177 if (i != null) { 177 BufferedReader in = new BufferedReader(new InputStreamReader(i, Utils.UTF_8));178 BufferedReader in = new BufferedReader(new InputStreamReader(i, StandardCharsets.UTF_8)); 178 179 String s; 179 180 while((s = in.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
r7033 r7082 13 13 import java.net.URL; 14 14 import java.net.URLConnection; 15 import java.nio.charset.StandardCharsets; 15 16 import java.text.DecimalFormat; 16 17 import java.text.DecimalFormatSymbols; … … 187 188 StringBuilder exception = new StringBuilder(); 188 189 InputStream in = conn.getInputStream(); 189 try (BufferedReader br = new BufferedReader(new InputStreamReader(in, Utils.UTF_8))) {190 try (BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) { 190 191 String line = null; 191 192 while( (line = br.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r7030 r7082 12 12 import java.io.Writer; 13 13 import java.net.Socket; 14 import java.nio.charset.StandardCharsets; 14 15 import java.util.Arrays; 15 16 import java.util.Date; … … 143 144 try { 144 145 OutputStream raw = new BufferedOutputStream(request.getOutputStream()); 145 out = new OutputStreamWriter(raw, Utils.UTF_8);146 out = new OutputStreamWriter(raw, StandardCharsets.UTF_8); 146 147 BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "ASCII")); 147 148 … … 394 395 return null; 395 396 } 396 397 397 398 printJsonInfo(cmd, r, handler); 398 399 return w.toString(); -
trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java
r7071 r7082 21 21 import java.net.URI; 22 22 import java.net.URL; 23 import java.nio.charset.StandardCharsets; 23 24 import java.util.Collection; 24 25 import java.util.Collections; … … 38 39 import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport; 39 40 import org.openstreetmap.josm.tools.GBC; 40 import org.openstreetmap.josm.tools.Utils;41 41 import org.w3c.dom.Element; 42 42 … … 181 181 @SuppressWarnings("resource") 182 182 protected void addDataFile(OutputStream out) { 183 Writer writer = new OutputStreamWriter(out, Utils.UTF_8);183 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 184 184 GpxWriter w = new GpxWriter(new PrintWriter(writer)); 185 185 w.write(layer.data); -
trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java
r7071 r7082 9 9 import java.io.PrintWriter; 10 10 import java.io.Writer; 11 import java.nio.charset.StandardCharsets; 11 12 import java.util.Collection; 12 13 import java.util.Collections; … … 25 26 import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport; 26 27 import org.openstreetmap.josm.tools.GBC; 27 import org.openstreetmap.josm.tools.Utils;28 28 import org.w3c.dom.Element; 29 29 … … 86 86 @SuppressWarnings("resource") 87 87 protected void addDataFile(OutputStream out) { 88 Writer writer = new OutputStreamWriter(out, Utils.UTF_8);88 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 89 89 MarkerWriter w = new MarkerWriter(new PrintWriter(writer)); 90 90 w.write(layer); -
trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java
r7071 r7082 21 21 import java.net.URI; 22 22 import java.net.URL; 23 import java.nio.charset.StandardCharsets; 23 24 import java.util.Collection; 24 25 import java.util.Collections; … … 43 44 import org.openstreetmap.josm.tools.GBC; 44 45 import org.openstreetmap.josm.tools.ImageProvider; 45 import org.openstreetmap.josm.tools.Utils;46 46 import org.w3c.dom.Element; 47 47 … … 210 210 211 211 protected void addDataFile(OutputStream out) { 212 Writer writer = new OutputStreamWriter(out, Utils.UTF_8);212 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 213 213 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion()); 214 214 layer.data.getReadLock().lock(); -
trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
r7070 r7082 10 10 import java.io.OutputStreamWriter; 11 11 import java.lang.reflect.Constructor; 12 import java.nio.charset.StandardCharsets; 12 13 import java.util.ArrayList; 13 14 import java.util.HashMap; … … 223 224 public void writeJos(Document doc, OutputStream out) throws IOException { 224 225 try { 225 OutputStreamWriter writer = new OutputStreamWriter(out, Utils.UTF_8);226 OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 226 227 writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); 227 228 TransformerFactory transfac = TransformerFactory.newInstance(); -
trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java
r7005 r7082 9 9 import java.io.InputStream; 10 10 import java.io.InputStreamReader; 11 import java.nio.charset.StandardCharsets; 11 12 import java.util.LinkedList; 12 13 import java.util.List; 13 14 14 15 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.tools.Utils;16 16 17 17 /** … … 37 37 try { 38 38 return new PluginInformation( 39 new ByteArrayInputStream(manifest.getBytes( Utils.UTF_8)),39 new ByteArrayInputStream(manifest.getBytes(StandardCharsets.UTF_8)), 40 40 name.substring(0, name.length() - 4), 41 41 url … … 61 61 BufferedReader r = null; 62 62 try { 63 r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));63 r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); 64 64 String name = null; 65 65 String url = null; -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r7037 r7082 20 20 import java.net.MalformedURLException; 21 21 import java.net.URL; 22 import java.nio.charset.StandardCharsets; 22 23 import java.util.ArrayList; 23 24 import java.util.Arrays; … … 172 173 connection.setRequestProperty("Accept-Charset", "utf-8"); 173 174 } 174 try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8))) {175 try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { 175 176 StringBuilder sb = new StringBuilder(); 176 177 String line; … … 204 205 try (InputStream errStream = connection.getErrorStream()) { 205 206 if (errStream != null) { 206 try (BufferedReader err = new BufferedReader(new InputStreamReader(errStream, Utils.UTF_8))) {207 try (BufferedReader err = new BufferedReader(new InputStreamReader(errStream, StandardCharsets.UTF_8))) { 207 208 String line; 208 209 while ((line = err.readLine()) != null) { … … 323 324 File cacheFile = createSiteCacheFile(pluginDir, site, CacheType.PLUGIN_LIST); 324 325 getProgressMonitor().subTask(tr("Writing plugin list to local cache ''{0}''", cacheFile.toString())); 325 try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), Utils.UTF_8))) {326 try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), StandardCharsets.UTF_8))) { 326 327 writer.write(list); 327 328 writer.flush(); … … 363 364 try { 364 365 getProgressMonitor().subTask(tr("Parsing plugin list from site ''{0}''", site)); 365 InputStream in = new ByteArrayInputStream(doc.getBytes( Utils.UTF_8));366 InputStream in = new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8)); 366 367 List<PluginInformation> pis = new PluginListParser().parse(in); 367 368 availablePlugins.addAll(filterDeprecatedPlugins(pis)); -
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r7060 r7082 12 12 import java.net.URL; 13 13 import java.nio.ByteBuffer; 14 import java.nio.charset.StandardCharsets; 14 15 import java.util.zip.GZIPOutputStream; 15 16 … … 42 43 private static int exceptionCounter = 0; 43 44 private static boolean suppressExceptionDialogs = false; 44 45 45 46 private static class BugReporterThread extends Thread { 46 47 47 48 final Throwable e; 48 49 49 50 public BugReporterThread(Throwable t) { 50 51 super("Bug Reporter"); … … 139 140 } 140 141 } 141 142 142 143 private static void askForBugReport(final Throwable e) { 143 144 try { … … 215 216 GZIPOutputStream gzip = new GZIPOutputStream(out) 216 217 ) { 217 gzip.write(debugText.getBytes( Utils.UTF_8));218 gzip.write(debugText.getBytes(StandardCharsets.UTF_8)); 218 219 gzip.finish(); 219 220 -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r7033 r7082 8 8 import java.io.InputStream; 9 9 import java.net.URL; 10 import java.nio.charset.StandardCharsets; 10 11 import java.text.MessageFormat; 11 12 import java.util.ArrayList; … … 532 533 if(rval != val) /* file corrupt */ 533 534 return false; 534 enstrings[i] = new String(str, 0, val, Utils.UTF_8);535 enstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8); 535 536 } 536 537 for(int i = 0; i < trnum; ++i) … … 546 547 if(rval != val) /* file corrupt */ 547 548 return false; 548 trstrings[i] = new String(str, 0, val, Utils.UTF_8);549 trstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8); 549 550 } 550 551 if(trnum > 0 && !p.containsKey(enstrings[0])) { … … 572 573 if(trval != 0xFFFF) /* files do not match */ 573 574 return false; 574 } 575 else 576 { 577 if(enval > str.length) { 575 } else { 576 if (enval > str.length) { 578 577 str = new byte[enval]; 579 578 } 580 if (trval > str.length) {579 if (trval > str.length) { 581 580 str = new byte[trval]; 582 581 } … … 584 583 if(val != enval) /* file corrupt */ 585 584 return false; 586 String enstr = new String(str, 0, enval, Utils.UTF_8); 587 if(trval != 0) 588 { 585 String enstr = new String(str, 0, enval, StandardCharsets.UTF_8); 586 if (trval != 0) { 589 587 val = trs.read(str, 0, trval); 590 588 if(val != trval) /* file corrupt */ 591 589 return false; 592 String trstr = new String(str, 0, trval, Utils.UTF_8);590 String trstr = new String(str, 0, trval, StandardCharsets.UTF_8); 593 591 if(!s.containsKey(enstr)) 594 592 s.put(enstr, trstr); … … 598 596 } 599 597 } 600 catch(IOException e) 601 { 598 catch (IOException e) { 602 599 return false; 603 600 } 604 if(!s.isEmpty()) 605 { 601 if (!s.isEmpty()) { 606 602 strings = s; 607 603 pstrings = p; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7075 r7082 24 24 import java.net.URLDecoder; 25 25 import java.net.URLEncoder; 26 import java.nio.charset.StandardCharsets; 26 27 import java.util.ArrayList; 27 28 import java.util.Arrays; … … 537 538 } else { 538 539 try { 539 bytes = URLDecoder.decode(data, "UTF-8").getBytes( Utils.UTF_8);540 bytes = URLDecoder.decode(data, "UTF-8").getBytes(StandardCharsets.UTF_8); 540 541 } catch (IllegalArgumentException ex) { 541 542 Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")"); … … 544 545 } 545 546 if (mediatype != null && mediatype.contains("image/svg+xml")) { 546 String s = new String(bytes, Utils.UTF_8);547 String s = new String(bytes, StandardCharsets.UTF_8); 547 548 URI uri = getSvgUniverse().loadSVG(new StringReader(s), URLEncoder.encode(s, "UTF-8")); 548 549 SVGDiagram svg = getSvgUniverse().getDiagram(uri); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r7075 r7082 15 15 import java.net.URI; 16 16 import java.net.URISyntaxException; 17 import java.nio.charset.StandardCharsets; 17 18 import java.util.Arrays; 18 19 … … 201 202 // Try lsb_release (only available on LSB-compliant Linux systems, see https://www.linuxbase.org/lsb-cert/productdir.php?by_prod ) 202 203 Process p = Runtime.getRuntime().exec("lsb_release -ds"); 203 try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), Utils.UTF_8))) {204 try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) { 204 205 String line = Utils.strip(input.readLine()); 205 206 if (line != null && !line.isEmpty()) { … … 284 285 File file = new File(path); 285 286 if (file.exists()) { 286 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8))) {287 try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { 287 288 String id = null; 288 289 String release = null; -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7037 r7082 27 27 import java.net.URLConnection; 28 28 import java.net.URLEncoder; 29 import java.nio.charset. Charset;29 import java.nio.charset.StandardCharsets; 30 30 import java.nio.file.Files; 31 31 import java.nio.file.Path; … … 63 63 } 64 64 65 /**66 * UTF-8 (UCS Transformation Format—8-bit).67 *68 * <p>Every implementation of the Java platform is required to support UTF-8 (see {@link Charset}).</p>69 */70 public static final Charset UTF_8 = Charset.forName("UTF-8");71 72 65 private static final int MILLIS_OF_SECOND = 1000; 73 66 private static final int MILLIS_OF_MINUTE = 60000; … … 476 469 */ 477 470 public static String md5Hex(String data) { 478 byte[] byteData = data.getBytes( UTF_8);471 byte[] byteData = data.getBytes(StandardCharsets.UTF_8); 479 472 MessageDigest md = null; 480 473 try { … … 726 719 */ 727 720 public static BufferedReader openURLReaderAndDecompress(final URL url, final boolean decompress) throws IOException { 728 return new BufferedReader(new InputStreamReader(openURLAndDecompress(url, decompress), UTF_8));721 return new BufferedReader(new InputStreamReader(openURLAndDecompress(url, decompress), StandardCharsets.UTF_8)); 729 722 } 730 723 … … 801 794 } 802 795 Process p = new ProcessBuilder(command).start(); 803 try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), UTF_8))) {796 try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) { 804 797 StringBuilder all = null; 805 798 String line;
Note:
See TracChangeset
for help on using the changeset viewer.