Changeset 6995 in josm
- Timestamp:
- 2014-04-23T02:30:39+02:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r6920 r6995 10 10 import java.io.BufferedReader; 11 11 import java.io.File; 12 import java.io.File Reader;12 import java.io.FileInputStream; 13 13 import java.io.IOException; 14 import java.io.InputStreamReader; 14 15 import java.util.ArrayList; 15 16 import java.util.Arrays; … … 292 293 for (File urlFile: urlFiles) { 293 294 try { 294 BufferedReader reader = new BufferedReader(new FileReader(urlFile));295 BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8)); 295 296 String line; 296 297 while ((line = reader.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r6643 r6995 159 159 try { 160 160 File pidFile = new File(autosaveDir, filename+".pid"); 161 PrintStream ps = new PrintStream(pidFile );161 PrintStream ps = new PrintStream(pidFile, "UTF-8"); 162 162 ps.println(ManagementFactory.getRuntimeMXBean().getName()); 163 163 Utils.close(ps); … … 310 310 if (pidFile.exists()) { 311 311 try { 312 BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile) ));312 BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), Utils.UTF_8)); 313 313 try { 314 314 String jvmId = reader.readLine(); … … 403 403 } 404 404 405 public void di cardUnsavedLayers() {405 public void discardUnsavedLayers() { 406 406 for (File f: getUnsavedLayersFiles()) { 407 407 moveToDeletedLayersFolder(f); -
trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
r6643 r6995 32 32 public class ServerSidePreferences extends Preferences { 33 33 public static class MissingPassword extends Exception{ 34 public String realm;34 public final String realm; 35 35 public MissingPassword(String r) { 36 36 realm = r; … … 62 62 throw new MissingPassword(t); 63 63 } 64 BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream() ));64 BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream(), Utils.UTF_8)); 65 65 StringBuilder b = new StringBuilder(); 66 66 try { … … 94 94 con.setDoOutput(true); 95 95 con.connect(); 96 PrintWriter out = new PrintWriter(new OutputStreamWriter(con.getOutputStream() ));96 PrintWriter out = new PrintWriter(new OutputStreamWriter(con.getOutputStream(), Utils.UTF_8)); 97 97 out.println(s); 98 98 Utils.close(out); … … 117 117 } 118 118 119 /** 120 * Constructs a new {@code ServerSidePreferences}. 121 * @param serverUrl The server URL hosting the user preferences. 122 */ 119 123 public ServerSidePreferences(URL serverUrl) { 120 124 Connection connection = null; -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r6883 r6995 135 135 try { 136 136 InputStream in = new MirroredInputStream("resource://data/projection/epsg"); 137 r = new BufferedReader(new InputStreamReader(in ));137 r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8)); 138 138 String line, lastline = ""; 139 139 while ((line = r.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r6990 r6995 104 104 topLevelSubGrid = null; 105 105 in.read(b8); 106 String overviewHeaderCountId = new String(b8 );106 String overviewHeaderCountId = new String(b8, Utils.UTF_8); 107 107 if (!"NUM_OREC".equals(overviewHeaderCountId)) 108 108 throw new IllegalArgumentException("Input file is not an NTv2 grid shift file"); -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r6822 r6995 75 75 in.read(b8); 76 76 in.read(b8); 77 subGridName = new String(b8 ).trim();78 in.read(b8); 79 in.read(b8); 80 parentSubGridName = new String(b8 ).trim();81 in.read(b8); 82 in.read(b8); 83 created = new String(b8 );84 in.read(b8); 85 in.read(b8); 86 updated = new String(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); 87 87 in.read(b8); 88 88 in.read(b8); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6890 r6995 6 6 import java.io.BufferedReader; 7 7 import java.io.File; 8 import java.io.FileInputStream; 8 9 import java.io.FileNotFoundException; 9 import java.io.FileReader; 10 import java.io.FileWriter; 10 import java.io.FileOutputStream; 11 11 import java.io.IOException; 12 import java.io.InputStreamReader; 13 import java.io.OutputStreamWriter; 12 14 import java.io.PrintWriter; 13 15 import java.util.ArrayList; … … 171 173 BufferedReader in = null; 172 174 try { 173 in = new BufferedReader(new FileReader(file));175 in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8)); 174 176 for (String line = in.readLine(); line != null; line = in.readLine()) { 175 177 ignoredErrors.add(line); … … 197 199 PrintWriter out = null; 198 200 try { 199 out = new PrintWriter(new FileWriter(getValidatorDir() + "ignorederrors"), false);201 out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(getValidatorDir() + "ignorederrors"), Utils.UTF_8), false); 200 202 for (String e : ignoredErrors) { 201 203 out.println(e); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r6920 r6995 492 492 autosaveTask.recoverUnsavedLayers(); 493 493 } else if (selection == 3) { 494 autosaveTask.di cardUnsavedLayers();494 autosaveTask.discardUnsavedLayers(); 495 495 } 496 496 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r6992 r6995 22 22 import java.util.TreeMap; 23 23 import java.util.concurrent.CopyOnWriteArrayList; 24 import java.util.zip.CRC32; 24 25 25 26 import javax.swing.JComponent; … … 1326 1327 String x = center.east() + "_" + center.north() + "_" + scale + "_" + 1327 1328 getWidth() + "_" + getHeight() + "_" + getProjection().toString(); 1328 java.util.zip.CRC32 id = new java.util.zip.CRC32();1329 id.update(x.getBytes( ));1329 CRC32 id = new CRC32(); 1330 id.update(x.getBytes(Utils.UTF_8)); 1330 1331 return (int)id.getValue(); 1331 1332 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r6969 r6995 659 659 InputStream is = s.getSourceInputStream(); 660 660 try { 661 BufferedReader reader = new BufferedReader(new InputStreamReader(is ));661 BufferedReader reader = new BufferedReader(new InputStreamReader(is, Utils.UTF_8)); 662 662 try { 663 663 String line; -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r6890 r6995 137 137 BufferedReader reader = new BufferedReader( 138 138 new InputStreamReader( 139 getClass().getResourceAsStream("/data/help-browser.css") 139 getClass().getResourceAsStream("/data/help-browser.css"), 140 Utils.UTF_8 140 141 ) 141 142 ); -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r6990 r6995 235 235 return new XmlStyleSource(entry); 236 236 else { 237 InputStreamReader reader = new InputStreamReader(in );237 InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8); 238 238 try { 239 239 WHILE: while (true) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r6897 r6995 77 77 InputStream in = getSourceInputStream(); 78 78 try { 79 InputStreamReader reader = new InputStreamReader(in );79 InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8); 80 80 XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this)); 81 81 parser.startWithValidation(reader, -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r6990 r6995 214 214 BufferedReader r = null; 215 215 try { 216 r = new BufferedReader(new InputStreamReader(connection.getInputStream() ));216 r = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8)); 217 217 String c; 218 218 Pattern p = Pattern.compile(".*authenticity_token.*value=\"([^\"]+)\".*"); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
r6920 r6995 195 195 } 196 196 StringBuilder changesets = new StringBuilder(); 197 bin = new BufferedReader(new InputStreamReader(connection.getInputStream() ));197 bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8)); 198 198 String line; 199 199 while ((line = bin.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/io/CacheFiles.java
r6889 r6995 322 322 try { 323 323 MessageDigest md = MessageDigest.getInstance("MD5"); 324 BigInteger number = new BigInteger(1, md.digest(ident.getBytes( )));324 BigInteger number = new BigInteger(1, md.digest(ident.getBytes(Utils.UTF_8))); 325 325 return number.toString(16); 326 326 } catch(Exception e) { -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r6889 r6995 176 176 BufferedReader rd = null; 177 177 try { 178 rd = new BufferedReader(new InputStreamReader(source ));178 rd = new BufferedReader(new InputStreamReader(source, Utils.UTF_8)); 179 179 180 180 StringBuilder sb = new StringBuilder(1024); … … 243 243 if(chkstrings.length > 1) 244 244 { 245 byte[] chb = chkstrings[0].getBytes( );245 byte[] chb = chkstrings[0].getBytes(Utils.UTF_8); 246 246 int chk=0; 247 247 for (int i = 1; i < chb.length; i++) { -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r6966 r6995 191 191 @Override 192 192 protected byte[] updateData() throws OsmTransferException { 193 return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes( );193 return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes(Utils.UTF_8); 194 194 } 195 195 } -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r6882 r6995 174 174 InputStream i = fixEncoding(activeConnection.getErrorStream(), encoding); 175 175 if (i != null) { 176 BufferedReader in = new BufferedReader(new InputStreamReader(i ));176 BufferedReader in = new BufferedReader(new InputStreamReader(i, Utils.UTF_8)); 177 177 String s; 178 178 while((s = in.readLine()) != null) { -
trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
r6920 r6995 190 190 StringBuilder exception = new StringBuilder(); 191 191 InputStream in = conn.getInputStream(); 192 BufferedReader br = new BufferedReader(new InputStreamReader(in ));192 BufferedReader br = new BufferedReader(new InputStreamReader(in, Utils.UTF_8)); 193 193 try { 194 194 String line = null; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r6990 r6995 143 143 try { 144 144 OutputStream raw = new BufferedOutputStream(request.getOutputStream()); 145 out = new OutputStreamWriter(raw );145 out = new OutputStreamWriter(raw, Utils.UTF_8); 146 146 BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "ASCII")); 147 147 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r6987 r6995 543 543 } else { 544 544 try { 545 bytes = URLDecoder.decode(data, " utf-8").getBytes();545 bytes = URLDecoder.decode(data, "UTF-8").getBytes(Utils.UTF_8); 546 546 } catch (IllegalArgumentException ex) { 547 547 Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")"); … … 550 550 } 551 551 if (mediatype != null && mediatype.contains("image/svg+xml")) { 552 String s = new String(bytes );552 String s = new String(bytes, Utils.UTF_8); 553 553 URI uri = getSvgUniverse().loadSVG(new StringReader(s), URLEncoder.encode(s, "UTF-8")); 554 554 SVGDiagram svg = getSvgUniverse().getDiagram(uri); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r6977 r6995 10 10 import java.io.BufferedReader; 11 11 import java.io.File; 12 import java.io.File Reader;12 import java.io.FileInputStream; 13 13 import java.io.IOException; 14 14 import java.io.InputStreamReader; … … 227 227 // Try lsb_release (only available on LSB-compliant Linux systems, see https://www.linuxbase.org/lsb-cert/productdir.php?by_prod ) 228 228 Process p = Runtime.getRuntime().exec("lsb_release -ds"); 229 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream() ));229 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), Utils.UTF_8)); 230 230 String line = Utils.strip(input.readLine()); 231 231 Utils.close(input); … … 312 312 BufferedReader reader = null; 313 313 try { 314 reader = new BufferedReader(new FileReader(file));314 reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8)); 315 315 String id = null; 316 316 String release = null; -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6977 r6995 812 812 } 813 813 Process p = new ProcessBuilder(command).start(); 814 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream() ));814 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), UTF_8)); 815 815 StringBuilder all = null; 816 816 String line; -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r6920 r6995 10 10 import java.io.File; 11 11 import java.io.FileInputStream; 12 import java.io.File Writer;12 import java.io.FileOutputStream; 13 13 import java.io.IOException; 14 14 import java.io.InputStream; 15 import java.io.OutputStreamWriter; 15 16 import java.io.PrintWriter; 16 17 import java.text.MessageFormat; … … 36 37 import org.openstreetmap.josm.gui.io.UploadStrategySpecification; 37 38 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 39 import org.openstreetmap.josm.tools.Utils; 38 40 39 41 public class MultiFetchServerObjectReaderTest { … … 211 213 try { 212 214 PrintWriter pw = new PrintWriter( 213 new FileWriter(dataSetCacheOutputFile)215 new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8) 214 216 ); 215 217 logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r6920 r6995 8 8 import java.io.File; 9 9 import java.io.FileInputStream; 10 import java.io.File Writer;10 import java.io.FileOutputStream; 11 11 import java.io.IOException; 12 12 import java.io.InputStream; 13 import java.io.OutputStreamWriter; 13 14 import java.io.PrintWriter; 14 15 import java.text.MessageFormat; … … 37 38 import org.openstreetmap.josm.gui.io.UploadStrategySpecification; 38 39 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 40 import org.openstreetmap.josm.tools.Utils; 39 41 40 42 public class OsmServerBackreferenceReaderTest { … … 218 220 try { 219 221 PrintWriter pw = new PrintWriter( 220 new FileWriter(dataSetCacheOutputFile)222 new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8) 221 223 ); 222 224 logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r6334 r6995 3 3 4 4 import java.io.BufferedReader; 5 import java.io.FileInputStream; 5 6 import java.io.FileNotFoundException; 6 import java.io.FileReader;7 7 import java.io.IOException; 8 import java.io.InputStreamReader; 8 9 import java.util.Collection; 9 10 import java.util.HashMap; … … 48 49 @Test 49 50 public void test() throws IOException, FileNotFoundException { 50 BufferedReader in = new BufferedReader(new FileReader("data_nodist/projection-reference-data.csv"));51 BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("data_nodist/projection-reference-data.csv"), Utils.UTF_8)); 51 52 StringBuilder fail = new StringBuilder(); 52 53 String line; … … 92 93 throw new AssertionError(fail.toString()); 93 94 } 94 95 95 } 96 96 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r6881 r6995 5 5 import java.io.BufferedWriter; 6 6 import java.io.File; 7 import java.io.FileInputStream; 7 8 import java.io.FileNotFoundException; 8 import java.io.FileReader; 9 import java.io.FileWriter; 9 import java.io.FileOutputStream; 10 10 import java.io.IOException; 11 import java.io.InputStreamReader; 12 import java.io.OutputStreamWriter; 11 13 import java.util.ArrayList; 12 14 import java.util.Collection; … … 29 31 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 30 32 import org.openstreetmap.josm.tools.Pair; 33 import org.openstreetmap.josm.tools.Utils; 31 34 32 35 /** … … 87 90 88 91 Random rand = new Random(); 89 BufferedWriter out = new BufferedWriter(new FileWriter(PROJECTION_DATA_FILE));92 BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(PROJECTION_DATA_FILE), Utils.UTF_8)); 90 93 out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n"); 91 94 out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n"); … … 112 115 113 116 private static List<TestData> readData() throws IOException, FileNotFoundException { 114 BufferedReader in = new BufferedReader(new FileReader(PROJECTION_DATA_FILE));117 BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), Utils.UTF_8)); 115 118 List<TestData> result = new ArrayList<TestData>(); 116 119 String line;
Note:
See TracChangeset
for help on using the changeset viewer.