Changeset 7082 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-05-09T05:32:37+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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.