- Timestamp:
- 2015-10-10T14:08:30+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r8846 r8848 296 296 @Override 297 297 public String toString() { 298 String s = "ImageryPreferenceEntry [name=" + name;298 StringBuilder s = new StringBuilder("ImageryPreferenceEntry [name=").append(name); 299 299 if (id != null) { 300 s += " id=" + id;301 } 302 s += ']';303 return s ;300 s.append(" id=").append(id); 301 } 302 s.append(']'); 303 return s.toString(); 304 304 } 305 305 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8846 r8848 131 131 protected EditableList sourcesList; 132 132 133 protected static final Entities entities = new Entities();134 135 133 private static final List<String> DEFAULT_SOURCES = Arrays.asList(/*DATA_FILE, */IGNORE_FILE, SPELL_FILE); 136 134 … … 371 369 withErrors.put(p, "SPACE"); 372 370 } 373 if (checkValues && value != null && !value.equals( entities.unescape(value)) && !withErrors.contains(p, "HTML")) {371 if (checkValues && value != null && !value.equals(Entities.unescape(value)) && !withErrors.contains(p, "HTML")) { 374 372 errors.add(new TestError(this, Severity.OTHER, tr("Property values contain HTML entity"), 375 373 tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p)); … … 620 618 commands.add(new ChangePropertyKeyCommand(p, key, Tag.removeWhiteSpaces(key))); 621 619 } else { 622 String evalue = entities.unescape(value);620 String evalue = Entities.unescape(value); 623 621 if (!evalue.equals(value)) { 624 622 commands.add(new ChangePropertyCommand(p, key, evalue)); -
trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
r8840 r8848 31 31 * @see <a href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code positions</a> 32 32 */ 33 public class Entities {33 public final class Entities { 34 34 private static final String[][] ARRAY = { 35 35 /* BASIC */ … … 336 336 private static volatile Map<String, String> mapNameToValue; 337 337 338 public String unescape(String str) { 338 private Entities() { 339 // Private constructor for utilities classes 340 } 341 342 public static String unescape(String str) { 339 343 int firstAmp = str.indexOf('&'); 340 344 if (firstAmp < 0) 341 345 return str; 342 String res = str.substring(0, firstAmp);346 StringBuilder res = new StringBuilder(str.substring(0, firstAmp)); 343 347 int len = str.length(); 344 348 for (int i = firstAmp; i < len; i++) { … … 348 352 int semiColonIdx = str.indexOf(';', nextIdx); 349 353 if (semiColonIdx == -1) { 350 res += c;354 res.append(c); 351 355 continue; 352 356 } … … 354 358 if (amphersandIdx != -1 && amphersandIdx < semiColonIdx) { 355 359 // Then the text looks like &...&...; 356 res += c;360 res.append(c); 357 361 continue; 358 362 } … … 394 398 395 399 if (entityValue == -1) { 396 res += '&' + entityContent + ';';400 res.append('&').append(entityContent).append(';'); 397 401 } else { 398 res += (char) entityValue;402 res.append((char) entityValue); 399 403 } 400 404 i = semiColonIdx; // move index up to the semi-colon 401 405 } else { 402 res += c;406 res.append(c); 403 407 } 404 408 } 405 return res ;409 return res.toString(); 406 410 } 407 411 } -
trunk/src/org/openstreetmap/josm/gui/FileDrop.java
r8540 r8848 155 155 156 156 // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. 157 private static final String ZERO_CHAR_STRING = "" + (char) 0;157 private static final String ZERO_CHAR_STRING = Character.toString((char) 0); 158 158 159 159 private static File[] createFileArray(BufferedReader bReader) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r8846 r8848 96 96 }); 97 97 } 98 String names = null;98 StringBuilder names = new StringBuilder(); 99 99 for (File file : sel) { 100 if (names == null) {101 names = " (";100 if (names.length() == 0) { 101 names.append(" ("); 102 102 } else { 103 names += ", "; 104 } 105 names += file.getName(); 106 } 107 if (names != null) { 108 names += ')'; 109 } else { 110 names = ""; 103 names.append(", "); 104 } 105 names.append(file.getName()); 106 } 107 if (names.length() > 0) { 108 names.append(')'); 111 109 } 112 110 MarkerLayer ml = new MarkerLayer(new GpxData(), -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r8846 r8848 71 71 long minutes_left = ms_left / MSECS_PER_MINUTE; 72 72 long seconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE; 73 String time_left_str = Long.toString(minutes_left) + ':';73 StringBuilder time_left_str = new StringBuilder().append(minutes_left).append(':'); 74 74 if (seconds_left < 10) { 75 time_left_str += '0';76 } 77 return time_left_str + Long.toString(seconds_left);75 time_left_str.append('0'); 76 } 77 return time_left_str.append(seconds_left).toString(); 78 78 } 79 79 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r8846 r8848 289 289 canHtml = false; 290 290 } 291 String result = "";291 StringBuilder result = new StringBuilder(); 292 292 if (canHtml) { 293 result += "<html>";294 } 295 result += name;293 result.append("<html>"); 294 } 295 result.append(name); 296 296 if (sc != null && !sc.getKeyText().isEmpty()) { 297 result += ' ';297 result.append(' '); 298 298 if (canHtml) { 299 result += "<font size='-2'>";300 } 301 result += '('+sc.getKeyText()+')';299 result.append("<font size='-2'>"); 300 } 301 result.append('(').append(sc.getKeyText()).append(')'); 302 302 if (canHtml) { 303 result += "</font>";303 result.append("</font>"); 304 304 } 305 305 } 306 306 if (canHtml) { 307 result += " </html>";308 } 309 return result ;307 result.append(" </html>"); 308 } 309 return result.toString(); 310 310 } 311 311 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r8846 r8848 149 149 @Override 150 150 public String makeTooltip(String name, Shortcut sc) { 151 String result = ""; 152 result += "<html>"; 153 result += name; 151 StringBuilder result = new StringBuilder(); 152 result.append("<html>").append(name); 154 153 if (sc != null && !sc.getKeyText().isEmpty()) { 155 result += ' ';156 result += "<font size='-2'>";157 result += '('+sc.getKeyText()+')';158 result += "</font>";159 } 160 return result + " </html>";154 result.append(' ') 155 .append("<font size='-2'>") 156 .append('(').append(sc.getKeyText()).append(')') 157 .append("</font>"); 158 } 159 return result.append(" </html>").toString(); 161 160 } 162 161
Note:
See TracChangeset
for help on using the changeset viewer.