Ticket #8902: perf.patch
File perf.patch, 242.7 KB (added by , 11 years ago) |
---|
-
org/openstreetmap/josm/actions/CombineWayAction.java
296 296 @Override 297 297 public String toString() { 298 298 return new StringBuilder() 299 .append( "[")299 .append('[') 300 300 .append(a.getId()) 301 .append( ",")301 .append(',') 302 302 .append(b.getId()) 303 .append( "]")303 .append(']') 304 304 .toString(); 305 305 } 306 306 -
org/openstreetmap/josm/actions/CopyAction.java
50 50 /* copy ids to the clipboard */ 51 51 StringBuilder idsBuilder = new StringBuilder(); 52 52 for (OsmPrimitive p : primitives) { 53 idsBuilder.append(p.getId()).append( ",");53 idsBuilder.append(p.getId()).append(','); 54 54 } 55 55 String ids = idsBuilder.substring(0, idsBuilder.length() - 1); 56 56 Utils.copyToClipboard(ids); -
org/openstreetmap/josm/actions/CopyCoordinatesAction.java
31 31 s.append(n.getCoor().lat()); 32 32 s.append(", "); 33 33 s.append(n.getCoor().lon()); 34 s.append( "\n");34 s.append('\n'); 35 35 } 36 36 Utils.copyToClipboard(s.toString().trim()); 37 37 } -
org/openstreetmap/josm/actions/ExtensionFileFilter.java
249 249 public boolean acceptName(String filename) { 250 250 String name = filename.toLowerCase(); 251 251 for (String ext : extensions.split(",")) 252 if (name.endsWith( "."+ext))252 if (name.endsWith('.' +ext)) 253 253 return true; 254 254 return false; 255 255 } -
org/openstreetmap/josm/actions/HistoryInfoWebAction.java
24 24 @Override 25 25 protected String createInfoUrl(Object infoObject) { 26 26 OsmPrimitive primitive = (OsmPrimitive) infoObject; 27 return getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/"+ primitive.getId() + "/history";27 return getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId() + "/history"; 28 28 } 29 29 } -
org/openstreetmap/josm/actions/ImageryAdjustAction.java
216 216 int precision = Main.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7; 217 217 // US locale to force decimal separator to be '.' 218 218 tOffset.setText(new java.util.Formatter(java.util.Locale.US).format( 219 "%1." + precision + "f; %1." + precision + "f",219 "%1." + precision + "f; %1." + precision + 'f', 220 220 layer.getDx(), layer.getDy()).toString()); 221 221 } 222 222 … … 237 237 238 238 @Override 239 239 protected void buttonAction(int buttonIndex, ActionEvent evt) { 240 if (buttonIndex == 0 && tBookmarkName.getText() != null && !"".equals(tBookmarkName.getText()) &&240 if (buttonIndex == 0 && tBookmarkName.getText() != null && tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty() && 241 241 OffsetBookmark.getBookmarkByName(layer, tBookmarkName.getText()) != null) { 242 242 if (!confirmOverwriteBookmark()) return; 243 243 } … … 251 251 offsetDialog = null; 252 252 if (getValue() != 1) { 253 253 layer.setOffset(oldDx, oldDy); 254 } else if (tBookmarkName.getText() != null && !"".equals(tBookmarkName.getText())) {254 } else if (tBookmarkName.getText() != null && tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty()) { 255 255 OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer); 256 256 } 257 257 Main.main.menu.imageryMenu.refreshOffsetMenu(); -
org/openstreetmap/josm/actions/InfoWebAction.java
24 24 @Override 25 25 protected String createInfoUrl(Object infoObject) { 26 26 OsmPrimitive primitive = (OsmPrimitive)infoObject; 27 return getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/"+ primitive.getId();27 return getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId(); 28 28 } 29 29 } -
org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java
125 125 // Checks clipboard contents against current service if no match has been found yet. 126 126 // If the contents match, they will be inserted into the text field and the corresponding 127 127 // service will be pre-selected. 128 if(!clip. equals("") && tfWmsUrl.getText().equals("")128 if(!clip.isEmpty() && tfWmsUrl.getText().isEmpty() 129 129 && (s.urlRegEx.matcher(clip).find() || s.idValidator.matcher(clip).matches())) { 130 130 serviceBtn.setSelected(true); 131 131 tfWmsUrl.setText(clip); 132 132 } 133 133 s.btn = serviceBtn; 134 134 group.add(serviceBtn); 135 if(!s.url. equals("")) {135 if(!s.url.isEmpty()) { 136 136 panel.add(serviceBtn, GBC.std()); 137 137 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST)); 138 138 } else { … … 141 141 } 142 142 143 143 // Fallback in case no match was found 144 if(tfWmsUrl.getText(). equals("") && firstBtn != null) {144 if(tfWmsUrl.getText().isEmpty() && firstBtn != null) { 145 145 firstBtn.setSelected(true); 146 146 } 147 147 … … 174 174 175 175 // We've reached the custom WMS URL service 176 176 // Just set the URL and hope everything works out 177 if(s.wmsUrl. equals("")) {178 addWMSLayer(s.name + " (" + text + ")", text);177 if(s.wmsUrl.isEmpty()) { 178 addWMSLayer(s.name + " (" + text + ')', text); 179 179 break outer; 180 180 } 181 181 … … 184 184 if(m.find()) { 185 185 String id = m.group(1); 186 186 String newURL = s.wmsUrl.replaceAll("__s__", id); 187 String title = s.name + " (" + id + ")";187 String title = s.name + " (" + id + ')'; 188 188 addWMSLayer(title, newURL); 189 189 break outer; 190 190 } 191 191 // If not, look if it's a valid ID for the selected service 192 192 if(s.idValidator.matcher(text).matches()) { 193 193 String newURL = s.wmsUrl.replaceAll("__s__", text); 194 String title = s.name + " (" + text + ")";194 String title = s.name + " (" + text + ')'; 195 195 addWMSLayer(title, newURL); 196 196 break outer; 197 197 } -
org/openstreetmap/josm/actions/PasteTagsAction.java
271 271 String v; 272 272 for (String key: tags.keySet()) { 273 273 v = tags.get(key); 274 commands.add(new ChangePropertyCommand(selection, key, "".equals(v)?null:v));274 commands.add(new ChangePropertyCommand(selection, key, v != null && v.isEmpty() ?null:v)); 275 275 } 276 276 commitCommands(selection, commands); 277 277 return !commands.isEmpty(); … … 288 288 PasteTagsAction.TagPaster tagPaster = new PasteTagsAction.TagPaster(directlyAdded, selection); 289 289 List<Command> commands = new ArrayList<Command>(); 290 290 for (Tag tag : tagPaster.execute()) { 291 commands.add(new ChangePropertyCommand(selection, tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue()));291 commands.add(new ChangePropertyCommand(selection, tag.getKey(), tag.getValue() != null && tag.getValue().isEmpty() ? null : tag.getValue())); 292 292 } 293 293 commitCommands(selection, commands); 294 294 return true; … … 304 304 String title2 = trn("to {0} object", "to {0} objects", selection.size(), selection.size()); 305 305 Main.main.undoRedo.add( 306 306 new SequenceCommand( 307 title1 + " "+ title2,307 title1 + ' ' + title2, 308 308 commands 309 309 )); 310 310 } -
org/openstreetmap/josm/actions/PurgeAction.java
243 243 return (Long.valueOf(o1.getUniqueId())).compareTo(o2.getUniqueId()); 244 244 } 245 245 }); 246 JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[ 0]));246 JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()])); 247 247 /* force selection to be active for all entries */ 248 248 list.setCellRenderer(new OsmPrimitivRenderer() { 249 249 @Override -
org/openstreetmap/josm/actions/RenameLayerAction.java
77 77 Main.pref.put("layer.rename-file", filerename.isSelected()); 78 78 if (filerename.isSelected()) { 79 79 String newname = nameText; 80 if (newname.indexOf( "/") == -1 && newname.indexOf("\\") == -1) {80 if (newname.indexOf('/') == -1 && newname.indexOf('\\') == -1) { 81 81 newname = file.getParent() + File.separator + newname; 82 82 } 83 83 String oldname = file.getName(); -
org/openstreetmap/josm/actions/RestartAction.java
89 89 } else { 90 90 // else it's a .class, add the classpath and mainClass 91 91 cmd.add("-cp"); 92 cmd.add( "\"" + System.getProperty("java.class.path") + "\"");92 cmd.add('"' + System.getProperty("java.class.path") + '"'); 93 93 cmd.add(mainCommand[0]); 94 94 } 95 95 // finally add program arguments … … 101 101 @Override 102 102 public void run() { 103 103 try { 104 Runtime.getRuntime().exec(cmd.toArray(new String[ ]{}));104 Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()])); 105 105 } catch (IOException e) { 106 106 e.printStackTrace(); 107 107 } -
org/openstreetmap/josm/actions/SaveActionBase.java
159 159 // No filefilter accepts current filename, add default extension 160 160 String fn = file.getPath(); 161 161 if (ff instanceof ExtensionFileFilter) { 162 fn += "."+ ((ExtensionFileFilter)ff).getDefaultExtension();162 fn += '.' + ((ExtensionFileFilter)ff).getDefaultExtension(); 163 163 } else if (extension != null) { 164 fn += "."+ extension;164 fn += '.' + extension; 165 165 } 166 166 file = new File(fn); 167 167 if (!confirmOverwrite(file)) -
org/openstreetmap/josm/actions/ShowStatusReportAction.java
59 59 60 60 private static void shortenParam(ListIterator<String> it, String[] param, String source, String target) { 61 61 if (source != null && target.length() < source.length() && param[1].startsWith(source)) { 62 it.set(param[0] + "="+ param[1].replace(source, target));62 it.set(param[0] + '=' + param[1].replace(source, target)); 63 63 } 64 64 } 65 65 … … 71 71 { 72 72 StringBuilder text = new StringBuilder(); 73 73 text.append(Version.getInstance().getReleaseAttributes()); 74 text.append( "\n");75 text.append("Identification: " +Version.getInstance().getAgentString());76 text.append( "\n");74 text.append('\n'); 75 text.append("Identification: ").append(Version.getInstance().getAgentString()); 76 text.append('\n'); 77 77 text.append("Memory Usage: "); 78 78 text.append(Runtime.getRuntime().totalMemory()/1024/1024); 79 79 text.append(" MB / "); … … 81 81 text.append(" MB ("); 82 82 text.append(Runtime.getRuntime().freeMemory()/1024/1024); 83 83 text.append(" MB allocated, but free)"); 84 text.append( "\n");85 text.append("Java version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + ", " +System.getProperty("java.vm.name"));86 text.append( "\n");84 text.append('\n'); 85 text.append("Java version: ").append(System.getProperty("java.version")).append(", ").append(System.getProperty("java.vendor")).append(", ").append(System.getProperty("java.vm.name")); 86 text.append('\n'); 87 87 try { 88 88 final String env_java_home = System.getenv("JAVA_HOME"); 89 89 final String env_java_home_alt = Main.platform instanceof PlatformHookWindows ? "%JAVA_HOME%" : "${JAVA_HOME}"; … … 106 106 } 107 107 } 108 108 if (!vmArguments.isEmpty()) { 109 text.append("VM arguments: " +vmArguments.toString().replace("\\\\", "\\"));110 text.append( "\n");109 text.append("VM arguments: ").append(vmArguments.toString().replace("\\\\", "\\")); 110 text.append('\n'); 111 111 } 112 112 } catch (SecurityException e) { 113 113 // Ignore exception 114 114 } 115 115 if (Main.commandLineArgs.length > 0) { 116 text.append("Program arguments: " +Arrays.toString(Main.commandLineArgs));117 text.append( "\n");116 text.append("Program arguments: ").append(Arrays.toString(Main.commandLineArgs)); 117 text.append('\n'); 118 118 } 119 119 if (Main.main != null) { 120 120 DataSet dataset = Main.main.getCurrentDataSet(); … … 123 123 if (result.length() == 0) { 124 124 text.append("Dataset consistency test: No problems found\n"); 125 125 } else { 126 text.append("\nDataset consistency test:\n" +result+"\n");126 text.append("\nDataset consistency test:\n").append(result).append('\n'); 127 127 } 128 128 } 129 129 } 130 text.append( "\n");130 text.append('\n'); 131 131 text.append(PluginHandler.getBugReportText()); 132 text.append( "\n");132 text.append('\n'); 133 133 134 134 return text.toString(); 135 135 } … … 151 151 } 152 152 } 153 153 for (Entry<String, Setting> entry : settings.entrySet()) { 154 text.append(entry.getKey()).append( "=").append(entry.getValue().getValue().toString()).append("\n");154 text.append(entry.getKey()).append('=').append(entry.getValue().getValue().toString()).append('\n'); 155 155 } 156 156 } catch (Exception x) { 157 157 x.printStackTrace(); -
org/openstreetmap/josm/actions/UnGlueAction.java
120 120 } 121 121 } else { 122 122 errMsg = 123 tr("The current selection cannot be used for unglueing.")+ "\n"+124 "\n"+125 tr("Select either:")+ "\n"+126 tr("* One tagged node, or")+ "\n"+127 tr("* One node that is used by more than one way, or")+ "\n"+128 tr("* One node that is used by more than one way and one of those ways, or")+ "\n"+129 tr("* One way that has one or more nodes that are used by more than one way, or")+ "\n"+130 tr("* One way and one or more of its nodes that are used by more than one way.")+ "\n"+131 "\n"+123 tr("The current selection cannot be used for unglueing.")+ '\n' + 124 '\n' + 125 tr("Select either:")+ '\n' + 126 tr("* One tagged node, or")+ '\n' + 127 tr("* One node that is used by more than one way, or")+ '\n' + 128 tr("* One node that is used by more than one way and one of those ways, or")+ '\n' + 129 tr("* One way that has one or more nodes that are used by more than one way, or")+ '\n' + 130 tr("* One way and one or more of its nodes that are used by more than one way.")+ '\n' + 131 '\n' + 132 132 tr("Note: If a way is selected, this way will get fresh copies of the unglued\n"+ 133 133 "nodes and the new nodes will be selected. Otherwise, all ways will get their\n"+ 134 134 "own copy and all nodes will be selected."); -
org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
321 321 String urlString = url.toExternalForm(); 322 322 if (urlString.matches(PATTERN_OSM_API_URL)) { 323 323 // TODO: proper i18n after stabilization 324 String message = "<ul><li>"+tr("OSM Server URL:") + " "+ url.getHost() + "</li><li>" +324 String message = "<ul><li>"+tr("OSM Server URL:") + ' ' + url.getHost() + "</li><li>" + 325 325 tr("Command")+": "+url.getPath()+"</li>"; 326 326 if (url.getQuery() != null) { 327 327 message += "<li>" + tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", ")) + "</li>"; -
org/openstreetmap/josm/actions/mapmode/DrawAction.java
1209 1209 */ 1210 1210 if (currentBaseNode != null && !wayIsFinished) { 1211 1211 if (alt) { 1212 rv += " "+ tr("Start new way from last node.");1212 rv += ' ' + tr("Start new way from last node."); 1213 1213 } else { 1214 rv += " "+ tr("Continue way from last node.");1214 rv += ' ' + tr("Continue way from last node."); 1215 1215 } 1216 1216 if (snapHelper.isSnapOn()) { 1217 rv += " "+ tr("Angle snapping active.");1217 rv += ' ' + tr("Angle snapping active."); 1218 1218 } 1219 1219 } 1220 1220 … … 1237 1237 Way w = getCurrentDataSet().getSelectedWays().iterator().next(); 1238 1238 for (Node m : w.getNodes()) { 1239 1239 if (m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) { 1240 rv += " "+ tr("Finish drawing.");1240 rv += ' ' + tr("Finish drawing."); 1241 1241 break; 1242 1242 } 1243 1243 } -
org/openstreetmap/josm/actions/mapmode/SelectAction.java
884 884 return tr("Release the mouse button to select the objects in the rectangle."); 885 885 else if (mode == Mode.move && (System.currentTimeMillis() - mouseDownTime >= initialMoveDelay)) { 886 886 final boolean canMerge = getCurrentDataSet()!=null && !getCurrentDataSet().getSelectedNodes().isEmpty(); 887 final String mergeHelp = canMerge ? ( " "+ tr("Ctrl to merge with nearest node.")) : "";887 final String mergeHelp = canMerge ? (' ' + tr("Ctrl to merge with nearest node.")) : ""; 888 888 return tr("Release the mouse button to stop moving.") + mergeHelp; 889 889 } else if (mode == Mode.rotate) 890 890 return tr("Release the mouse button to stop rotating."); -
org/openstreetmap/josm/actions/search/PushbackTokenizer.java
36 36 */ 37 37 @Override 38 38 public String toString() { 39 return "Range [start=" + start + ", end=" + end + "]";39 return "Range [start=" + start + ", end=" + end + ']'; 40 40 } 41 41 } 42 42 -
org/openstreetmap/josm/actions/search/SearchAction.java
194 194 public void mouseClicked(MouseEvent e) { 195 195 try { 196 196 JTextComponent tf = (JTextComponent) hcb.getEditor().getEditorComponent(); 197 tf.getDocument().insertString(tf.getCaretPosition(), " "+ insertText, null);197 tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null); 198 198 } catch (BadLocationException ex) { 199 199 throw new RuntimeException(ex.getMessage(), ex); 200 200 } … … 636 636 /*regex search*/ trc("search", "RX")) : ""; 637 637 String all = allElements ? (", " + 638 638 /*all elements*/ trc("search", "A")) : ""; 639 return "\"" + text + "\" (" + cs + rx + all + ", " + mode + ")";639 return '"' + text + "\" (" + cs + rx + all + ", " + mode + ')'; 640 640 } 641 641 642 642 @Override -
org/openstreetmap/josm/actions/search/SearchCompiler.java
142 142 else if ("nth%".equals(keyword)) 143 143 return new Nth(tokenizer, true); 144 144 else if ("timestamp".equals(keyword)) { 145 String rangeS = " " + tokenizer.readTextOrNumber() + " "; // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""})145 String rangeS = ' ' + tokenizer.readTextOrNumber() + ' '; // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""}) 146 146 String[] rangeA = rangeS.split("/"); 147 147 if (rangeA.length == 1) 148 148 return new KeyValue(keyword, rangeS.trim(), regexSearch, caseSensitive); … … 514 514 515 515 return false; 516 516 } 517 @Override public String toString() {return key+ "="+value;}517 @Override public String toString() {return key+ '=' +value;} 518 518 } 519 519 520 520 /** … … 534 534 private final Mode mode; 535 535 536 536 public ExactKeyValue(boolean regexp, String key, String value) throws ParseError { 537 if ( "".equals(key))537 if (key != null && key.isEmpty()) 538 538 throw new ParseError(tr("Key cannot be empty when tag operator is used. Sample use: key=value")); 539 539 this.key = key; 540 540 this.value = value == null?"":value; 541 if ( "".equals(this.value) && "*".equals(key)) {541 if (this.value != null && this.value.isEmpty() && "*".equals(key)) { 542 542 mode = Mode.NONE; 543 } else if ( "".equals(this.value)) {543 } else if (this.value != null && this.value.isEmpty()) { 544 544 if (regexp) { 545 545 mode = Mode.MISSING_KEY_REGEXP; 546 546 } else { … … 679 679 680 680 @Override public boolean match(OsmPrimitive osm) { 681 681 if (!osm.hasKeys() && osm.getUser() == null) 682 return search. equals("");682 return search.isEmpty(); 683 683 684 684 for (String key: osm.keySet()) { 685 685 String value = osm.get(key); … … 862 862 863 863 @Override 864 864 public String toString() { 865 return getString() + "=" + min + "-"+ max;865 return getString() + '=' + min + '-' + max; 866 866 } 867 867 } 868 868 … … 1024 1024 } 1025 1025 return isParent; 1026 1026 } 1027 @Override public String toString() {return "parent(" + match + ")";}1027 @Override public String toString() {return "parent(" + match + ')';} 1028 1028 } 1029 1029 1030 1030 /** … … 1043 1043 } 1044 1044 return isChild; 1045 1045 } 1046 @Override public String toString() {return "child(" + match + ")";}1046 @Override public String toString() {return "child(" + match + ')';} 1047 1047 } 1048 1048 1049 1049 /** -
org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java
20 20 protected String formatRelation(Relation r) { 21 21 StringBuffer sb = new StringBuffer(); 22 22 if (r.getName() != null) { 23 sb.append( "'").append(r.getName()).append("'");23 sb.append('\'').append(r.getName()).append('\''); 24 24 } else if (!r.isNew()) { 25 25 sb.append(r.getId()); 26 26 } else { … … 33 33 public String getMessage() { 34 34 StringBuffer sb = new StringBuffer(); 35 35 sb.append(tr("Cyclic dependency between relations:")); 36 sb.append( "[");36 sb.append('['); 37 37 for (int i=0; i< cycle.size(); i++) { 38 38 if (i >0 ) { 39 sb.append( ",");39 sb.append(','); 40 40 } 41 41 sb.append(formatRelation(cycle.get(i))); 42 42 } 43 sb.append( "]");43 sb.append(']'); 44 44 return sb.toString(); 45 45 } 46 46 -
org/openstreetmap/josm/command/ChangePropertyKeyCommand.java
72 72 if (objects.size() == 1) { 73 73 NameVisitor v = new NameVisitor(); 74 74 objects.iterator().next().accept(v); 75 text += " "+tr(v.className)+" "+v.name;75 text += ' ' +tr(v.className)+ ' ' +v.name; 76 76 } else { 77 text += " "+objects.size()+ " "+trn("object","objects",objects.size());77 text += " "+objects.size()+ ' ' +trn("object","objects",objects.size()); 78 78 } 79 79 return text; 80 80 } -
org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
67 67 public StringSwitcher(String a, String b) { 68 68 this.a = a; 69 69 this.b = b; 70 this.pattern = getPatternFor(a + "|"+ b);70 this.pattern = getPatternFor(a + '|' + b); 71 71 } 72 72 73 73 public String apply(String text) { -
org/openstreetmap/josm/corrector/TagCorrector.java
86 86 p.add(propertiesLabel, GBC.std()); 87 87 88 88 final JLabel primitiveLabel = new JLabel( 89 primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ":",89 primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ':', 90 90 ImageProvider.get(primitive.getDisplayType()), 91 91 JLabel.LEFT 92 92 ); -
org/openstreetmap/josm/data/Bounds.java
186 186 } 187 187 188 188 @Override public String toString() { 189 return "Bounds["+minLat+ ","+minLon+","+maxLat+","+maxLon+"]";189 return "Bounds["+minLat+ ',' +minLon+ ',' +maxLat+ ',' +maxLon+ ']'; 190 190 } 191 191 192 192 public String toShortString(DecimalFormat format) { 193 193 return 194 format.format(minLat) + " "194 format.format(minLat) + ' ' 195 195 + format.format(minLon) + " / " 196 + format.format(maxLat) + " "196 + format.format(maxLat) + ' ' 197 197 + format.format(maxLon); 198 198 } 199 199 -
org/openstreetmap/josm/data/CustomConfigurator.java
64 64 65 65 public static void log(String s) { 66 66 summary.append(s); 67 summary.append( "\n");67 summary.append('\n'); 68 68 } 69 69 70 70 public static String getLog() { … … 453 453 engine.eval("API={}; API.pref={}; API.fragments={};"); 454 454 455 455 engine.eval("homeDir='"+normalizeDirName(Main.pref.getPreferencesDir()) +"';"); 456 engine.eval("josmVersion="+Version.getInstance().getVersion()+ ";");456 engine.eval("josmVersion="+Version.getInstance().getVersion()+ ';'); 457 457 String className = CustomConfigurator.class.getName(); 458 458 engine.eval("API.messageBox="+className+".messageBox"); 459 459 engine.eval("API.askText=function(text) { return String("+className+".askForText(text));}"); … … 1106 1106 " jsList.push(String(list.get(i)));"+ 1107 1107 " }"+ 1108 1108 "return jsList;"+ 1109 "}"+1109 '}' + 1110 1110 "function getJSMap( javaMap ) {"+ 1111 1111 " var jsMap; var it; var e; "+ 1112 1112 " if (javaMap == null) return null;"+ … … 1116 1116 " jsMap[ String(e.getKey()) ] = String(e.getValue()); "+ 1117 1117 " }"+ 1118 1118 " return jsMap;"+ 1119 "}"+1119 '}' + 1120 1120 "for (it = stringMap.entrySet().iterator(); it.hasNext();) {"+ 1121 1121 " e = it.next();"+ 1122 1122 whereToPutInJS+"[String(e.getKey())] = String(e.getValue());"+ -
org/openstreetmap/josm/data/Preferences.java
437 437 synchronized public String get(final String key, final String def) { 438 438 putDefault(key, def); 439 439 final String prop = properties.get(key); 440 if (prop == null || prop. equals(""))440 if (prop == null || prop.isEmpty()) 441 441 return def; 442 442 return prop; 443 443 } … … 511 511 512 512 synchronized public boolean getBoolean(final String key, final String specName, final boolean def) { 513 513 putDefault(key, Boolean.toString(def)); 514 String skey = key+ "."+specName;514 String skey = key+ '.' +specName; 515 515 if(properties.containsKey(skey)) 516 516 return Boolean.parseBoolean(properties.get(skey)); 517 517 return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : def; … … 770 770 } 771 771 putDefault("color."+colKey, ColorHelper.color2html(def)); 772 772 String colStr = specName != null ? get("color."+specName) : ""; 773 if(colStr. equals("")) {773 if(colStr.isEmpty()) { 774 774 colStr = get("color."+colKey); 775 775 } 776 return colStr. equals("") ? def : ColorHelper.html2color(colStr);776 return colStr.isEmpty() ? def : ColorHelper.html2color(colStr); 777 777 } 778 778 779 779 synchronized public Color getDefaultColor(String colKey) { 780 780 String colStr = defaults.get("color."+colKey); 781 return colStr == null || "".equals(colStr) ? null : ColorHelper.html2color(colStr);781 return colStr == null || colStr != null && colStr.isEmpty() ? null : ColorHelper.html2color(colStr); 782 782 } 783 783 784 784 synchronized public boolean putColor(String colKey, Color val) { … … 801 801 802 802 synchronized public int getInteger(String key, String specName, int def) { 803 803 putDefault(key, Integer.toString(def)); 804 String v = get(key+ "."+specName);804 String v = get(key+ '.' +specName); 805 805 if(v.isEmpty()) 806 806 v = get(key); 807 807 if(v.isEmpty()) -
org/openstreetmap/josm/data/ProjectionBounds.java
61 61 } 62 62 63 63 @Override public String toString() { 64 return "ProjectionBounds["+minEast+ ","+minNorth+","+maxEast+","+maxNorth+"]";64 return "ProjectionBounds["+minEast+ ',' +minNorth+ ',' +maxEast+ ',' +maxNorth+ ']'; 65 65 } 66 66 67 67 /** -
org/openstreetmap/josm/data/ServerSidePreferences.java
51 51 String username = get("applet.username"); 52 52 String password = get("applet.password"); 53 53 if(password.isEmpty() && username.isEmpty()) { 54 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ":"+password));54 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ':' +password)); 55 55 } 56 56 con.connect(); 57 57 if(username.isEmpty() && con instanceof HttpURLConnection … … 65 65 StringBuilder b = new StringBuilder(); 66 66 for (String line = reader.readLine(); line != null; line = reader.readLine()) { 67 67 b.append(line); 68 b.append( "\n");68 b.append('\n'); 69 69 } 70 70 if (con instanceof HttpURLConnection) { 71 71 ((HttpURLConnection) con).disconnect(); … … 84 84 String username = get("applet.username"); 85 85 String password = get("applet.password"); 86 86 if(password.isEmpty() && username.isEmpty()) { 87 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ":"+password));87 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ':' +password)); 88 88 } 89 89 con.setRequestMethod("POST"); 90 90 con.setDoOutput(true); -
org/openstreetmap/josm/data/Version.java
40 40 StringBuffer sb = new StringBuffer(); 41 41 try { 42 42 for (String line = in.readLine(); line != null; line = in.readLine()) { 43 sb.append(line).append( "\n");43 sb.append(line).append('\n'); 44 44 } 45 45 } finally { 46 46 Utils.close(in); … … 78 78 if (content == null) return properties; 79 79 Pattern p = Pattern.compile("^([^:]+):(.*)$"); 80 80 for (String line: content.split("\n")) { 81 if (line == null || line.trim(). equals("")) {81 if (line == null || line.trim().isEmpty()) { 82 82 continue; 83 83 } 84 84 if (line.matches("^\\s*#.*$")) { … … 146 146 // 147 147 StringBuffer sb = new StringBuffer(); 148 148 for(Entry<String,String> property: properties.entrySet()) { 149 sb.append(property.getKey()).append( ":").append(property.getValue()).append("\n");149 sb.append(property.getKey()).append(':').append(property.getValue()).append('\n'); 150 150 } 151 151 releaseDescription = sb.toString(); 152 152 } … … 228 228 int v = getVersion(); 229 229 String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v); 230 230 if (buildName != null) { 231 s += " "+ buildName;231 s += ' ' + buildName; 232 232 } 233 233 if (isLocalBuild() && v != JOSM_UNKNOWN_VERSION) { 234 234 s += " SVN"; 235 235 } 236 String result = "JOSM/1.5 ("+ s+ " "+LanguageInfo.getJOSMLocaleCode()+")";236 String result = "JOSM/1.5 ("+ s+ ' ' +LanguageInfo.getJOSMLocaleCode()+ ')'; 237 237 if (includeOsDetails) { 238 result += " "+ Main.platform.getOSDescription();238 result += ' ' + Main.platform.getOSDescription(); 239 239 } 240 240 return result; 241 241 } -
org/openstreetmap/josm/data/coor/CachedLatLon.java
58 58 return eastNorth; 59 59 } 60 60 @Override public String toString() { 61 return "CachedLatLon[lat="+lat()+",lon="+lon()+ "]";61 return "CachedLatLon[lat="+lat()+",lon="+lon()+ ']'; 62 62 } 63 63 64 64 // Only for Node.get3892DebugInfo() -
org/openstreetmap/josm/data/coor/EastNorth.java
91 91 } 92 92 93 93 @Override public String toString() { 94 return "EastNorth[e="+x+", n="+y+ "]";94 return "EastNorth[e="+x+", n="+y+ ']'; 95 95 } 96 96 97 97 /** -
org/openstreetmap/josm/data/coor/LatLon.java
128 128 sDegrees = Integer.toString(tDegree+1); 129 129 } 130 130 131 return sDegrees + "\u00B0" + sMinutes + "\'" + sSeconds + "\"";131 return sDegrees + '\u00B0' + sMinutes + '\'' + sSeconds + '"'; 132 132 } 133 133 134 134 /** … … 150 150 sDegrees = Integer.toString(tDegree+1); 151 151 } 152 152 153 return sDegrees + "\u00B0" + sMinutes + "\'";153 return sDegrees + '\u00B0' + sMinutes + '\''; 154 154 } 155 155 156 156 public LatLon(double lat, double lon) { … … 273 273 public String toDisplayString() { 274 274 NumberFormat nf = NumberFormat.getInstance(); 275 275 nf.setMaximumFractionDigits(5); 276 return "lat=" + nf.format(lat()) + "\u00B0, lon=" + nf.format(lon()) + "\u00B0";276 return "lat=" + nf.format(lat()) + "\u00B0, lon=" + nf.format(lon()) + '\u00B0'; 277 277 } 278 278 279 279 public LatLon interpolate(LatLon ll2, double proportion) { … … 286 286 } 287 287 288 288 @Override public String toString() { 289 return "LatLon[lat="+lat()+",lon="+lon()+ "]";289 return "LatLon[lat="+lat()+",lon="+lon()+ ']'; 290 290 } 291 291 292 292 /** -
org/openstreetmap/josm/data/gpx/WayPoint.java
96 96 97 97 @Override 98 98 public String toString() { 99 return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + getCoor().toString() + ", " + attr + ")";99 return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + getCoor().toString() + ", " + attr + ')'; 100 100 } 101 101 102 102 /** -
org/openstreetmap/josm/data/imagery/ImageryInfo.java
521 521 522 522 public String getExtendedUrl() { 523 523 return imageryType.getUrlString() + (defaultMaxZoom != 0 524 ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":"+ url;524 ? '[' +(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+ ']' : "") + ':' + url; 525 525 } 526 526 527 527 public String getToolbarName() … … 537 537 { 538 538 String res = name; 539 539 if(pixelPerDegree != 0.0) { 540 res += " ("+pixelPerDegree+ ")";540 res += " ("+pixelPerDegree+ ')'; 541 541 } 542 542 return res; 543 543 } -
org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
126 126 127 127 // some additional checks to respect extended URLs in preferences (legacy workaround) 128 128 private boolean isSimilar(String a, String b) { 129 return Utils.equal(a, b) || (a != null && b != null && !"".equals(a) && !"".equals(b) && (a.contains(b) || b.contains(a)));129 return Utils.equal(a, b) || (a != null && b != null && a != null && !a.isEmpty() && b != null && !b.isEmpty() && (a.contains(b) || b.contains(a))); 130 130 } 131 131 132 132 public void add(ImageryInfo info) { -
org/openstreetmap/josm/data/imagery/WmsCache.java
302 302 } 303 303 304 304 private File getImageFile(ProjectionEntries projection, CacheEntry entry) { 305 return new File(cacheDir, projection.cacheDirectory + "/"+ entry.filename);305 return new File(cacheDir, projection.cacheDirectory + '/' + entry.filename); 306 306 } 307 307 308 308 -
org/openstreetmap/josm/data/osm/AbstractPrimitive.java
428 428 StringBuilder builder = new StringBuilder(); 429 429 430 430 if (isIncomplete()) { 431 builder.append( "I");431 builder.append('I'); 432 432 } 433 433 if (isModified()) { 434 builder.append( "M");434 builder.append('M'); 435 435 } 436 436 if (isVisible()) { 437 builder.append( "V");437 builder.append('V'); 438 438 } 439 439 if (isDeleted()) { 440 builder.append( "D");440 builder.append('D'); 441 441 } 442 442 return builder.toString(); 443 443 } … … 697 697 String key = "name:" + Locale.getDefault().toString(); 698 698 if (get(key) != null) 699 699 return get(key); 700 key = "name:" + Locale.getDefault().getLanguage() + "_"+ Locale.getDefault().getCountry();700 key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry(); 701 701 if (get(key) != null) 702 702 return get(key); 703 703 key = "name:" + Locale.getDefault().getLanguage(); -
org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
28 28 private void printError(String type, String message, Object... args) { 29 29 errorCount++; 30 30 if (errorCount <= MAX_ERRORS) { 31 writer.println( "["+ type + "] " + String.format(message, args));31 writer.println('[' + type + "] " + String.format(message, args)); 32 32 } 33 33 } 34 34 -
org/openstreetmap/josm/data/osm/Node.java
261 261 @Override 262 262 public String toString() { 263 263 String coorDesc = isLatLonKnown() ? "lat="+lat+",lon="+lon : ""; 264 return "{Node id=" + getUniqueId() + " version=" + getVersion() + " " + getFlagsAsString() + " " + coorDesc+"}";264 return "{Node id=" + getUniqueId() + " version=" + getVersion() + ' ' + getFlagsAsString() + ' ' + coorDesc+ '}'; 265 265 } 266 266 267 267 @Override -
org/openstreetmap/josm/data/osm/OsmPrimitive.java
1185 1185 1186 1186 if (isDisabled()) { 1187 1187 if (isDisabledAndHidden()) { 1188 builder.append( "h");1188 builder.append('h'); 1189 1189 } else { 1190 builder.append( "d");1190 builder.append('d'); 1191 1191 } 1192 1192 } 1193 1193 if (isTagged()) { 1194 builder.append( "T");1194 builder.append('T'); 1195 1195 } 1196 1196 if (hasDirectionKeys()) { 1197 1197 if (reversedDirection()) { 1198 builder.append( "<");1198 builder.append('<'); 1199 1199 } else { 1200 builder.append( ">");1200 builder.append('>'); 1201 1201 } 1202 1202 } 1203 1203 return builder.toString(); -
org/openstreetmap/josm/data/osm/QuadBuckets.java
43 43 if (now - last_out < 300) 44 44 return; 45 45 last_out = now; 46 System.out.print(s + "\r");46 System.out.print(s + '\r'); 47 47 } 48 48 void pout(String s, int i, int total) 49 49 { … … 53 53 return; 54 54 last_out = now; 55 55 // cast to float to keep the output size down 56 System.out.print(s + " "+ (float)((i+1)*100.0/total) + "% done \r");56 System.out.print(s + ' ' + (float)((i+1)*100.0/total) + "% done \r"); 57 57 } 58 58 59 59 public static final int MAX_OBJECTS_PER_LEVEL = 16; … … 111 111 112 112 @Override 113 113 public String toString() { 114 return super.toString()+ "["+level+"]: " + bbox();114 return super.toString()+ '[' +level+"]: " + bbox(); 115 115 } 116 116 /** 117 117 * Constructor for root node … … 472 472 return; 473 473 474 474 if (!canRemove()) { 475 abort("attempt to remove non-empty child: " + this.content + " "+ Arrays.toString(this.getChildren()));475 abort("attempt to remove non-empty child: " + this.content + ' ' + Arrays.toString(this.getChildren())); 476 476 } 477 477 478 478 if (parent.nw == this) { -
org/openstreetmap/josm/data/osm/Relation.java
263 263 result.append(getUniqueId()); 264 264 result.append(" version="); 265 265 result.append(getVersion()); 266 result.append( " ");266 result.append(' '); 267 267 result.append(getFlagsAsString()); 268 268 result.append(" ["); 269 269 for (RelationMember rm:getMembers()) { 270 270 result.append(OsmPrimitiveType.from(rm.getMember())); 271 result.append( " ");271 result.append(' '); 272 272 result.append(rm.getMember().getUniqueId()); 273 273 result.append(", "); 274 274 } 275 275 result.delete(result.length()-2, result.length()); 276 result.append( "]");277 result.append( "}");276 result.append(']'); 277 result.append('}'); 278 278 return result.toString(); 279 279 } 280 280 -
org/openstreetmap/josm/data/osm/RelationMember.java
34 34 * @since 1930 35 35 */ 36 36 public boolean hasRole() { 37 return !"".equals(role);37 return role != null && !role.isEmpty(); 38 38 } 39 39 40 40 /** -
org/openstreetmap/josm/data/osm/RelationMemberData.java
30 30 } 31 31 32 32 public boolean hasRole() { 33 return !"".equals(role);33 return role != null && !role.isEmpty(); 34 34 } 35 35 36 36 @Override 37 37 public String toString() { 38 return (memberType != null ? memberType.getAPIName() : "undefined") + " "+ memberId;38 return (memberType != null ? memberType.getAPIName() : "undefined") + ' ' + memberId; 39 39 } 40 40 41 41 /** -
org/openstreetmap/josm/data/osm/Tag.java
98 98 99 99 @Override 100 100 public String toString() { 101 return key + "="+ value;101 return key + '=' + value; 102 102 } 103 103 } -
org/openstreetmap/josm/data/osm/TagCollection.java
600 600 if (! isApplicableToPrimitive()) 601 601 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 602 602 for (Tag tag: tags) { 603 if (tag.getValue() == null || tag.getValue(). equals("")) {603 if (tag.getValue() == null || tag.getValue().isEmpty()) { 604 604 primitive.remove(tag.getKey()); 605 605 } else { 606 606 primitive.put(tag.getKey(), tag.getValue()); -
org/openstreetmap/josm/data/osm/User.java
204 204 @Override 205 205 public String toString() { 206 206 StringBuffer s = new StringBuffer(); 207 s.append("id:" +uid);207 s.append("id:").append(uid); 208 208 if (names.size() == 1) { 209 s.append(" name:" +getName());209 s.append(" name:").append(getName()); 210 210 } 211 211 else if (names.size() > 1) { 212 212 s.append(String.format(" %d names:%s", names.size(), getName())); -
org/openstreetmap/josm/data/osm/Way.java
321 321 @Override 322 322 public String toString() { 323 323 String nodesDesc = isIncomplete()?"(incomplete)":"nodes=" + Arrays.toString(nodes); 324 return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString() + " " + nodesDesc + "}";324 return "{Way id=" + getUniqueId() + " version=" + getVersion()+ ' ' + getFlagsAsString() + ' ' + nodesDesc + '}'; 325 325 } 326 326 327 327 @Override -
org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
221 221 String key = "name:" + Locale.getDefault().toString(); 222 222 if (get(key) != null) 223 223 return get(key); 224 key = "name:" + Locale.getDefault().getLanguage() + "_"+ Locale.getDefault().getCountry();224 key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry(); 225 225 if (get(key) != null) 226 226 return get(key); 227 227 key = "name:" + Locale.getDefault().getLanguage(); … … 264 264 + (timestamp != null ? "timestamp=" + timestamp : "") + ", " 265 265 + (user != null ? "user=" + user + ", " : "") + "changesetId=" 266 266 + changesetId 267 + "]";267 + ']'; 268 268 } 269 269 } -
org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
120 120 } 121 121 122 122 @Override public String toString() { 123 return "BoundingXYVisitor["+bounds+ "]";123 return "BoundingXYVisitor["+bounds+ ']'; 124 124 } 125 125 126 126 public void computeBoundingBox(Collection<? extends OsmPrimitive> primitives) { -
org/openstreetmap/josm/data/projection/CustomProjection.java
396 396 boolean dms = false; 397 397 double deg = 0.0, min = 0.0, sec = 0.0; 398 398 // degrees 399 m = Pattern.compile( "^"+FLOAT+"d").matcher(s);399 m = Pattern.compile('^' +FLOAT+ 'd').matcher(s); 400 400 if (m.find()) { 401 401 s = s.substring(m.end()); 402 402 deg = Double.parseDouble(m.group(1)); 403 403 dms = true; 404 404 } 405 405 // minutes 406 m = Pattern.compile( "^"+FLOAT+"'").matcher(s);406 m = Pattern.compile('^' +FLOAT+ '\'').matcher(s); 407 407 if (m.find()) { 408 408 s = s.substring(m.end()); 409 409 min = Double.parseDouble(m.group(1)); 410 410 dms = true; 411 411 } 412 412 // seconds 413 m = Pattern.compile( "^"+FLOAT+"\"").matcher(s);413 m = Pattern.compile('^' +FLOAT+ '"').matcher(s); 414 414 if (m.find()) { 415 415 s = s.substring(m.end()); 416 416 sec = Double.parseDouble(m.group(1)); … … 420 420 if (dms) { 421 421 value = deg + (min/60.0) + (sec/3600.0); 422 422 } else { 423 m = Pattern.compile( "^"+FLOAT).matcher(s);423 m = Pattern.compile('^' +FLOAT).matcher(s); 424 424 if (m.find()) { 425 425 s = s.substring(m.end()); 426 426 value += Double.parseDouble(m.group(1)); -
org/openstreetmap/josm/data/projection/Ellipsoid.java
128 128 129 129 @Override 130 130 public String toString() { 131 return "Ellipsoid{a="+a+", b="+b+ "}";131 return "Ellipsoid{a="+a+", b="+b+ '}'; 132 132 } 133 133 134 134 /** -
org/openstreetmap/josm/data/projection/datum/CentricDatum.java
26 26 27 27 @Override 28 28 public String toString() { 29 return "CentricDatum{ellipsoid="+ellps+ "}";29 return "CentricDatum{ellipsoid="+ellps+ '}'; 30 30 } 31 31 } -
org/openstreetmap/josm/data/validation/TestError.java
182 182 } else if (o instanceof Node) { 183 183 type = "n"; 184 184 } 185 strings.add(type + "_"+ o.getId());185 strings.add(type + '_' + o.getId()); 186 186 } 187 187 for (String o : strings) { 188 ignorestring += ":"+ o;188 ignorestring += ':' + o; 189 189 } 190 190 return ignorestring; 191 191 } … … 193 193 public String getIgnoreSubGroup() { 194 194 String ignorestring = getIgnoreGroup(); 195 195 if (description_en != null) { 196 ignorestring += "_"+ description_en;196 ignorestring += '_' + description_en; 197 197 } 198 198 return ignorestring; 199 199 } … … 321 321 322 322 @Override 323 323 public String toString() { 324 return "TestError [tester=" + tester + ", code=" + code + "]";324 return "TestError [tester=" + tester + ", code=" + code + ']'; 325 325 } 326 326 } -
org/openstreetmap/josm/data/validation/tests/RelationChecker.java
146 146 for (Role r : allroles) { 147 147 done.add(r.key); 148 148 String keyname = r.key; 149 if ( "".equals(keyname)) {149 if (keyname != null && keyname.isEmpty()) { 150 150 keyname = tr("<empty>"); 151 151 } 152 152 RoleInfo ri = map.get(r.key); -
org/openstreetmap/josm/data/validation/tests/TagChecker.java
86 86 protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>(); 87 87 88 88 /** The preferences prefix */ 89 protected static final String PREFIX = ValidatorPreference.PREFIX + "."+ TagChecker.class.getSimpleName();89 protected static final String PREFIX = ValidatorPreference.PREFIX + '.' + TagChecker.class.getSimpleName(); 90 90 91 91 public static final String PREF_CHECK_VALUES = PREFIX + ".checkValues"; 92 92 public static final String PREF_CHECK_KEYS = PREFIX + ".checkKeys"; … … 182 182 if (sources == null || sources.length() == 0) { 183 183 sources = DATA_FILE; 184 184 } else { 185 sources = DATA_FILE + ";"+ sources;185 sources = DATA_FILE + ';' + sources; 186 186 } 187 187 } 188 188 if (Main.pref.getBoolean(PREF_USE_IGNORE_FILE, true)) { 189 189 if (sources == null || sources.length() == 0) { 190 190 sources = IGNORE_FILE; 191 191 } else { 192 sources = IGNORE_FILE + ";"+ sources;192 sources = IGNORE_FILE + ';' + sources; 193 193 } 194 194 } 195 195 if (Main.pref.getBoolean(PREF_USE_SPELL_FILE, true)) { 196 196 if( sources == null || sources.length() == 0) { 197 197 sources = SPELL_FILE; 198 198 } else { 199 sources = SPELL_FILE + ";"+ sources;199 sources = SPELL_FILE + ';' + sources; 200 200 } 201 201 } 202 202 … … 244 244 ignoreDataEndsWith.add(line); 245 245 } else if (key.equals("K:")) { 246 246 IgnoreKeyPair tmp = new IgnoreKeyPair(); 247 int mid = line.indexOf( "=");247 int mid = line.indexOf('='); 248 248 tmp.key = line.substring(0, mid); 249 249 tmp.value = line.substring(mid+1); 250 250 ignoreDataKeyPair.add(tmp); … … 270 270 } 271 271 } 272 272 } catch (IOException e) { 273 errorSources += source + "\n";273 errorSources += source + '\n'; 274 274 } 275 275 } 276 276 … … 401 401 tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) ); 402 402 withErrors.put(p, "IPK"); 403 403 } 404 if (checkKeys && key.indexOf( " ") >= 0 && !withErrors.contains(p, "IPK")) {404 if (checkKeys && key.indexOf(' ') >= 0 && !withErrors.contains(p, "IPK")) { 405 405 errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"), 406 406 tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) ); 407 407 withErrors.put(p, "IPK"); -
org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
39 39 public class UnconnectedWays extends Test { 40 40 41 41 protected static final int UNCONNECTED_WAYS = 1301; 42 protected static final String PREFIX = ValidatorPreference.PREFIX + "."+ UnconnectedWays.class.getSimpleName();42 protected static final String PREFIX = ValidatorPreference.PREFIX + '.' + UnconnectedWays.class.getSimpleName(); 43 43 44 44 Set<MyWaySegment> ways; 45 45 QuadBuckets<Node> endnodes; // nodes at end of way -
org/openstreetmap/josm/gui/BookmarkList.java
215 215 Bounds area = b.getArea(); 216 216 StringBuffer sb = new StringBuffer(); 217 217 sb.append("<html>min[latitude,longitude]=<strong>[") 218 .append(area.getMin().lat()).append( ",").append(area.getMin().lon()).append("]</strong>")218 .append(area.getMin().lat()).append(',').append(area.getMin().lon()).append("]</strong>") 219 219 .append("<br>") 220 220 .append("max[latitude,longitude]=<strong>[") 221 .append(area.getMax().lat()).append( ",").append(area.getMax().lon()).append("]</strong>")221 .append(area.getMax().lat()).append(',').append(area.getMax().lon()).append("]</strong>") 222 222 .append("</html>"); 223 223 return sb.toString(); 224 224 -
org/openstreetmap/josm/gui/DefaultNameFormatter.java
172 172 } 173 173 174 174 if (n == null) { 175 n = node.isNew() ? tr("node") : ""+ node.getId();175 n = node.isNew() ? tr("node") : Long.toString(node.getId()); 176 176 } 177 177 name.append(n); 178 178 } else { 179 179 preset.nameTemplate.appendText(name, node); 180 180 } 181 181 if (node.getCoor() != null) { 182 name.append(" \u200E(").append(node.getCoor().latToString(CoordinateFormat.getDefaultFormat())).append(", ").append(node.getCoor().lonToString(CoordinateFormat.getDefaultFormat())).append( ")");182 name.append(" \u200E(").append(node.getCoor().latToString(CoordinateFormat.getDefaultFormat())).append(", ").append(node.getCoor().lonToString(CoordinateFormat.getDefaultFormat())).append(')'); 183 183 } 184 184 } 185 185 decorateNameWithId(name, node); … … 271 271 nevertheless, who knows what future brings */ 272 272 /* I18n: count of nodes as parameter */ 273 273 String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo); 274 name.append(" (").append(nodes).append( ")");274 name.append(" (").append(nodes).append(')'); 275 275 } 276 276 decorateNameWithId(name, way); 277 277 … … 319 319 name.append(", ").append(tr("incomplete")); 320 320 } 321 321 322 name.append( ")");322 name.append(')'); 323 323 } 324 324 decorateNameWithId(name, relation); 325 325 … … 340 340 if (relationName == null) { 341 341 relationName = Long.toString(relation.getId()); 342 342 } else { 343 relationName = "\"" + relationName + "\"";343 relationName = '"' + relationName + '"'; 344 344 } 345 345 result.append(" (").append(relationName).append(", "); 346 346 } else { 347 347 preset.nameTemplate.appendText(result, relation); 348 result.append( "(");348 result.append('('); 349 349 } 350 350 } 351 351 … … 434 434 } 435 435 String admin_level = relation.get("admin_level"); 436 436 if (admin_level != null) { 437 name += "["+admin_level+"]";437 name += '[' +admin_level+ ']'; 438 438 } 439 439 440 440 for (NameFormatterHook hook: formatHooks) { … … 509 509 sb.append("<strong>") 510 510 .append(key) 511 511 .append("</strong>") 512 .append( "=");512 .append('='); 513 513 String value = primitive.get(key); 514 514 while(value.length() != 0) { 515 515 sb.append(value.substring(0,Math.min(50, value.length()))); … … 565 565 .append(coord.latToString(CoordinateFormat.getDefaultFormat())) 566 566 .append(", ") 567 567 .append(coord.lonToString(CoordinateFormat.getDefaultFormat())) 568 .append( ")");568 .append(')'); 569 569 } 570 570 decorateNameWithId(sb, node); 571 571 return sb.toString(); … … 607 607 } 608 608 /* note: length == 0 should no longer happen, but leave the bracket code 609 609 nevertheless, who knows what future brings */ 610 sb.append((sb.length() > 0) ? " ("+nodes+ ")": nodes);610 sb.append((sb.length() > 0) ? " ("+nodes+ ')' : nodes); 611 611 decorateNameWithId(sb, way); 612 612 return sb.toString(); 613 613 } … … 647 647 if (nameTag == null) { 648 648 sb.append(Long.toString(relation.getId())).append(", "); 649 649 } else { 650 sb.append( "\"").append(nameTag).append("\", ");650 sb.append('"').append(nameTag).append("\", "); 651 651 } 652 652 653 653 int mbno = relation.getNumMembers(); 654 sb.append(trn("{0} member", "{0} members", mbno, mbno)).append( ")");654 sb.append(trn("{0} member", "{0} members", mbno, mbno)).append(')'); 655 655 656 656 decorateNameWithId(sb, relation); 657 657 return sb.toString(); … … 679 679 sb.append("<strong>") 680 680 .append(key) 681 681 .append("</strong>") 682 .append( "=");682 .append('='); 683 683 String value = primitive.get(key); 684 684 while(value.length() != 0) { 685 685 sb.append(value.substring(0,Math.min(50, value.length()))); -
org/openstreetmap/josm/gui/ExtendedDialog.java
572 572 * @return true if dialog should not be shown again 573 573 */ 574 574 private boolean toggleCheckState(String togglePref) { 575 toggleable = togglePref != null && !togglePref. equals("");575 toggleable = togglePref != null && !togglePref.isEmpty(); 576 576 577 577 toggleValue = Main.pref.getInteger("message."+togglePref+".value", -1); 578 578 // No identifier given, so return false (= show the dialog) -
org/openstreetmap/josm/gui/GettingStarted.java
156 156 String im = m.group(1); 157 157 URL u = getClass().getResource(im); 158 158 if (u != null) { 159 m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u.toString() + "\""));159 m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u.toString() + '"')); 160 160 } 161 161 } 162 162 m.appendTail(sb); -
org/openstreetmap/josm/gui/JosmUserIdentityManager.java
101 101 */ 102 102 public void setPartiallyIdentified(String userName) throws IllegalArgumentException { 103 103 CheckParameterUtil.ensureParameterNotNull(userName, "userName"); 104 if (userName.trim(). equals(""))104 if (userName.trim().isEmpty()) 105 105 throw new IllegalArgumentException(MessageFormat.format("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName)); 106 106 this.userName = userName; 107 107 userInfo = null; … … 119 119 */ 120 120 public void setFullyIdentified(String username, UserInfo userinfo) throws IllegalArgumentException { 121 121 CheckParameterUtil.ensureParameterNotNull(username, "username"); 122 if (username.trim(). equals(""))122 if (username.trim().isEmpty()) 123 123 throw new IllegalArgumentException(tr("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName)); 124 124 CheckParameterUtil.ensureParameterNotNull(userinfo, "userinfo"); 125 125 this.userName = username; … … 191 191 public void initFromPreferences() { 192 192 String userName = CredentialsManager.getInstance().getUsername(); 193 193 if (isAnonymous()) { 194 if (userName != null && ! userName.trim().equals("")) {194 if (userName != null && !userName.trim().isEmpty()) { 195 195 setPartiallyIdentified(userName); 196 196 } 197 197 } else { … … 254 254 } else if (evt.getKey().equals("osm-server.url")) { 255 255 if (!(evt.getNewValue() instanceof StringSetting)) return; 256 256 String newValue = ((StringSetting) evt.getNewValue()).getValue(); 257 if (newValue == null || newValue.trim(). equals("")) {257 if (newValue == null || newValue.trim().isEmpty()) { 258 258 setAnonymous(); 259 259 } else if (isFullyIdentified()) { 260 260 setPartiallyIdentified(getUserName()); -
org/openstreetmap/josm/gui/MainApplet.java
79 79 } 80 80 } 81 81 if (!args.containsKey("geometry") && getParameter("width") != null && getParameter("height") != null) { 82 args.put("geometry", Arrays.asList(new String[]{getParameter("width")+ "x"+getParameter("height")}));82 args.put("geometry", Arrays.asList(new String[]{getParameter("width")+ 'x' +getParameter("height")})); 83 83 } 84 84 } 85 85 … … 119 119 p.add(pass, GBC.eol().fill(GBC.HORIZONTAL)); 120 120 JOptionPane.showMessageDialog(null, p); 121 121 username = user.getText(); 122 if( "".equals(username))122 if(username != null && username.isEmpty()) 123 123 username = null; 124 124 password = new String(pass.getPassword()); 125 if( "".equals(password))125 if(password != null && password.isEmpty()) 126 126 password = null; 127 127 } 128 128 if (username != null && password != null) { -
org/openstreetmap/josm/gui/MainApplication.java
100 100 tr("usage")+":\n"+ 101 101 "\tjava -jar josm.jar <options>...\n\n"+ 102 102 tr("options")+":\n"+ 103 "\t--help|-h "+tr("Show this help")+ "\n"+104 "\t--geometry=widthxheight(+|-)x(+|-)y "+tr("Standard unix geometry argument")+ "\n"+105 "\t[--download=]minlat,minlon,maxlat,maxlon "+tr("Download the bounding box")+ "\n"+106 "\t[--download=]<URL> "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z)")+ "\n"+107 "\t[--download=]<filename> "+tr("Open a file (any file type that can be opened with File/Open)")+ "\n"+108 "\t--downloadgps=minlat,minlon,maxlat,maxlon "+tr("Download the bounding box as raw GPS")+ "\n"+109 "\t--downloadgps=<URL> "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS")+ "\n"+110 "\t--selection=<searchstring> "+tr("Select with the given search")+ "\n"+111 "\t--[no-]maximize "+tr("Launch in maximized mode")+ "\n"+103 "\t--help|-h "+tr("Show this help")+ '\n' + 104 "\t--geometry=widthxheight(+|-)x(+|-)y "+tr("Standard unix geometry argument")+ '\n' + 105 "\t[--download=]minlat,minlon,maxlat,maxlon "+tr("Download the bounding box")+ '\n' + 106 "\t[--download=]<URL> "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z)")+ '\n' + 107 "\t[--download=]<filename> "+tr("Open a file (any file type that can be opened with File/Open)")+ '\n' + 108 "\t--downloadgps=minlat,minlon,maxlat,maxlon "+tr("Download the bounding box as raw GPS")+ '\n' + 109 "\t--downloadgps=<URL> "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS")+ '\n' + 110 "\t--selection=<searchstring> "+tr("Select with the given search")+ '\n' + 111 "\t--[no-]maximize "+tr("Launch in maximized mode")+ '\n' + 112 112 "\t--reset-preferences "+tr("Reset the preferences to default")+"\n\n"+ 113 113 "\t--load-preferences=<url-to-xml> "+tr("Changes preferences according to the XML file")+"\n\n"+ 114 114 "\t--set=<key>=<value> "+tr("Set preference key to value")+"\n\n"+ … … 126 126 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+ 127 127 "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+ 128 128 "\tjava -Xmx400m -jar josm.jar\n\n"+ 129 tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+ "\n"+130 tr("Make sure you load some data if you use --selection.")+ "\n"129 tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+ '\n' + 130 tr("Make sure you load some data if you use --selection.")+ '\n' 131 131 ); 132 132 } 133 133 … … 180 180 los.add(new LongOpt(o.getName(), o.requiresArgument() ? LongOpt.REQUIRED_ARGUMENT : LongOpt.NO_ARGUMENT, null, 0)); 181 181 } 182 182 183 Getopt g = new Getopt("JOSM", args, "hv", los.toArray(new LongOpt[ 0]));183 Getopt g = new Getopt("JOSM", args, "hv", los.toArray(new LongOpt[los.size()])); 184 184 185 185 Map<Option, Collection<String>> argMap = new HashMap<Option, Collection<String>>(); 186 186 -
org/openstreetmap/josm/gui/MapStatus.java
535 535 // fix #7557 - do not show ID twice 536 536 537 537 if (!osm.isNew() && !idShown) { 538 text.append(" [id=" +osm.getId()+"]");538 text.append(" [id=").append(osm.getId()).append(']'); 539 539 } 540 540 541 541 if(osm.getUser() != null) { 542 text.append(" [" + tr("User:") + " " + osm.getUser().getName() + "]");542 text.append(" [").append(tr("User:")).append(' ').append(osm.getUser().getName()).append(']'); 543 543 } 544 544 545 545 for (String key : osm.keySet()) { 546 text.append("<br>" + key + "=" +osm.get(key));546 text.append("<br>").append(key).append('=').append(osm.get(key)); 547 547 } 548 548 549 549 final JLabel l = new JLabel( -
org/openstreetmap/josm/gui/MultiSplitLayout.java
1054 1054 int nChildren = getChildren().size(); 1055 1055 StringBuffer sb = new StringBuffer("MultiSplitLayout.Split"); 1056 1056 sb.append(isRowLayout() ? " ROW [" : " COLUMN ["); 1057 sb.append(nChildren + ((nChildren == 1) ? " child" : " children"));1057 sb.append(nChildren).append((nChildren == 1) ? " child" : " children"); 1058 1058 sb.append("] "); 1059 1059 sb.append(getBounds()); 1060 1060 return sb.toString(); … … 1110 1110 StringBuffer sb = new StringBuffer("MultiSplitLayout.Leaf"); 1111 1111 sb.append(" \""); 1112 1112 sb.append(getName()); 1113 sb.append( "\"");1113 sb.append('"'); 1114 1114 sb.append(" weight="); 1115 1115 sb.append(getWeight()); 1116 sb.append( " ");1116 sb.append(' '); 1117 1117 sb.append(getBounds()); 1118 1118 return sb.toString(); 1119 1119 } … … 1181 1181 } 1182 1182 } 1183 1183 else { 1184 throwParseException(st, "unrecognized attribute \"" + name + "\"");1184 throwParseException(st, "unrecognized attribute \"" + name + '"'); 1185 1185 } 1186 1186 } 1187 1187 … … 1243 1243 parseSplit(st, split); 1244 1244 } 1245 1245 else { 1246 throwParseException(st, "unrecognized node type '" + nodeType + "'");1246 throwParseException(st, "unrecognized node type '" + nodeType + '\''); 1247 1247 } 1248 1248 } 1249 1249 } -
org/openstreetmap/josm/gui/NavigatableComponent.java
1351 1351 * Return a ID which is unique as long as viewport dimensions are the same 1352 1352 */ 1353 1353 public int getViewID() { 1354 String x = center.east() + "_" + center.north() + "_" + scale + "_"+1355 getWidth() + "_" + getHeight() + "_"+ getProjection().toString();1354 String x = center.east() + "_" + center.north() + '_' + scale + '_' + 1355 getWidth() + '_' + getHeight() + '_' + getProjection().toString(); 1356 1356 java.util.zip.CRC32 id = new java.util.zip.CRC32(); 1357 1357 id.update(x.getBytes()); 1358 1358 return (int)id.getValue(); … … 1475 1475 if ((!lowerOnly && areaCustomValue > 0 && a > areaCustomValue / (aValue*aValue) && a < (bValue*bValue) / (aValue*aValue)) || customAreaOnly) 1476 1476 return formatText(area / areaCustomValue, areaCustomName); 1477 1477 else if (!lowerOnly && a >= (bValue*bValue) / (aValue*aValue)) 1478 return formatText(area / (bValue*bValue), bName+ "\u00b2");1478 return formatText(area / (bValue*bValue), bName+ '\u00b2'); 1479 1479 else if (a < 0.01) 1480 return "< 0.01 " + aName+ "\u00b2";1480 return "< 0.01 " + aName+ '\u00b2'; 1481 1481 else 1482 return formatText(a, aName+ "\u00b2");1482 return formatText(a, aName+ '\u00b2'); 1483 1483 } 1484 1484 1485 1485 private static String formatText(double v, String unit) { -
org/openstreetmap/josm/gui/SideButton.java
88 88 setActionCommand(name); 89 89 addActionListener(actionListener); 90 90 setToolTipText(tooltip); 91 putClientProperty("help", "Dialog/"+property+ "/"+name);91 putClientProperty("help", "Dialog/"+property+ '/' +name); 92 92 } 93 93 94 94 private void doStyle() -
org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
593 593 public boolean isValid() { 594 594 String value = getComponent().getText().trim(); 595 595 try { 596 if (value. equals("")) {596 if (value.isEmpty()) { 597 597 tileIndex = 0; 598 598 } else { 599 599 tileIndex = Integer.parseInt(value); … … 644 644 @Override 645 645 public String toString() { 646 646 StringBuffer sb = new StringBuffer(); 647 sb.append("min=").append(min.x).append( ",").append(min.y).append(",");648 sb.append("max=").append(max.x).append( ",").append(max.y).append(",");647 sb.append("min=").append(min.x).append(',').append(min.y).append(','); 648 sb.append("max=").append(max.x).append(',').append(max.y).append(','); 649 649 sb.append("zoom=").append(zoomLevel); 650 650 return sb.toString(); 651 651 } -
org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java
67 67 sb.append("<strong>") 68 68 .append(key) 69 69 .append("</strong>") 70 .append( "=");70 .append('='); 71 71 // make sure long values are split into several rows. Otherwise 72 72 // the tool tip window can become to wide 73 73 // -
org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
290 290 if (coord == null) 291 291 return tr("(none)"); 292 292 StringBuilder sb = new StringBuilder(); 293 sb.append( "(")293 sb.append('(') 294 294 .append(COORD_FORMATTER.format(coord.lat())) 295 .append( ",")295 .append(',') 296 296 .append(COORD_FORMATTER.format(coord.lon())) 297 .append( ")");297 .append(')'); 298 298 return sb.toString(); 299 299 } 300 300 -
org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
52 52 sb.append("<strong>") 53 53 .append(key) 54 54 .append("</strong>") 55 .append( "=");55 .append('='); 56 56 String value = primitive.get(key); 57 57 while(value.length() != 0) { 58 58 sb.append(value.substring(0,Math.min(50, value.length()))); -
org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
457 457 case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break; 458 458 case RELATION: msg = trn("{0} relation", "{0} relations", numPrimitives, numPrimitives); break; 459 459 } 460 text = text. equals("") ? msg : text + ", " + msg;460 text = text.isEmpty() ? msg : text + ", " + msg; 461 461 } 462 462 setText(text); 463 463 } -
org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
171 171 public Command buildTagApplyCommands(Collection<? extends OsmPrimitive> primitives) { 172 172 if (!cbTagRelations.isSelected()) 173 173 return null; 174 if (tfKey.getText().trim(). equals(""))174 if (tfKey.getText().trim().isEmpty()) 175 175 return null; 176 if (tfValue.getText().trim(). equals(""))176 if (tfValue.getText().trim().isEmpty()) 177 177 return null; 178 178 if (primitives == null || primitives.isEmpty()) 179 179 return null; -
org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
353 353 txtMappaint.append(tr("\n\nList of generated Styles:\n")); 354 354 StyleList sl = elemstyles.get(osm, scale, nc); 355 355 for (ElemStyle s : sl) { 356 txtMappaint.append(" * " + s + "\n");356 txtMappaint.append(" * " + s + '\n'); 357 357 } 358 358 txtMappaint.append("\n\n"); 359 359 } -
org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
58 58 private static final Pattern p = Pattern.compile( 59 59 "([+|-]?\\d+[.,]\\d+)|" // (1) 60 60 + "([+|-]?\\d+)|" // (2) 61 + "("+DEG+"|o|deg)|" // (3)61 + '(' +DEG+"|o|deg)|" // (3) 62 62 + "('|"+MIN+"|min)|" // (4) 63 63 + "(\"|"+SEC+"|sec)|" // (5) 64 64 + "(,|;)|" // (6) … … 179 179 ll = new LatLon(0,0); 180 180 } 181 181 this.latLonCoordinates = ll; 182 tfLatLon.setText(ll.latToString(CoordinateFormat.getDefaultFormat()) + " "+ ll.lonToString(CoordinateFormat.getDefaultFormat()));182 tfLatLon.setText(ll.latToString(CoordinateFormat.getDefaultFormat()) + ' ' + ll.lonToString(CoordinateFormat.getDefaultFormat())); 183 183 EastNorth en = Main.getProjection().latlon2eastNorth(ll); 184 184 tfEastNorth.setText(en.east()+" "+en.north()); 185 185 setOkEnabled(true); … … 353 353 } else if (m.group(6) != null) { 354 354 sb.append(','); // separator 355 355 } else if (m.group(7) != null) { 356 sb.append( "x"); // cardinal direction356 sb.append('x'); // cardinal direction 357 357 String c = m.group(7).toUpperCase(); 358 358 if (c.equals("N") || c.equals("S") || c.equals("E") || c.equals("W")) { 359 359 list.add(c); -
org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
668 668 BufferedReader reader = new BufferedReader(new InputStreamReader(is)); 669 669 String line; 670 670 while ((line = reader.readLine()) != null) { 671 txtSource.append(line + "\n");671 txtSource.append(line + '\n'); 672 672 } 673 673 } catch (IOException ex) { 674 674 txtSource.append("<ERROR: failed to read file!>"); … … 683 683 txtErrors.setEditable(false); 684 684 p.add(new JScrollPane(txtErrors), GBC.std().fill()); 685 685 for (Throwable t : s.getErrors()) { 686 txtErrors.append(t.toString() + "\n");686 txtErrors.append(t.toString() + '\n'); 687 687 } 688 688 } 689 689 } -
org/openstreetmap/josm/gui/dialogs/UserListDialog.java
214 214 protected String createInfoUrl(Object infoObject) { 215 215 User user = (User)infoObject; 216 216 try { 217 return getBaseUserUrl() + "/"+ URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20");217 return getBaseUserUrl() + '/' + URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20"); 218 218 } catch(UnsupportedEncodingException e) { 219 219 e.printStackTrace(); 220 220 JOptionPane.showMessageDialog( -
org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java
47 47 48 48 protected void renderUploadComment(Changeset cs) { 49 49 String comment = cs.get("comment"); 50 if (comment == null || comment.trim(). equals("")) {50 if (comment == null || comment.trim().isEmpty()) { 51 51 setText(trc("changeset.upload-comment", "empty")); 52 52 setFont(UIManager.getFont("Table.font").deriveFont(Font.ITALIC)); 53 53 } else { … … 68 68 69 69 protected void renderUser(Changeset cs) { 70 70 User user = cs.getUser(); 71 if (user == null || user.getName().trim(). equals("")) {71 if (user == null || user.getName().trim().isEmpty()) { 72 72 setFont(UIManager.getFont("Table.font").deriveFont(Font.ITALIC)); 73 73 setText(tr("anonymous")); 74 74 } else { -
org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java
40 40 sb.append(" - "); 41 41 sb.append(cs.isOpen() ? tr("open") : tr("closed")); 42 42 if (comment != null) { 43 sb.append(" - ").append( "'").append(comment).append("'");43 sb.append(" - ").append('\'').append(comment).append('\''); 44 44 } 45 45 } 46 46 setText(sb.toString()); -
org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
182 182 183 183 protected void validate() { 184 184 String value = tfUrl.getText(); 185 if (value.trim(). equals("")) {185 if (value.trim().isEmpty()) { 186 186 feedbackNone(); 187 187 return; 188 188 } -
org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
821 821 if (cur == last + 1) { 822 822 ++cnt; 823 823 } else if (cnt == 0) { 824 positionString += ","+ String.valueOf(cur);824 positionString += ',' + String.valueOf(cur); 825 825 } else { 826 positionString += "-"+ String.valueOf(last);827 positionString += ","+ String.valueOf(cur);826 positionString += '-' + String.valueOf(last); 827 positionString += ',' + String.valueOf(cur); 828 828 cnt = 0; 829 829 } 830 830 last = cur; 831 831 } 832 832 if (cnt >= 1) { 833 positionString += "-"+ String.valueOf(last);833 positionString += '-' + String.valueOf(last); 834 834 } 835 835 } 836 836 if (positionString.length() > 20) { … … 1048 1048 ((Relation)membershipData.getValueAt(row, 0)).get("type"), "UTF-8" 1049 1049 ); 1050 1050 1051 if (type != null && !type. equals("")) {1051 if (type != null && !type.isEmpty()) { 1052 1052 uris.add(new URI(String.format("%s%sRelation:%s", base, lang, type))); 1053 1053 uris.add(new URI(String.format("%sRelation:%s", base, type))); 1054 1054 } … … 1241 1241 } else if (p instanceof Relation) { 1242 1242 t = "type:relation "; 1243 1243 } 1244 s += sep + "(" + t + "\""+1244 s += sep + '(' + t + '"' + 1245 1245 org.openstreetmap.josm.actions.search.SearchAction.escapeStringForSearch(key) + "\"=\"" + 1246 1246 org.openstreetmap.josm.actions.search.SearchAction.escapeStringForSearch(val) + "\")"; 1247 1247 sep = " OR "; -
org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
337 337 String value = values.getEditor().getItem().toString().trim(); 338 338 // is not Java 1.5 339 339 //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC); 340 if (value. equals("")) {340 if (value.isEmpty()) { 341 341 value = null; // delete the key 342 342 } 343 343 String newkey = keys.getEditor().getItem().toString().trim(); 344 344 //newkey = java.text.Normalizer.normalize(newkey, java.text.Normalizer.Form.NFC); 345 if (newkey. equals("")) {345 if (newkey.isEmpty()) { 346 346 newkey = key; 347 347 value = null; // delete the key instead 348 348 } -
org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
1572 1572 } 1573 1573 1574 1574 protected boolean isEmptyRole() { 1575 return tfRole.getText() == null || tfRole.getText().trim(). equals("");1575 return tfRole.getText() == null || tfRole.getText().trim().isEmpty(); 1576 1576 } 1577 1577 1578 1578 protected boolean confirmSettingEmptyRole(int onNumMembers) { -
org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
86 86 87 87 @Override 88 88 public String toString() { 89 return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + "]";89 return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + ']'; 90 90 } 91 91 } 92 92 -
org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionType.java
69 69 public String toString() { 70 70 return "[P "+linkPrev+" ;N "+linkNext+" ;D "+direction+" ;L "+isLoop+ 71 71 " ;FP " + isOnewayLoopForwardPart+";BP " + isOnewayLoopBackwardPart+ 72 ";OH " + isOnewayHead+";OT " + isOnewayTail+ "]";72 ";OH " + isOnewayHead+";OT " + isOnewayTail+ ']'; 73 73 } 74 74 75 75 public String getToolTip() { -
org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
210 210 for (Entry<String, Set<TestError>> msgErrors : severityErrors.entrySet()) { 211 211 // Message node 212 212 Set<TestError> errs = msgErrors.getValue(); 213 String msg = msgErrors.getKey() + " (" + errs.size() + ")";213 String msg = msgErrors.getKey() + " (" + errs.size() + ')'; 214 214 DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 215 215 severityNode.add(messageNode); 216 216 … … 229 229 MultiMap<String, TestError> errorlist = bag.getValue(); 230 230 DefaultMutableTreeNode groupNode = null; 231 231 if (errorlist.size() > 1) { 232 String nmsg = bag.getKey() + " (" + errorlist.size() + ")";232 String nmsg = bag.getKey() + " (" + errorlist.size() + ')'; 233 233 groupNode = new DefaultMutableTreeNode(nmsg); 234 234 severityNode.add(groupNode); 235 235 if (oldSelectedRows.contains(bag.getKey())) { … … 242 242 Set<TestError> errs = msgErrors.getValue(); 243 243 String msg; 244 244 if (groupNode != null) { 245 msg = msgErrors.getKey() + " (" + errs.size() + ")";245 msg = msgErrors.getKey() + " (" + errs.size() + ')'; 246 246 } else { 247 msg = msgErrors.getKey() + " - " + bag.getKey() + " (" + errs.size() + ")";247 msg = msgErrors.getKey() + " - " + bag.getKey() + " (" + errs.size() + ')'; 248 248 } 249 249 DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 250 250 if (groupNode != null) { -
org/openstreetmap/josm/gui/download/BookmarkSelection.java
197 197 JOptionPane.QUESTION_MESSAGE) 198 198 ); 199 199 b.setArea(currentArea); 200 if (b.getName() != null && !b.getName(). equals("")) {200 if (b.getName() != null && !b.getName().isEmpty()) { 201 201 ((DefaultListModel)bookmarks.getModel()).addElement(b); 202 202 bookmarks.save(); 203 203 } -
org/openstreetmap/josm/gui/download/PlaceSelection.java
511 511 if (line.length() == 0) { 512 512 line.append(t); 513 513 } else if (line.length() < 80) { 514 line.append( " ").append(t);514 line.append(' ').append(t); 515 515 } else { 516 line.append( " ").append(t).append("<br>");516 line.append(' ').append(t).append("<br>"); 517 517 ret.append(line); 518 518 line = new StringBuffer(); 519 519 } -
org/openstreetmap/josm/gui/help/HelpBrowser.java
140 140 String line = null; 141 141 while ((line = reader.readLine()) != null) { 142 142 css.append(line); 143 css.append( "\n");143 css.append('\n'); 144 144 } 145 145 } catch(Exception e) { 146 146 System.err.println(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString())); … … 583 583 public void hyperlinkUpdate(HyperlinkEvent e) { 584 584 if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) 585 585 return; 586 if (e.getURL() == null || e.getURL().toString().startsWith(url+ "#")) {586 if (e.getURL() == null || e.getURL().toString().startsWith(url+ '#')) { 587 587 // Probably hyperlink event on a an A-element with a href consisting of 588 588 // a fragment only, i.e. "#ALocalFragment". 589 589 // -
org/openstreetmap/josm/gui/help/HelpUtil.java
118 118 String ret = LanguageInfo.getWikiLanguagePrefix(type); 119 119 if(ret == null) 120 120 return ret; 121 ret = "/"+ ret + Main.pref.get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading /;121 ret = '/' + ret + Main.pref.get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading /; 122 122 return ret.replaceAll("\\/+", "\\/"); // collapse sequences of // 123 123 } 124 124 … … 137 137 String prefix = getHelpTopicPrefix(type); 138 138 if (prefix == null || topic == null || topic.trim().length() == 0 || topic.trim().equals("/")) 139 139 return prefix; 140 prefix += "/"+ topic;140 prefix += '/' + topic; 141 141 return prefix.replaceAll("\\/+", "\\/"); // collapse sequences of // 142 142 } 143 143 -
org/openstreetmap/josm/gui/history/VersionInfoPanel.java
142 142 143 143 try { 144 144 if (getPrimitive().getUser() != null && getPrimitive().getUser() != User.getAnonymous()) { 145 url = AbstractInfoAction.getBaseUserUrl() + "/"+ URLEncoder.encode(getPrimitive().getUser().getName(), "UTF-8").replaceAll("\\+", "%20");145 url = AbstractInfoAction.getBaseUserUrl() + '/' + URLEncoder.encode(getPrimitive().getUser().getName(), "UTF-8").replaceAll("\\+", "%20"); 146 146 lblUser.setUrl(url); 147 147 } else { 148 148 lblUser.setUrl(null); … … 163 163 lblUser.setUrl(null); 164 164 } else { 165 165 try { 166 String url = AbstractInfoAction.getBaseUserUrl() + "/"+ URLEncoder.encode(user, "UTF-8").replaceAll("\\+", "%20");166 String url = AbstractInfoAction.getBaseUserUrl() + '/' + URLEncoder.encode(user, "UTF-8").replaceAll("\\+", "%20"); 167 167 lblUser.setUrl(url); 168 168 } catch(UnsupportedEncodingException e) { 169 169 e.printStackTrace(); -
org/openstreetmap/josm/gui/io/CredentialDialog.java
229 229 password = password == null ? "" : password; 230 230 tfUserName.setText(username); 231 231 tfPassword.setText(password); 232 cbSaveCredentials.setSelected(!username. equals("") && ! password.equals(""));232 cbSaveCredentials.setSelected(!username.isEmpty() && !password.isEmpty()); 233 233 } 234 234 235 235 public void startUserInput() { … … 298 298 tfPassword.setToolTipText(tr("Please enter the password for authenticating at your proxy server")); 299 299 lblHeading.setText( 300 300 "<html>" + tr("Authenticating at the HTTP proxy ''{0}'' failed. Please enter a valid username and a valid password.", 301 Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST) + ":"+ Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_PORT)) + "</html>");301 Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST) + ':' + Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_PORT)) + "</html>"); 302 302 lblWarning.setText("<html>" + tr("Warning: depending on the authentication method the proxy server uses the password may be transferred unencrypted.") + "</html>"); 303 303 } 304 304 -
org/openstreetmap/josm/gui/io/FilenameCellEditor.java
107 107 } 108 108 109 109 public boolean stopCellEditing() { 110 if (tfFileName.getText() == null || tfFileName.getText().trim(). equals("")) {110 if (tfFileName.getText() == null || tfFileName.getText().trim().isEmpty()) { 111 111 value = null; 112 112 } else { 113 113 value = new File(tfFileName.getText()); -
org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java
33 33 class LayerNameAndFilePathTableCell extends JPanel implements TableCellRenderer, TableCellEditor { 34 34 private final static Color colorError = new Color(255,197,197); 35 35 private final static String separator = System.getProperty("file.separator"); 36 private final static String ellipsis = "…"+ separator;36 private final static String ellipsis = '…' + separator; 37 37 38 38 private final JLabel lblLayerName = new JLabel(); 39 39 private final JLabel lblFilename = new JLabel(""); … … 216 216 } 217 217 218 218 public boolean stopCellEditing() { 219 if (tfFilename.getText() == null || tfFilename.getText().trim(). equals("")) {219 if (tfFilename.getText() == null || tfFilename.getText().trim().isEmpty()) { 220 220 value = null; 221 221 } else { 222 222 value = new File(tfFilename.getText()); -
org/openstreetmap/josm/gui/io/TagSettingsPanel.java
55 55 if (comment.equals(commentInTag)) 56 56 return; 57 57 58 if (comment. equals("")) {58 if (comment.isEmpty()) { 59 59 pnlTagEditor.getModel().delete("comment"); 60 60 return; 61 61 } … … 88 88 if (created_by == null || created_by.isEmpty()) { 89 89 tags.put("created_by", agent); 90 90 } else if (!created_by.contains(agent)) { 91 tags.put("created_by", created_by + ";"+ agent);91 tags.put("created_by", created_by + ';' + agent); 92 92 } 93 93 pnlTagEditor.getModel().initFromTags(tags); 94 94 } -
org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
47 47 uploadComment 48 48 )); 49 49 } 50 msg.append( " ");50 msg.append(' '); 51 51 if (closeChangesetAfterNextUpload) { 52 52 msg.append(tr("The changeset is going to be <strong>closed</strong> after this upload")); 53 53 } else { 54 54 msg.append(tr("The changeset is <strong>left open</strong> after this upload")); 55 55 } 56 msg.append(" (<a href=\"urn:changeset-configuration\">" + tr("configure changeset") +"</a>)");56 msg.append(" (<a href=\"urn:changeset-configuration\">").append(tr("configure changeset")).append("</a>)"); 57 57 return msg.toString(); 58 58 } 59 59 … … 116 116 f.isBold() ? "bold" : "normal", 117 117 f.isItalic() ? "italic" : "normal" 118 118 ); 119 rule = "body {" + rule + "}";119 rule = "body {" + rule + '}'; 120 120 rule = MessageFormat.format( 121 121 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}", 122 122 f.getName(), … … 124 124 "bold", 125 125 f.isItalic() ? "italic" : "normal" 126 126 ); 127 rule = "strong {" + rule + "}";127 rule = "strong {" + rule + '}'; 128 128 ss.addRule(rule); 129 129 ss.addRule("a {text-decoration: underline; color: blue}"); 130 130 JosmHTMLEditorKit kit = new JosmHTMLEditorKit(); -
org/openstreetmap/josm/gui/layer/GpxLayer.java
152 152 153 153 if (earliestDate.equals(latestDate)) { 154 154 DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT); 155 ts += earliestDate + " ";155 ts += earliestDate + ' '; 156 156 ts += tf.format(bounds[0]) + " - " + tf.format(bounds[1]); 157 157 } else { 158 158 DateFormat dtf = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); … … 183 183 } 184 184 185 185 if (data.tracks.size() > 0) { 186 info.append("<table><thead align='center'><tr><td colspan='5'>" 187 + trn("{0} track", "{0} tracks", data.tracks.size(), data.tracks.size()) 188 + "</td></tr><tr align='center'><td>" + tr("Name") + "</td><td>" 189 + tr("Description") + "</td><td>" + tr("Timespan") 190 + "</td><td>" + tr("Length") + "</td><td>" + tr("URL") 191 + "</td></tr></thead>"); 186 info.append("<table><thead align='center'><tr><td colspan='5'>") 187 .append(trn("{0} track", "{0} tracks", data.tracks.size(), data.tracks.size())) 188 .append("</td></tr><tr align='center'><td>").append(tr("Name")).append("</td><td>") 189 .append(tr("Description")).append("</td><td>").append(tr("Timespan")).append("</td><td>") 190 .append(tr("Length")).append("</td><td>").append(tr("URL")).append("</td></tr></thead>"); 192 191 193 192 for (GpxTrack trk : data.tracks) { 194 193 info.append("<tr><td>"); … … 197 196 } 198 197 info.append("</td><td>"); 199 198 if (trk.getAttributes().containsKey("desc")) { 200 info.append( " ").append(trk.getAttributes().get("desc"));199 info.append(' ').append(trk.getAttributes().get("desc")); 201 200 } 202 201 info.append("</td><td>"); 203 202 info.append(getTimespanForTrack(trk)); -
org/openstreetmap/josm/gui/layer/ImageryLayer.java
133 133 panel.add(new UrlLabel(url), GBC.eol().insets(2, 5, 10, 0)); 134 134 } 135 135 if (dx != 0.0 || dy != 0.0) { 136 panel.add(new JLabel(tr("Offset: ") + dx + ";"+ dy), GBC.eol().insets(0, 5, 10, 0));136 panel.add(new JLabel(tr("Offset: ") + dx + ';' + dy), GBC.eol().insets(0, 5, 10, 0)); 137 137 } 138 138 } 139 139 return panel; -
org/openstreetmap/josm/gui/layer/OsmDataLayer.java
460 460 461 461 String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes); 462 462 if (counter.deletedNodes > 0) { 463 nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+ ")";463 nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+ ')'; 464 464 } 465 465 466 466 String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways); 467 467 if (counter.deletedWays > 0) { 468 wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+ ")";468 wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+ ')'; 469 469 } 470 470 471 471 String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations); 472 472 if (counter.deletedRelations > 0) { 473 relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+ ")";473 relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+ ')'; 474 474 } 475 475 476 476 p.add(new JLabel(tr("{0} consists of:", getName())), GBC.eol()); … … 523 523 new ConsistencyTestAction(), 524 524 SeparatorLayerAction.INSTANCE, 525 525 new LayerListPopup.InfoAction(this)})); 526 return actions.toArray(new Action[ 0]);526 return actions.toArray(new Action[actions.size()]); 527 527 } 528 528 529 529 public static GpxData toGpxData(DataSet data, File file) { -
org/openstreetmap/josm/gui/layer/WMSLayer.java
953 953 for (int i=0; i<threadCount; i++) { 954 954 Grabber grabber = getGrabber(i == 0 && threadCount > 1); 955 955 grabbers.add(grabber); 956 Thread t = new Thread(grabber, "WMS " + getName() + " "+ i);956 Thread t = new Thread(grabber, "WMS " + getName() + ' ' + i); 957 957 t.setDaemon(true); 958 958 t.start(); 959 959 grabberThreads.add(t); -
org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
193 193 x.printStackTrace(); 194 194 JOptionPane.showMessageDialog( 195 195 Main.parent, 196 tr("Could not read \"{0}\"",sel.getName())+ "\n"+x.getMessage(),196 tr("Could not read \"{0}\"",sel.getName())+ '\n' +x.getMessage(), 197 197 tr("Error"), 198 198 JOptionPane.ERROR_MESSAGE 199 199 ); … … 898 898 ? (int)Math.floor(tz/2) + ":00" 899 899 : (int)Math.floor(tz/2) + ":30"; 900 900 if(sldTimezone.getValue() < 0) { 901 zone = "-"+ zone;901 zone = '-' + zone; 902 902 } 903 903 904 904 lblTimezone.setText(tr("Timezone: {0}", zone)); -
org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
300 300 entries.add(SeparatorLayerAction.INSTANCE); 301 301 entries.add(new LayerListPopup.InfoAction(this)); 302 302 303 return entries.toArray(new Action[ 0]);303 return entries.toArray(new Action[entries.size()]); 304 304 305 305 } 306 306 … … 311 311 i++; 312 312 } 313 313 return trn("{0} image loaded.", "{0} images loaded.", data.size(), data.size()) 314 + " "+ trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", i, i);314 + ' ' + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", i, i); 315 315 } 316 316 317 317 @Override public Object getInfoComponent() { -
org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
529 529 int ascent = metrics.getAscent(); 530 530 Color bkground = new Color(255, 255, 255, 128); 531 531 int lastPos = 0; 532 int pos = osdText.indexOf( "\n");532 int pos = osdText.indexOf('\n'); 533 533 int x = 3; 534 534 int y = 3; 535 535 String line; … … 542 542 g.drawString(line, x, y + ascent); 543 543 y += (int) lineSize.getHeight(); 544 544 lastPos = pos + 1; 545 pos = osdText.indexOf( "\n", lastPos);545 pos = osdText.indexOf('\n', lastPos); 546 546 } 547 547 548 548 line = osdText.substring(lastPos); -
org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
65 65 } 66 66 67 67 private BufferedImage loadThumb(ImageEntry entry) { 68 final String cacheIdent = entry.getFile().toString() +":"+maxSize;68 final String cacheIdent = entry.getFile().toString() + ':' + maxSize; 69 69 70 70 if (!cacheOff) { 71 71 BufferedImage cached = cache.getImg(cacheIdent); -
org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
248 248 (startTime - w1.time) / (w2.time - w1.time))); 249 249 wayPointFromTimeStamp.time = startTime; 250 250 String name = wavFile.getName(); 251 int dot = name.lastIndexOf( ".");251 int dot = name.lastIndexOf('.'); 252 252 if (dot > 0) { 253 253 name = name.substring(0, dot); 254 254 } -
org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
103 103 public static TemplateEntryProperty forMarker(String layerName) { 104 104 String key = "draw.rawgps.layer.wpt.pattern"; 105 105 if (layerName != null) { 106 key += "."+ layerName;106 key += '.' + layerName; 107 107 } 108 108 TemplateEntryProperty result = cache.get(key); 109 109 if (result == null) { … … 122 122 public static TemplateEntryProperty forAudioMarker(String layerName) { 123 123 String key = "draw.rawgps.layer.audiowpt.pattern"; 124 124 if (layerName != null) { 125 key += "."+ layerName;125 key += '.' + layerName; 126 126 } 127 127 TemplateEntryProperty result = cache.get(key); 128 128 if (result == null) { -
org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
251 251 components.add(new RenameLayerAction(getAssociatedFile(), this)); 252 252 components.add(SeparatorLayerAction.INSTANCE); 253 253 components.add(new LayerListPopup.InfoAction(this)); 254 return components.toArray(new Action[ 0]);254 return components.toArray(new Action[components.size()]); 255 255 } 256 256 257 257 public boolean synchronizeAudioMarkers(AudioMarker startMarker) { -
org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java
37 37 JOptionPane.showMessageDialog(Main.parent, 38 38 "<html><b>" + 39 39 tr("There was an error while trying to display the URL for this marker") + 40 "</b><br>" + tr("(URL was: ") + webUrl.toString() + ")"+ "<br>" + error,40 "</b><br>" + tr("(URL was: ") + webUrl.toString() + ')' + "<br>" + error, 41 41 tr("Error displaying URL"), JOptionPane.ERROR_MESSAGE); 42 42 } 43 43 } -
org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java
222 222 223 223 @Override 224 224 public String toString() { 225 return "BoxTextElemStyle{" + super.toString() + " "+ text.toStringImpl() + " box=" + box + " hAlign=" + hAlign + " vAlign=" + vAlign + '}';225 return "BoxTextElemStyle{" + super.toString() + ' ' + text.toStringImpl() + " box=" + box + " hAlign=" + hAlign + " vAlign=" + vAlign + '}'; 226 226 } 227 227 228 228 } -
org/openstreetmap/josm/gui/mappaint/Cascade.java
192 192 public String toString() { 193 193 StringBuilder res = new StringBuilder("Cascade{ "); 194 194 for (String key : prop.keySet()) { 195 res.append(key +":");195 res.append(key).append(':'); 196 196 Object val = prop.get(key); 197 197 if (val instanceof float[]) { 198 198 res.append(Arrays.toString((float[]) val)); 199 199 } else if (val instanceof Color) { 200 200 res.append(Utils.toString((Color)val)); 201 201 } else { 202 res.append(val +"");202 res.append(val); 203 203 } 204 204 res.append("; "); 205 205 } 206 return res.append( "}").toString();206 return res.append('}').toString(); 207 207 } 208 208 209 209 public boolean containsKey(String key) { -
org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategy.java
63 63 64 64 @Override 65 65 public String toString() { 66 return "{" + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + "}";66 return '{' + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + '}'; 67 67 } 68 68 69 69 @Override … … 118 118 119 119 @Override 120 120 public String toString() { 121 return "{" + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + "}";121 return '{' + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + '}'; 122 122 } 123 123 124 124 @Override … … 240 240 241 241 @Override 242 242 public String toString() { 243 return "{" + getClass().getSimpleName() +"}";243 return '{' + getClass().getSimpleName() + '}'; 244 244 } 245 245 } 246 246 } -
org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java
52 52 53 53 @Override 54 54 public String toString() { 55 return "LineTextElemStyle{" + super.toString() + "text=" + text + "}";55 return "LineTextElemStyle{" + super.toString() + "text=" + text + '}'; 56 56 } 57 57 58 58 } -
org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
164 164 for(String fileset : prefIconDirs) 165 165 { 166 166 String[] a; 167 if(fileset.indexOf( "=") >= 0) {167 if(fileset.indexOf('=') >= 0) { 168 168 a = fileset.split("=", 2); 169 169 } else { 170 170 a = new String[] {"", fileset}; -
org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
347 347 StringBuilder s = new StringBuilder("NodeElemStyle{"); 348 348 s.append(super.toString()); 349 349 if (mapImage != null) { 350 s.append(" icon=[" + mapImage + "]");350 s.append(" icon=[").append(mapImage).append(']'); 351 351 } 352 352 if (symbol != null) { 353 s.append(" symbol=[" + symbol + "]");353 s.append(" symbol=[").append(symbol).append(']'); 354 354 } 355 355 s.append('}'); 356 356 return s.toString(); -
org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java
91 91 public String toString() { 92 92 return "RepeatImageStyle{" + super.toString() + "pattern=[" + pattern + 93 93 "], offset=" + offset + ", spacing=" + spacing + 94 ", phase=" + (-phase) + ", align=" + align + "}";94 ", phase=" + (-phase) + ", align=" + align + '}'; 95 95 } 96 96 } -
org/openstreetmap/josm/gui/mappaint/TextElement.java
177 177 178 178 protected String toStringImpl() { 179 179 StringBuilder sb = new StringBuilder(); 180 sb.append("labelCompositionStrategy=" +labelCompositionStrategy);181 sb.append(" font=" +font);180 sb.append("labelCompositionStrategy=").append(labelCompositionStrategy); 181 sb.append(" font=").append(font); 182 182 if (xOffset != 0) { 183 sb.append(" xOffset=" +xOffset);183 sb.append(" xOffset=").append(xOffset); 184 184 } 185 185 if (yOffset != 0) { 186 sb.append(" yOffset=" +yOffset);186 sb.append(" yOffset=").append(yOffset); 187 187 } 188 sb.append(" color=" +Utils.toString(color));188 sb.append(" color=").append(Utils.toString(color)); 189 189 if (haloRadius != null) { 190 sb.append(" haloRadius=" +haloRadius);191 sb.append(" haloColor=" +haloColor);190 sb.append(" haloRadius=").append(haloRadius); 191 sb.append(" haloColor=").append(haloColor); 192 192 } 193 193 return sb.toString(); 194 194 } -
org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
163 163 164 164 @Override 165 165 public String toString() { 166 return "[" + k + "'" + op + "'" + v + "]";166 return '[' + k + '\'' + op + '\'' + v + ']'; 167 167 } 168 168 } 169 169 … … 251 251 252 252 @Override 253 253 public String toString() { 254 return "[" + (exclamationMarkPresent ? "!" : "") + label + "]";254 return '[' + (exclamationMarkPresent ? "!" : "") + label + ']'; 255 255 } 256 256 } 257 257 … … 290 290 291 291 @Override 292 292 public String toString() { 293 return ":"+ (not ? "!" : "") + id;293 return ':' + (not ? "!" : "") + id; 294 294 } 295 295 } 296 296 … … 310 310 311 311 @Override 312 312 public String toString() { 313 return "[" + e + "]";313 return "[" + e + ']'; 314 314 } 315 315 } 316 316 } -
org/openstreetmap/josm/gui/mappaint/mapcss/LiteralExpression.java
27 27 if (literal instanceof float[]) { 28 28 return Arrays.toString((float[]) literal); 29 29 } 30 return "<" + literal.toString() + ">";30 return '<' + literal.toString() + '>'; 31 31 } 32 32 33 33 } -
org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
192 192 193 193 @Override 194 194 public String toString() { 195 return left +" "+ (parentSelector? "<" : ">")+link+ " "+right;195 return left +" "+ (parentSelector? "<" : ">")+link+ ' ' +right; 196 196 } 197 197 } 198 198 -
org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java
22 22 public String getKey() 23 23 { 24 24 if(value != null) 25 return "n" + key + "="+ value;25 return 'n' + key + '=' + value; 26 26 else if(boolValue != null) 27 return "b" + key + "="+ OsmUtils.getNamedOsmBoolean(boolValue);27 return 'b' + key + '=' + OsmUtils.getNamedOsmBoolean(boolValue); 28 28 else 29 return "x"+ key;29 return 'x' + key; 30 30 } 31 31 public void init() 32 32 { … … 35 35 36 36 public String toString() 37 37 { 38 return "Rule["+key+ ","+(boolValue != null ? "b="+boolValue:"v="+value)+"]";38 return "Rule["+key+ ',' +(boolValue != null ? "b="+boolValue:"v="+value)+ ']'; 39 39 } 40 40 public String toCode() 41 41 { 42 return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+ "]";42 return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+ ']'; 43 43 } 44 44 } -
org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
142 142 for (String key : primitive.keySet()) { 143 143 String val = primitive.get(key); 144 144 IconPrototype p; 145 if ((p = icons.get( "n" + key + "="+ val)) != null) {145 if ((p = icons.get('n' + key + '=' + val)) != null) { 146 146 icon = update(icon, p, scale, mc); 147 147 } 148 if ((p = icons.get( "b" + key + "="+ OsmUtils.getNamedOsmBoolean(val))) != null) {148 if ((p = icons.get('b' + key + '=' + OsmUtils.getNamedOsmBoolean(val))) != null) { 149 149 icon = update(icon, p, scale, mc); 150 150 } 151 if ((p = icons.get( "x"+ key)) != null) {151 if ((p = icons.get('x' + key)) != null) { 152 152 icon = update(icon, p, scale, mc); 153 153 } 154 154 } … … 175 175 AreaPrototype styleArea; 176 176 LinePrototype styleLine; 177 177 LinemodPrototype styleLinemod; 178 String idx = "n" + key + "="+ val;178 String idx = 'n' + key + '=' + val; 179 179 if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) { 180 180 p.area = update(p.area, styleArea, scale, mc); 181 181 } … … 190 190 overlayMap.put(idx, styleLinemod); 191 191 } 192 192 } 193 idx = "b" + key + "="+ OsmUtils.getNamedOsmBoolean(val);193 idx = 'b' + key + '=' + OsmUtils.getNamedOsmBoolean(val); 194 194 if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) { 195 195 p.area = update(p.area, styleArea, scale, mc); 196 196 } … … 205 205 overlayMap.put(idx, styleLinemod); 206 206 } 207 207 } 208 idx = "x"+ key;208 idx = 'x' + key; 209 209 if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) { 210 210 p.area = update(p.area, styleArea, scale, mc); 211 211 } -
org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
51 51 52 52 Color convertColor(String colString) 53 53 { 54 int i = colString.indexOf( "#");54 int i = colString.indexOf('#'); 55 55 Color ret; 56 56 if (i < 0) { 57 ret = Main.pref.getColor("mappaint."+style.getPrefName()+ "."+colString, Color.red);57 ret = Main.pref.getColor("mappaint."+style.getPrefName()+ '.' +colString, Color.red); 58 58 } else if(i == 0) { 59 59 ret = ColorHelper.html2color(colString); 60 60 } else { 61 ret = Main.pref.getColor("mappaint."+style.getPrefName()+ "."+colString.substring(0,i),61 ret = Main.pref.getColor("mappaint."+style.getPrefName()+ '.' +colString.substring(0,i), 62 62 ColorHelper.html2color(colString.substring(i))); 63 63 } 64 64 return ret; … … 73 73 } 74 74 75 75 private void error(String message) { 76 String warning = style.getDisplayString() + " (" + rule.cond.key + "="+ rule.cond.value + "): " + message;76 String warning = style.getDisplayString() + " (" + rule.cond.key + '=' + rule.cond.value + "): " + message; 77 77 System.err.println(warning); 78 78 style.logError(new Exception(warning)); 79 79 } -
org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java
182 182 183 183 @Override 184 184 public boolean isValid() { 185 return ! getComponent().getText().trim().equals("");185 return !getComponent().getText().trim().isEmpty(); 186 186 } 187 187 188 188 @Override … … 202 202 203 203 @Override 204 204 public boolean isValid() { 205 return ! getComponent().getText().trim().equals("");205 return !getComponent().getText().trim().isEmpty(); 206 206 } 207 207 208 208 @Override -
org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
205 205 // OSM is an OAuth 1.0 provider and JOSM isn't a web app. We just add the oauth request token to 206 206 // the authorisation request, no callback parameter. 207 207 // 208 sb.append(oauthProviderParameters.getAuthoriseUrl()).append( "?")209 .append(OAuth.OAUTH_TOKEN).append( "=").append(requestToken.getKey());208 sb.append(oauthProviderParameters.getAuthoriseUrl()).append('?') 209 .append(OAuth.OAUTH_TOKEN).append('=').append(requestToken.getKey()); 210 210 return sb.toString(); 211 211 } 212 212 … … 266 266 Entry<String,String> entry = it.next(); 267 267 String value = entry.getValue(); 268 268 value = (value == null) ? "" : value; 269 sb.append(entry.getKey()).append( "=").append(URLEncoder.encode(value, "UTF-8"));269 sb.append(entry.getKey()).append('=').append(URLEncoder.encode(value, "UTF-8")); 270 270 if (it.hasNext()) { 271 sb.append( "&");271 sb.append('&'); 272 272 } 273 273 } 274 274 return sb.toString(); -
org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java
91 91 92 92 // remove trailing slashes 93 93 while(url.endsWith("/")) { 94 url = url.substring(0, url.lastIndexOf( "/"));94 url = url.substring(0, url.lastIndexOf('/')); 95 95 } 96 96 return url; 97 97 } -
org/openstreetmap/josm/gui/preferences/PluginPreference.java
77 77 )); 78 78 sb.append("<ul>"); 79 79 for(PluginInformation pi: downloaded) { 80 sb.append("<li>").append(pi.name).append(" (").append(pi.version).append( ")").append("</li>");80 sb.append("<li>").append(pi.name).append(" (").append(pi.version).append(')').append("</li>"); 81 81 } 82 82 sb.append("</ul>"); 83 83 } … … 427 427 class SearchFieldAdapter implements DocumentListener { 428 428 public void filter() { 429 429 String expr = tfFilter.getText().trim(); 430 if (expr. equals("")) {430 if (expr.isEmpty()) { 431 431 expr = null; 432 432 } 433 433 model.filterDisplayedPlugins(expr); -
org/openstreetmap/josm/gui/preferences/SourceEditor.java
1064 1064 data, 1065 1065 new Comparator<String>() { 1066 1066 public int compare(String o1, String o2) { 1067 if (o1. equals("") && o2.equals(""))1067 if (o1.isEmpty() && o2.isEmpty()) 1068 1068 return 0; 1069 if (o1. equals("")) return 1;1070 if (o2. equals("")) return -1;1069 if (o1.isEmpty()) return 1; 1070 if (o2.isEmpty()) return -1; 1071 1071 return o1.compareTo(o2); 1072 1072 } 1073 1073 } … … 1216 1216 ExtendedSourceEntry last = null; 1217 1217 1218 1218 while ((line = reader.readLine()) != null && !canceled) { 1219 if (line.trim(). equals("")) {1219 if (line.trim().isEmpty()) { 1220 1220 continue; // skip empty lines 1221 1221 } 1222 1222 if (line.startsWith("\t")) { -
org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
348 348 p.removeAll(); 349 349 for (File f: new File(".").listFiles()) { 350 350 String s = f.getName(); 351 int idx = s.indexOf( "_");351 int idx = s.indexOf('_'); 352 352 if (idx>=0) { 353 353 String t=s.substring(0,idx); 354 354 System.out.println(t); … … 358 358 } 359 359 for (File f: Main.pref.getPreferencesDirFile().listFiles()) { 360 360 String s = f.getName(); 361 int idx = s.indexOf( "_");361 int idx = s.indexOf('_'); 362 362 if (idx>=0) { 363 363 String t=s.substring(0,idx); 364 364 if (profileTypes.containsKey(t)) -
org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java
69 69 File sel = fc.getSelectedFile(); 70 70 if (!sel.getName().endsWith(".xml")) sel=new File(sel.getAbsolutePath()+".xml"); 71 71 if (!sel.getName().startsWith(schemaKey)) { 72 System.out.println(sel.getParentFile().getAbsolutePath()+ "/"+schemaKey+"_"+sel.getName());73 sel =new File(sel.getParentFile().getAbsolutePath()+ "/"+schemaKey+"_"+sel.getName());72 System.out.println(sel.getParentFile().getAbsolutePath()+ '/' +schemaKey+ '_' +sel.getName()); 73 sel =new File(sel.getParentFile().getAbsolutePath()+ '/' +schemaKey+ '_' +sel.getName()); 74 74 } 75 75 return sel; 76 76 } -
org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanel.java
67 67 StringBuilder a = new StringBuilder("tms"); 68 68 String z = sanitize(tmsZoom.getText()); 69 69 if (!z.isEmpty()) { 70 a.append( "[").append(z).append("]");70 a.append('[').append(z).append(']'); 71 71 } 72 a.append( ":");72 a.append(':'); 73 73 a.append(getImageryRawUrl()); 74 74 return a.toString(); 75 75 } -
org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
44 44 45 45 protected String formatPluginRemoteVersion(PluginInformation pi) { 46 46 StringBuilder sb = new StringBuilder(); 47 if (pi.version == null || pi.version.trim(). equals("")) {47 if (pi.version == null || pi.version.trim().isEmpty()) { 48 48 sb.append(tr("unknown")); 49 49 } else { 50 50 sb.append(pi.version); 51 51 if (pi.oldmode) { 52 sb.append( "*");52 sb.append('*'); 53 53 } 54 54 } 55 55 return sb.toString(); … … 57 57 58 58 protected String formatPluginLocalVersion(PluginInformation pi) { 59 59 if (pi == null) return tr("unknown"); 60 if (pi.localversion == null || pi.localversion.trim(). equals(""))60 if (pi.localversion == null || pi.localversion.trim().isEmpty()) 61 61 return tr("unknown"); 62 62 return pi.localversion; 63 63 } -
org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
162 162 163 163 private JComponent build() { 164 164 StringBuilder s = new StringBuilder(); 165 s.append("<b>+proj=...</b> - <i>" +tr("Projection name")+"</i><br>");166 s.append(" " +tr("Supported values:")+" ");167 s.append(listKeys(Projections.projs) +"<br>");168 s.append("<b>+lat_0=..., +lat_1=..., +lat_2=...</b> - <i>" +tr("Projection parameters")+"</i><br>");169 s.append("<b>+x_0=..., +y_0=...</b> - <i>" +tr("False easting and false northing")+"</i><br>");170 s.append("<b>+lon_0=...</b> - <i>" +tr("Central meridian")+"</i><br>");171 s.append("<b>+k_0=...</b> - <i>" +tr("Scaling factor")+"</i><br>");172 s.append("<b>+ellps=...</b> - <i>" +tr("Ellipsoid name")+"</i><br>");173 s.append(" " +tr("Supported values:")+" ");174 s.append(listKeys(Projections.ellipsoids) +"<br>");175 s.append("<b>+a=..., +b=..., +rf=..., +f=..., +es=...</b> - <i>" +tr("Ellipsoid parameters")+"</i><br>");176 s.append("<b>+datum=...</b> - <i>" +tr("Datum name")+"</i><br>");177 s.append(" " +tr("Supported values:")+" ");178 s.append(listKeys(Projections.datums) +"<br>");179 s.append("<b>+towgs84=...</b> - <i>" +tr("3 or 7 term datum transform parameters")+"</i><br>");180 s.append("<b>+nadgrids=...</b> - <i>" +tr("NTv2 grid file")+"</i><br>");181 s.append(" " +tr("Built-in:")+" ");182 s.append(listKeys(Projections.nadgrids) +"<br>");183 s.append("<b>+bounds=</b>minlon,minlat,maxlon,maxlat - <i>" +tr("Projection bounds (in degrees)")+"</i><br>");165 s.append("<b>+proj=...</b> - <i>").append(tr("Projection name")).append("</i><br>"); 166 s.append(" ").append(tr("Supported values:")).append(' '); 167 s.append(listKeys(Projections.projs)).append("<br>"); 168 s.append("<b>+lat_0=..., +lat_1=..., +lat_2=...</b> - <i>").append(tr("Projection parameters")).append("</i><br>"); 169 s.append("<b>+x_0=..., +y_0=...</b> - <i>").append(tr("False easting and false northing")).append("</i><br>"); 170 s.append("<b>+lon_0=...</b> - <i>").append(tr("Central meridian")).append("</i><br>"); 171 s.append("<b>+k_0=...</b> - <i>").append(tr("Scaling factor")).append("</i><br>"); 172 s.append("<b>+ellps=...</b> - <i>").append(tr("Ellipsoid name")).append("</i><br>"); 173 s.append(" ").append(tr("Supported values:")).append(' '); 174 s.append(listKeys(Projections.ellipsoids)).append("<br>"); 175 s.append("<b>+a=..., +b=..., +rf=..., +f=..., +es=...</b> - <i>").append(tr("Ellipsoid parameters")).append("</i><br>"); 176 s.append("<b>+datum=...</b> - <i>").append(tr("Datum name")).append("</i><br>"); 177 s.append(" ").append(tr("Supported values:")).append(' '); 178 s.append(listKeys(Projections.datums)).append("<br>"); 179 s.append("<b>+towgs84=...</b> - <i>").append(tr("3 or 7 term datum transform parameters")).append("</i><br>"); 180 s.append("<b>+nadgrids=...</b> - <i>").append(tr("NTv2 grid file")).append("</i><br>"); 181 s.append(" ").append(tr("Built-in:")).append(' '); 182 s.append(listKeys(Projections.nadgrids)).append("<br>"); 183 s.append("<b>+bounds=</b>minlon,minlat,maxlon,maxlat - <i>").append(tr("Projection bounds (in degrees)")).append("</i><br>"); 184 184 185 185 HtmlPanel info = new HtmlPanel(s.toString()); 186 186 return info; -
org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
109 109 projections.add("EPSG:" + (32600 + zone + (hemisphere == Hemisphere.South?100:0))); 110 110 } 111 111 } 112 return projections.toArray(new String[ 0]);112 return projections.toArray(new String[projections.size()]); 113 113 } 114 114 115 115 @Override … … 133 133 Hemisphere hemisphere = DEFAULT_HEMISPHERE; 134 134 135 135 if(args != null) { 136 String[] array = args.toArray(new String[ 0]);136 String[] array = args.toArray(new String[args.size()]); 137 137 138 138 if (array.length > 1) { 139 139 hemisphere = Hemisphere.valueOf(array[1]); -
org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
156 156 protected String getNormalizedApiUrl() { 157 157 String apiUrl = url.trim(); 158 158 while(apiUrl.endsWith("/")) { 159 apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf( "/"));159 apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf('/')); 160 160 } 161 161 return apiUrl; 162 162 } … … 196 196 bin = new BufferedReader(new InputStreamReader(connection.getInputStream())); 197 197 String line; 198 198 while ((line = bin.readLine()) != null) { 199 changesets.append(line).append( "\n");199 changesets.append(line).append('\n'); 200 200 } 201 201 if (! (changesets.toString().contains("<osm") && changesets.toString().contains("</osm>"))) { 202 202 // heuristic: if there isn't an opening and closing "<osm>" tag in the returned content, -
org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
194 194 195 195 protected void updateEnabledState() { 196 196 boolean enabled = 197 !tfOsmServerUrl.getText().trim().equals("")197 !tfOsmServerUrl.getText().trim().isEmpty() 198 198 && !tfOsmServerUrl.getText().trim().equals(lastTestedUrl); 199 199 if (enabled) { 200 200 lblValid.setIcon(null); … … 229 229 230 230 @Override 231 231 public boolean isValid() { 232 if (getComponent().getText().trim(). equals(""))232 if (getComponent().getText().trim().isEmpty()) 233 233 return false; 234 234 235 235 try { … … 242 242 243 243 @Override 244 244 public void validate() { 245 if (getComponent().getText().trim(). equals("")) {245 if (getComponent().getText().trim().isEmpty()) { 246 246 feedbackInvalid(tr("OSM API URL must not be empty. Please enter the OSM API URL.")); 247 247 return; 248 248 } -
org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java
159 159 private void resetState() { 160 160 String newTitle; 161 161 if (extraText != null) { 162 newTitle = taskTitle + " "+ extraText;162 newTitle = taskTitle + ' ' + extraText; 163 163 } else { 164 164 newTitle = taskTitle; 165 165 } -
org/openstreetmap/josm/gui/progress/ProgressTaskId.java
6 6 private final String id; 7 7 8 8 public ProgressTaskId(String component, String task) { 9 this.id = component + "."+ task;9 this.id = component + '.' + task; 10 10 } 11 11 12 12 public String getId() { -
org/openstreetmap/josm/gui/tagging/TagEditorModel.java
148 148 break; 149 149 case 1: 150 150 String v = (String)value; 151 if (tag.getValueCount() > 1 && ! v.equals("")) {151 if (tag.getValueCount() > 1 && !v.isEmpty()) { 152 152 updateTagValue(tag, v); 153 153 } else if (tag.getValueCount() <= 1) { 154 154 updateTagValue(tag, v); … … 429 429 430 430 // tag name holds an empty key. Don't apply it to the selection. 431 431 // 432 if (tag.getName().trim(). equals("") || tag.getValue().trim().equals("")) {432 if (tag.getName().trim().isEmpty() || tag.getValue().trim().isEmpty()) { 433 433 continue; 434 434 } 435 435 tags.put(tag.getName().trim(), tag.getValue().trim()); … … 475 475 476 476 // tag name holds an empty key. Don't apply it to the selection. 477 477 // 478 if (tag.getName().trim(). equals(""))478 if (tag.getName().trim().isEmpty()) 479 479 return null; 480 480 481 481 String newkey = tag.getName(); … … 516 516 public List<String> getKeys() { 517 517 ArrayList<String> keys = new ArrayList<String>(); 518 518 for (TagModel tag: tags) { 519 if (!tag.getName().trim(). equals("")) {519 if (!tag.getName().trim().isEmpty()) { 520 520 keys.add(tag.getName()); 521 521 } 522 522 } -
org/openstreetmap/josm/gui/tagging/TagModel.java
116 116 for (int i =0; i < values.size(); i++) { 117 117 sb.append(values.get(i)); 118 118 if (i + 1 < values.size()) { 119 sb.append( ";");119 sb.append(';'); 120 120 } 121 121 } 122 122 return sb.toString(); -
org/openstreetmap/josm/gui/tagging/TaggingPreset.java
117 117 } 118 118 119 119 public String getName() { 120 return group != null ? group.getName() + "/"+ getLocaleName() : getLocaleName();120 return group != null ? group.getName() + '/' + getLocaleName() : getLocaleName(); 121 121 } 122 122 public String getRawName() { 123 return group != null ? group.getRawName() + "/"+ name : name;123 return group != null ? group.getRawName() + '/' + name : name; 124 124 } 125 125 126 126 /* -
org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
96 96 if (value.equals(DIFFERENT)) 97 97 return "<b>"+DIFFERENT.replaceAll("<", "<").replaceAll(">", ">")+"</b>"; 98 98 99 if (value. equals(""))99 if (value.isEmpty()) 100 100 return " "; 101 101 102 102 final StringBuilder res = new StringBuilder("<b>"); … … 116 116 } 117 117 118 118 private Integer parseInteger(String str) { 119 if (str == null || "".equals(str))119 if (str == null || str != null && str.isEmpty()) 120 120 return null; 121 121 try { 122 122 return Integer.parseInt(str); … … 217 217 } 218 218 } 219 219 } 220 p.add(new JLabel(locale_text+ ":"), GBC.std().insets(0,0,10,0));220 p.add(new JLabel(locale_text+ ':'), GBC.std().insets(0,0,10,0)); 221 221 p.add(new JLabel(key), GBC.std().insets(0,0,10,0)); 222 222 p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0,0,10,0)); 223 223 if(types != null){ … … 436 436 public String toString() { 437 437 return "KeyedItem [key=" + key + ", text=" + text 438 438 + ", text_context=" + text_context + ", match=" + match 439 + "]";439 + ']'; 440 440 } 441 441 } 442 442 … … 468 468 public String toString() { 469 469 return "Key [key=" + key + ", value=" + value + ", text=" + text 470 470 + ", text_context=" + text_context + ", match=" + match 471 + "]";471 + ']'; 472 472 } 473 473 } 474 474 … … 589 589 pnl.add(releasebutton, GBC.eol()); 590 590 value = pnl; 591 591 } 592 p.add(new JLabel(locale_text+ ":"), GBC.std().insets(0,0,10,0));592 p.add(new JLabel(locale_text+ ':'), GBC.std().insets(0,0,10,0)); 593 593 p.add(value, GBC.eol().fill(GBC.HORIZONTAL)); 594 594 return true; 595 595 } -
org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
149 149 150 150 @Override 151 151 public void keyReleased(KeyEvent e) { 152 if (getText(). equals("")) {152 if (getText().isEmpty()) { 153 153 applyFilter(""); 154 154 } 155 155 } -
org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java
81 81 sb.append(value); 82 82 sb.append("',"); 83 83 sb.append(priority.toString()); 84 sb.append( ">");84 sb.append('>'); 85 85 return sb.toString(); 86 86 } 87 87 -
org/openstreetmap/josm/gui/widgets/HtmlPanel.java
36 36 f.isBold() ? "bold" : "normal", 37 37 f.isItalic() ? "italic" : "normal" 38 38 ); 39 rule = "body {" + rule + "}";39 rule = "body {" + rule + '}'; 40 40 rule = MessageFormat.format( 41 41 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}", 42 42 f.getName(), … … 44 44 "bold", 45 45 f.isItalic() ? "italic" : "normal" 46 46 ); 47 rule = "strong {" + rule + "}";47 rule = "strong {" + rule + '}'; 48 48 ss.addRule(rule); 49 49 ss.addRule("a {text-decoration: underline; color: blue}"); 50 50 ss.addRule("ul {margin-left: 1cm; list-style-type: disc}"); -
org/openstreetmap/josm/io/AllFormatsImporter.java
34 34 continue; 35 35 } 36 36 ext.append(fi.filter.getExtensions()); 37 ext.append( ",");37 ext.append(','); 38 38 } 39 39 // remove last comma 40 40 return ext.substring(0, ext.length()-1).toString(); -
org/openstreetmap/josm/io/BoundingBoxDownloader.java
72 72 progressMonitor.indeterminateSubTask(tr("Contacting OSM Server...")); 73 73 if (crosses180th) { 74 74 // API 0.6 does not support requests crossing the 180th meridian, so make two requests 75 GpxData result = downloadRawGps("trackpoints?bbox="+lon1+ ","+lat1+",180.0,"+lat2+"&page=", progressMonitor);76 result.mergeFrom(downloadRawGps("trackpoints?bbox=-180.0,"+lat1+ ","+lon2+","+lat2+"&page=", progressMonitor));75 GpxData result = downloadRawGps("trackpoints?bbox="+lon1+ ',' +lat1+",180.0,"+lat2+"&page=", progressMonitor); 76 result.mergeFrom(downloadRawGps("trackpoints?bbox=-180.0,"+lat1+ ',' +lon2+ ',' +lat2+"&page=", progressMonitor)); 77 77 return result; 78 78 } else { 79 79 // Simple request 80 return downloadRawGps("trackpoints?bbox="+lon1+ ","+lat1+","+lon2+","+lat2+"&page=", progressMonitor);80 return downloadRawGps("trackpoints?bbox="+lon1+ ',' +lat1+ ',' +lon2+ ',' +lat2+"&page=", progressMonitor); 81 81 } 82 82 } catch (IllegalArgumentException e) { 83 83 // caused by HttpUrlConnection in case of illegal stuff in the response … … 102 102 } 103 103 104 104 protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2) { 105 return "map?bbox=" + lon1 + "," + lat1 + "," + lon2 + ","+ lat2;105 return "map?bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2; 106 106 } 107 107 108 108 /** -
org/openstreetmap/josm/io/CacheFiles.java
70 70 71 71 boolean dir_writeable; 72 72 this.ident = ident; 73 String cacheDir = Main.pref.get("cache." + ident + "."+ "path", pref + File.separator + ident + File.separator);73 String cacheDir = Main.pref.get("cache." + ident + '.' + "path", pref + File.separator + ident + File.separator); 74 74 this.dir = new File(cacheDir); 75 75 try { 76 76 this.dir.mkdirs(); … … 80 80 dir_writeable = false; 81 81 } 82 82 this.enabled = dir_writeable; 83 this.expire = Main.pref.getLong("cache." + ident + "."+ "expire", EXPIRE_DAILY);83 this.expire = Main.pref.getLong("cache." + ident + '.' + "expire", EXPIRE_DAILY); 84 84 if(this.expire < 0) { 85 85 this.expire = CacheFiles.EXPIRE_NEVER; 86 86 } 87 this.maxsize = Main.pref.getLong("cache." + ident + "."+ "maxsize", 50);87 this.maxsize = Main.pref.getLong("cache." + ident + '.' + "maxsize", 50); 88 88 if(this.maxsize < 0) { 89 89 this.maxsize = -1; 90 90 } … … 193 193 * @param force will also write it to the preferences 194 194 */ 195 195 public void setExpire(int amount, boolean force) { 196 String key = "cache." + ident + "."+ "expire";196 String key = "cache." + ident + '.' + "expire"; 197 197 if(!Main.pref.get(key).isEmpty() && !force) 198 198 return; 199 199 … … 207 207 * @param force will also write it to the preferences 208 208 */ 209 209 public void setMaxSize(int amount, boolean force) { 210 String key = "cache." + ident + "."+ "maxsize";210 String key = "cache." + ident + '.' + "maxsize"; 211 211 if(!Main.pref.get(key).isEmpty() && !force) 212 212 return; 213 213 … … 333 333 * @return file structure 334 334 */ 335 335 private File getPath(String ident, String ending) { 336 return new File(dir, getUniqueFilename(ident) + "."+ ending);336 return new File(dir, getUniqueFilename(ident) + '.' + ending); 337 337 } 338 338 339 339 /** -
org/openstreetmap/josm/io/ChangesetQuery.java
232 232 public String getQueryString() { 233 233 StringBuffer sb = new StringBuffer(); 234 234 if (uid != null) { 235 sb.append("user").append( "=").append(uid);235 sb.append("user").append('=').append(uid); 236 236 } else if (userName != null) { 237 237 try { 238 sb.append("display_name").append( "=").append(URLEncoder.encode(userName, "UTF-8"));238 sb.append("display_name").append('=').append(URLEncoder.encode(userName, "UTF-8")); 239 239 } catch (UnsupportedEncodingException e) { 240 240 e.printStackTrace(); 241 241 } 242 242 } 243 243 if (bounds != null) { 244 244 if (sb.length() > 0) { 245 sb.append( "&");245 sb.append('&'); 246 246 } 247 247 sb.append("bbox=").append(bounds.encodeAsString(",")); 248 248 } 249 249 if (closedAfter != null && createdBefore != null) { 250 250 if (sb.length() > 0) { 251 sb.append( "&");251 sb.append('&'); 252 252 } 253 253 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); 254 sb.append("time").append( "=").append(df.format(closedAfter));255 sb.append( ",").append(df.format(createdBefore));254 sb.append("time").append('=').append(df.format(closedAfter)); 255 sb.append(',').append(df.format(createdBefore)); 256 256 } else if (closedAfter != null) { 257 257 if (sb.length() > 0) { 258 sb.append( "&");258 sb.append('&'); 259 259 } 260 260 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); 261 sb.append("time").append( "=").append(df.format(closedAfter));261 sb.append("time").append('=').append(df.format(closedAfter)); 262 262 } 263 263 264 264 if (open != null) { 265 265 if (sb.length() > 0) { 266 sb.append( "&");266 sb.append('&'); 267 267 } 268 268 sb.append("open=").append(Boolean.toString(open)); 269 269 } else if (closed != null) { 270 270 if (sb.length() > 0) { 271 sb.append( "&");271 sb.append('&'); 272 272 } 273 273 sb.append("closed=").append(Boolean.toString(closed)); 274 274 } … … 301 301 302 302 public static class ChangesetQueryUrlParser { 303 303 protected int parseUid(String value) throws ChangesetQueryUrlException { 304 if (value == null || value.trim(). equals(""))304 if (value == null || value.trim().isEmpty()) 305 305 throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid",value)); 306 306 int id; 307 307 try { … … 315 315 } 316 316 317 317 protected boolean parseOpen(String value) throws ChangesetQueryUrlException { 318 if (value == null || value.trim(). equals(""))318 if (value == null || value.trim().isEmpty()) 319 319 throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "open",value)); 320 320 if (value.equals("true")) 321 321 return true; … … 326 326 } 327 327 328 328 protected boolean parseBoolean(String value, String parameter) throws ChangesetQueryUrlException { 329 if (value == null || value.trim(). equals(""))329 if (value == null || value.trim().isEmpty()) 330 330 throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter,value)); 331 331 if (value.equals("true")) 332 332 return true; … … 337 337 } 338 338 339 339 protected Date parseDate(String value, String parameter) throws ChangesetQueryUrlException { 340 if (value == null || value.trim(). equals(""))340 if (value == null || value.trim().isEmpty()) 341 341 throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter,value)); 342 342 if (value.endsWith("Z")) { 343 343 // OSM API generates date strings we time zone abbreviation "Z" which Java SimpleDateFormat … … 435 435 if (query == null) 436 436 return new ChangesetQuery(); 437 437 query = query.trim(); 438 if (query. equals(""))438 if (query.isEmpty()) 439 439 return new ChangesetQuery(); 440 440 Map<String,String> queryParams = createMapFromQueryString(query); 441 441 return crateFromMap(queryParams); -
org/openstreetmap/josm/io/DefaultProxySelector.java
107 107 } 108 108 String host = Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST, null); 109 109 int port = parseProxyPortValue(ProxyPreferencesPanel.PROXY_HTTP_PORT, Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_PORT, null)); 110 if (host != null && ! host.trim().equals("") && port > 0) {110 if (host != null && !host.trim().isEmpty() && port > 0) { 111 111 httpProxySocketAddress = new InetSocketAddress(host,port); 112 112 } else { 113 113 httpProxySocketAddress = null; … … 119 119 120 120 host = Main.pref.get(ProxyPreferencesPanel.PROXY_SOCKS_HOST, null); 121 121 port = parseProxyPortValue(ProxyPreferencesPanel.PROXY_SOCKS_PORT, Main.pref.get(ProxyPreferencesPanel.PROXY_SOCKS_PORT, null)); 122 if (host != null && ! host.trim().equals("") && port > 0) {122 if (host != null && !host.trim().isEmpty() && port > 0) { 123 123 socksProxySocketAddress = new InetSocketAddress(host,port); 124 124 } else { 125 125 socksProxySocketAddress = null; -
org/openstreetmap/josm/io/GeoJSONWriter.java
54 54 insertCommaCoords = true; 55 55 appendCoord(n.getCoor()); 56 56 } 57 out.append( "]");57 out.append(']'); 58 58 } 59 59 60 60 @Override … … 90 90 } 91 91 insertCommaTags = true; 92 92 out.append("\t\t\"").append(escape(t.getKey())).append("\": "); 93 out.append( "\"").append(escape(t.getValue())).append("\"");93 out.append('"').append(escape(t.getValue())).append('"'); 94 94 } 95 95 out.append("\n\t},\n"); 96 96 } else { … … 99 99 { // append primitive specific 100 100 out.append("\t\"geometry\": {"); 101 101 p.accept(this); 102 out.append( "}");102 out.append('}'); 103 103 } 104 out.append( "}");104 out.append('}'); 105 105 } 106 106 107 107 protected void appendCoord(LatLon c) { 108 108 if (c != null) { 109 out.append( "[").append(c.lon()).append(", ").append(c.lat()).append("]");109 out.append('[').append(c.lon()).append(", ").append(c.lat()).append(']'); 110 110 } 111 111 } 112 112 } -
org/openstreetmap/josm/io/GpxReader.java
154 154 currentState = State.link; 155 155 currentLink = new GpxLink(atts.getValue("href")); 156 156 } else if (localName.equals("email")) { 157 data.attr.put(META_AUTHOR_EMAIL, atts.getValue("id") + "@"+ atts.getValue("domain"));157 data.attr.put(META_AUTHOR_EMAIL, atts.getValue("id") + '@' + atts.getValue("domain")); 158 158 } 159 159 break; 160 160 case trk: -
org/openstreetmap/josm/io/GpxWriter.java
121 121 if (attr.containsKey(META_AUTHOR_EMAIL)) { 122 122 String[] tmp = ((String)attr.get(META_AUTHOR_EMAIL)).split("@"); 123 123 if (tmp.length == 2) { 124 inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+ "\"");124 inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+ '"'); 125 125 } 126 126 } 127 127 // write the author link … … 132 132 // write the copyright details 133 133 if (attr.containsKey(META_COPYRIGHT_LICENSE) 134 134 || attr.containsKey(META_COPYRIGHT_YEAR)) { 135 openAtt("copyright", "author=\""+ attr.get(META_COPYRIGHT_AUTHOR) + "\"");135 openAtt("copyright", "author=\""+ attr.get(META_COPYRIGHT_AUTHOR) + '"'); 136 136 if (attr.containsKey(META_COPYRIGHT_YEAR)) { 137 137 simpleTag("year", (String) attr.get(META_COPYRIGHT_YEAR)); 138 138 } … … 157 157 Bounds bounds = data.recalculateBounds(); 158 158 if (bounds != null) { 159 159 String b = "minlat=\"" + bounds.getMin().lat() + "\" minlon=\"" + bounds.getMin().lon() + 160 "\" maxlat=\"" + bounds.getMax().lat() + "\" maxlon=\"" + bounds.getMax().lon() + "\"";160 "\" maxlat=\"" + bounds.getMax().lat() + "\" maxlon=\"" + bounds.getMax().lon() + '"'; 161 161 inline("bounds", b); 162 162 } 163 163 … … 208 208 } 209 209 210 210 private void open(String tag) { 211 out.print(indent + "<" + tag + ">");211 out.print(indent + '<' + tag + '>'); 212 212 indent += " "; 213 213 } 214 214 215 215 private void openAtt(String tag, String attributes) { 216 out.println(indent + "<" + tag + " " + attributes + ">");216 out.println(indent + '<' + tag + ' ' + attributes + '>'); 217 217 indent += " "; 218 218 } 219 219 220 220 private void inline(String tag, String attributes) { 221 out.println(indent + "<" + tag + " "+ attributes + "/>");221 out.println(indent + '<' + tag + ' ' + attributes + "/>"); 222 222 } 223 223 224 224 private void close(String tag) { 225 225 indent = indent.substring(2); 226 out.print(indent + "</" + tag + ">");226 out.print(indent + "</" + tag + '>'); 227 227 } 228 228 229 229 private void closeln(String tag) { … … 239 239 if (content != null && content.length() > 0) { 240 240 open(tag); 241 241 out.print(encode(content)); 242 out.println("</" + tag + ">");242 out.println("</" + tag + '>'); 243 243 indent = indent.substring(2); 244 244 } 245 245 } … … 249 249 */ 250 250 private void gpxLink(GpxLink link) { 251 251 if (link != null) { 252 openAtt("link", "href=\"" + link.uri + "\"");252 openAtt("link", "href=\"" + link.uri + '"'); 253 253 simpleTag("text", link.text); 254 254 simpleTag("type", link.type); 255 255 closeln("link"); … … 276 276 } 277 277 if (pnt != null) { 278 278 LatLon c = pnt.getCoor(); 279 String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"";279 String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + '"'; 280 280 if (pnt.attr.isEmpty()) { 281 281 inline(type, coordAttr); 282 282 } else { -
org/openstreetmap/josm/io/JpgImporter.java
34 34 * @since 5438 35 35 */ 36 36 public static final ExtensionFileFilter FILE_FILTER_WITH_FOLDERS = new ExtensionFileFilter( 37 "jpg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+ ")");37 "jpg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+ ')'); 38 38 39 39 /** 40 40 * Constructs a new {@code JpgImporter}. -
org/openstreetmap/josm/io/MirroredInputStream.java
110 110 Enumeration<? extends ZipEntry> entries = zipFile.entries(); 111 111 while (entries.hasMoreElements()) { 112 112 ZipEntry entry = entries.nextElement(); 113 if (entry.getName().endsWith( "."+ extension)) {113 if (entry.getName().endsWith('.' + extension)) { 114 114 /* choose any file with correct extension. When more than 115 115 one file, prefer the one which matches namepart */ 116 116 if (resentry == null || entry.getName().indexOf(namepart) >= 0) { … … 170 170 StringBuilder prefKey = new StringBuilder("mirror."); 171 171 if (destDir != null) { 172 172 prefKey.append(destDir); 173 prefKey.append( ".");173 prefKey.append('.'); 174 174 } 175 175 prefKey.append(url.toString()); 176 176 return prefKey.toString().replaceAll("=","_"); -
org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
270 270 for (int i=0; i<idPackage.size(); i++) { 271 271 sb.append(it.next()); 272 272 if (i < idPackage.size()-1) { 273 sb.append( ",");273 sb.append(','); 274 274 } 275 275 } 276 276 return sb.toString(); … … 345 345 } 346 346 // Run the fetchers 347 347 for (int i = 0; i < jobs.size() && !isCanceled(); i++) { 348 progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + "/"+ progressMonitor.getTicksCount());348 progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + '/' + progressMonitor.getTicksCount()); 349 349 try { 350 350 FetchResult result = ecs.take().get(); 351 351 if (result.missingPrimitives != null) { -
org/openstreetmap/josm/io/NMEAImporter.java
51 51 52 52 private void showNmeaInfobox(boolean success, NmeaReader r) { 53 53 final StringBuilder msg = new StringBuilder().append("<html>"); 54 msg.append(tr("Coordinates imported: {0}", r.getNumberOfCoordinates()) +"<br>");55 msg.append(tr("Malformed sentences: {0}", r.getParserMalformed()) +"<br>");56 msg.append(tr("Checksum errors: {0}", r.getParserChecksumErrors()) +"<br>");54 msg.append(tr("Coordinates imported: {0}", r.getNumberOfCoordinates())).append("<br>"); 55 msg.append(tr("Malformed sentences: {0}", r.getParserMalformed())).append("<br>"); 56 msg.append(tr("Checksum errors: {0}", r.getParserChecksumErrors())).append("<br>"); 57 57 if (!success) { 58 msg.append(tr("Unknown sentences: {0}", r.getParserUnknown()) +"<br>");58 msg.append(tr("Unknown sentences: {0}", r.getParserUnknown())).append("<br>"); 59 59 } 60 60 msg.append(tr("Zero coordinates: {0}", r.getParserZeroCoordinates())); 61 61 msg.append("</html>"); -
org/openstreetmap/josm/io/NmeaReader.java
234 234 // Returns true if the input made sence, false otherwise. 235 235 private boolean ParseNMEASentence(String s, NMEAParserState ps) { 236 236 try { 237 if (s. equals(""))237 if (s.isEmpty()) 238 238 throw new NullPointerException(); 239 239 240 240 // checksum check: … … 303 303 if(accu.equals("M")) { 304 304 // Ignore heights that are not in meters for now 305 305 accu=e[GPGGA.HEIGHT.position]; 306 if(!accu. equals("")) {306 if(!accu.isEmpty()) { 307 307 Double.parseDouble(accu); 308 308 // if it throws it's malformed; this should only happen if the 309 309 // device sends nonstandard data. 310 if(!accu. equals("")) {310 if(!accu.isEmpty()) { 311 311 currentwp.attr.put("ele", accu); 312 312 } 313 313 } … … 315 315 // number of sattelites 316 316 accu=e[GPGGA.SATELLITE_COUNT.position]; 317 317 int sat = 0; 318 if(!accu. equals("")) {318 if(!accu.isEmpty()) { 319 319 sat = Integer.parseInt(accu); 320 320 currentwp.attr.put("sat", accu); 321 321 } 322 322 // h-dilution 323 323 accu=e[GPGGA.HDOP.position]; 324 if(!accu. equals("")) {324 if(!accu.isEmpty()) { 325 325 currentwp.attr.put("hdop", Float.parseFloat(accu)); 326 326 } 327 327 // fix 328 328 accu=e[GPGGA.QUALITY.position]; 329 if(!accu. equals("")) {329 if(!accu.isEmpty()) { 330 330 int fixtype = Integer.parseInt(accu); 331 331 switch(fixtype) { 332 332 case 0: … … 352 352 if(accu.equals("T")) { 353 353 // other values than (T)rue are ignored 354 354 accu = e[GPVTG.COURSE.position]; 355 if(!accu. equals("")) {355 if(!accu.isEmpty()) { 356 356 Double.parseDouble(accu); 357 357 currentwp.attr.put("course", accu); 358 358 } … … 361 361 accu = e[GPVTG.SPEED_KMH_UNIT.position]; 362 362 if(accu.startsWith("K")) { 363 363 accu = e[GPVTG.SPEED_KMH.position]; 364 if(!accu. equals("")) {364 if(!accu.isEmpty()) { 365 365 double speed = Double.parseDouble(accu); 366 366 speed /= 3.6; // speed in m/s 367 367 currentwp.attr.put("speed", Double.toString(speed)); … … 370 370 } else if(e[0].equals("$GPGSA") || e[0].equals("$GNGSA")) { 371 371 // vdop 372 372 accu=e[GPGSA.VDOP.position]; 373 if(!accu. equals("")) {373 if(!accu.isEmpty()) { 374 374 currentwp.attr.put("vdop", Float.parseFloat(accu)); 375 375 } 376 376 // hdop 377 377 accu=e[GPGSA.HDOP.position]; 378 if(!accu. equals("")) {378 if(!accu.isEmpty()) { 379 379 currentwp.attr.put("hdop", Float.parseFloat(accu)); 380 380 } 381 381 // pdop 382 382 accu=e[GPGSA.PDOP.position]; 383 if(!accu. equals("")) {383 if(!accu.isEmpty()) { 384 384 currentwp.attr.put("pdop", Float.parseFloat(accu)); 385 385 } 386 386 } … … 411 411 currentwp.attr.put("time", DateUtils.fromDate(d)); 412 412 // speed 413 413 accu = e[GPRMC.SPEED.position]; 414 if(!accu. equals("") && !currentwp.attr.containsKey("speed")) {414 if(!accu.isEmpty() && !currentwp.attr.containsKey("speed")) { 415 415 double speed = Double.parseDouble(accu); 416 416 speed *= 0.514444444; // to m/s 417 417 currentwp.attr.put("speed", Double.toString(speed)); 418 418 } 419 419 // course 420 420 accu = e[GPRMC.COURSE.position]; 421 if(!accu. equals("") && !currentwp.attr.containsKey("course")) {421 if(!accu.isEmpty() && !currentwp.attr.containsKey("course")) { 422 422 Double.parseDouble(accu); 423 423 currentwp.attr.put("course", accu); 424 424 } … … 463 463 464 464 // return a zero latlon instead of null so it is logged as zero coordinate 465 465 // instead of malformed sentence 466 if(widthNorth. equals("")&&lengthEast.equals("")) return new LatLon(0.0,0.0);466 if(widthNorth.isEmpty() && lengthEast.isEmpty()) return new LatLon(0.0,0.0); 467 467 468 468 // The format is xxDDLL.LLLL 469 469 // xx optional whitespace -
org/openstreetmap/josm/io/OsmApi.java
316 316 public String getBaseUrl() { 317 317 StringBuffer rv = new StringBuffer(serverUrl); 318 318 if (version != null) { 319 rv.append( "/");319 rv.append('/'); 320 320 rv.append(version); 321 321 } 322 rv.append( "/");322 rv.append('/'); 323 323 // this works around a ruby (or lighttpd) bug where two consecutive slashes in 324 324 // an URL will cause a "404 not found" response. 325 325 int p; while ((p = rv.indexOf("//", 6)) > -1) { rv.delete(p, p + 1); } … … 360 360 ensureValidChangeset(); 361 361 initialize(monitor); 362 362 // normal mode (0.6 and up) returns new object version. 363 ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+ "/"+ osm.getId(), toXml(osm, true), monitor);363 ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+ '/' + osm.getId(), toXml(osm, true), monitor); 364 364 osm.setOsmId(osm.getId(), Integer.parseInt(ret.trim())); 365 365 osm.setChangesetId(getChangeset().getId()); 366 366 osm.setVisible(true); … … 480 480 initialize(monitor); 481 481 /* send "\r\n" instead of empty string, so we don't send zero payload - works around bugs 482 482 in proxy software */ 483 sendRequest("PUT", "changeset" + "/"+ changeset.getId() + "/close", "\r\n", monitor);483 sendRequest("PUT", "changeset" + '/' + changeset.getId() + "/close", "\r\n", monitor); 484 484 changeset.setOpen(false); 485 485 } finally { 486 486 monitor.finishTask(); … … 595 595 while(true) { // the retry loop 596 596 try { 597 597 URL url = new URL(new URL(getBaseUrl()), urlSuffix); 598 System.out.print(requestMethod + " "+ url + "... ");598 System.out.print(requestMethod + ' ' + url + "... "); 599 599 // fix #5369, see http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive 600 600 activeConnection = Utils.openHttpConnection(url, false); 601 601 activeConnection.setConnectTimeout(fastFail ? 1000 : Main.pref.getInteger("socket.timeout.connect",15)*1000); … … 658 658 String s; 659 659 while((s = in.readLine()) != null) { 660 660 responseBody.append(s); 661 responseBody.append( "\n");661 responseBody.append('\n'); 662 662 } 663 663 } 664 664 String errorHeader = null; -
org/openstreetmap/josm/io/OsmApiException.java
138 138 if (!eh.isEmpty()) { 139 139 sb.append(", Error Header=<") 140 140 .append(eh) 141 .append( ">");141 .append('>'); 142 142 } 143 143 } 144 144 catch (Exception e) { … … 150 150 if (!eb.isEmpty() && !eb.equals(eh)) { 151 151 sb.append(", Error Body=<") 152 152 .append(eb) 153 .append( ">");153 .append('>'); 154 154 } 155 155 } 156 156 catch (Exception e) { … … 169 169 if (errorHeader != null) { 170 170 sb.append(tr(errorHeader)); 171 171 sb.append(tr("(Code={0})", responseCode)); 172 } else if (errorBody != null && !errorBody.trim(). equals("")) {172 } else if (errorBody != null && !errorBody.trim().isEmpty()) { 173 173 errorBody = errorBody.trim(); 174 174 sb.append(tr(errorBody)); 175 175 sb.append(tr("(Code={0})", responseCode)); -
org/openstreetmap/josm/io/OsmConnection.java
90 90 } else { 91 91 String username= response.getUsername() == null ? "" : response.getUsername(); 92 92 String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword()); 93 token = username + ":"+ password;93 token = username + ':' + password; 94 94 try { 95 95 ByteBuffer bytes = encoder.encode(CharBuffer.wrap(token)); 96 96 con.addRequestProperty("Authorization", "Basic "+Base64.encode(bytes)); -
org/openstreetmap/josm/io/OsmDataParsingException.java
41 41 if (msg == null) { 42 42 msg = getClass().getName(); 43 43 } 44 msg = msg + " "+ tr("(at line {0}, column {1})", lineNumber, columnNumber);44 msg = msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber); 45 45 return msg; 46 46 } 47 47 -
org/openstreetmap/josm/io/OsmExporter.java
62 62 // process of writing the file, we might just end up with 63 63 // a truncated file. That can destroy lots of work. 64 64 if (file.exists()) { 65 tmpFile = new File(file.getPath() + "~");65 tmpFile = new File(file.getPath() + '~'); 66 66 Utils.copyFile(file, tmpFile); 67 67 } 68 68 -
org/openstreetmap/josm/io/OsmHistoryReader.java
56 56 protected String getCurrentPosition() { 57 57 if (locator == null) 58 58 return ""; 59 return "(" + locator.getLineNumber() + "," + locator.getColumnNumber() + ")";59 return "(" + locator.getLineNumber() + ',' + locator.getColumnNumber() + ')'; 60 60 } 61 61 62 62 protected void throwException(String message) throws SAXException { -
org/openstreetmap/josm/io/OsmReader.java
563 563 } 564 564 if (getLocation() == null) 565 565 return msg; 566 msg = msg + " "+ tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());566 msg = msg + ' ' + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber()); 567 567 return msg; 568 568 } 569 569 } -
org/openstreetmap/josm/io/OsmServerBackreferenceReader.java
136 136 progressMonitor.indeterminateSubTask(tr("Downloading from OSM Server...")); 137 137 StringBuffer sb = new StringBuffer(); 138 138 sb.append(primitiveType.getAPIName()) 139 .append( "/").append(id).append("/ways");139 .append('/').append(id).append("/ways"); 140 140 141 141 in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true)); 142 142 if (in == null) … … 170 170 progressMonitor.subTask(tr("Contacting OSM Server...")); 171 171 StringBuffer sb = new StringBuffer(); 172 172 sb.append(primitiveType.getAPIName()) 173 .append( "/").append(id).append("/relations");173 .append('/').append(id).append("/relations"); 174 174 175 175 in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true)); 176 176 if (in == null) -
org/openstreetmap/josm/io/OsmServerHistoryReader.java
61 61 progressMonitor.indeterminateSubTask(tr("Contacting OSM Server...")); 62 62 StringBuffer sb = new StringBuffer(); 63 63 sb.append(primitiveType.getAPIName()) 64 .append( "/").append(id).append("/history");64 .append('/').append(id).append("/history"); 65 65 66 66 in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true)); 67 67 if (in == null) -
org/openstreetmap/josm/io/OsmServerObjectReader.java
123 123 progressMonitor.indeterminateSubTask(tr("Downloading OSM data...")); 124 124 StringBuffer sb = new StringBuffer(); 125 125 sb.append(id.getType().getAPIName()); 126 sb.append( "/");126 sb.append('/'); 127 127 sb.append(id.getUniqueId()); 128 128 if (full && ! id.getType().equals(OsmPrimitiveType.NODE)) { 129 129 sb.append("/full"); 130 130 } else if (version > 0) { 131 sb.append( "/"+version);131 sb.append('/').append(version); 132 132 } 133 133 134 134 in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true)); -
org/openstreetmap/josm/io/OsmServerReader.java
127 127 String s; 128 128 while((s = in.readLine()) != null) { 129 129 errorBody.append(s); 130 errorBody.append( "\n");130 errorBody.append('\n'); 131 131 } 132 132 } 133 133 } -
org/openstreetmap/josm/io/OsmServerWriter.java
69 69 int ms_left = (int)(uploads_left / uploads_per_ms); 70 70 int minutes_left = ms_left / MSECS_PER_MINUTE; 71 71 int seconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE ; 72 String time_left_str = Integer.toString(minutes_left) + ":";72 String time_left_str = Integer.toString(minutes_left) + ':'; 73 73 if (seconds_left < 10) { 74 74 time_left_str += "0"; 75 75 } -
org/openstreetmap/josm/io/OsmWriter.java
178 178 out.println("/>"); 179 179 } else { 180 180 if (n.getCoor() != null) { 181 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+ "'");181 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+ '\''); 182 182 } 183 183 addTags(n, "node", true); 184 184 } … … 219 219 220 220 public void visit(Changeset cs) { 221 221 out.print(" <changeset "); 222 out.print(" id='"+cs.getId()+ "'");222 out.print(" id='"+cs.getId()+ '\''); 223 223 if (cs.getUser() != null) { 224 out.print(" user='"+cs.getUser().getName() + "'");225 out.print(" uid='"+cs.getUser().getId() + "'");224 out.print(" user='"+cs.getUser().getName() + '\''); 225 out.print(" uid='"+cs.getUser().getId() + '\''); 226 226 } 227 227 if (cs.getCreatedAt() != null) { 228 out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) + "'");228 out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) + '\''); 229 229 } 230 230 if (cs.getClosedAt() != null) { 231 out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) + "'");231 out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) + '\''); 232 232 } 233 out.print(" open='"+ (cs.isOpen() ? "true" : "false") + "'");233 out.print(" open='"+ (cs.isOpen() ? "true" : "false") + '\''); 234 234 if (cs.getMin() != null) { 235 out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) + "'");236 out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) + "'");235 out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) + '\''); 236 out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) + '\''); 237 237 } 238 238 if (cs.getMax() != null) { 239 out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) + "'");240 out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) + "'");239 out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) + '\''); 240 out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) + '\''); 241 241 } 242 242 out.println(">"); 243 243 addTags(cs, "changeset", false); // also writes closing </changeset> … … 260 260 out.println(" <tag k='"+ XmlWriter.encode(e.getKey()) + 261 261 "' v='"+XmlWriter.encode(e.getValue())+ "' />"); 262 262 } 263 out.println(" </" + tagname + ">");263 out.println(" </" + tagname + '>'); 264 264 } else if (tagOpen) { 265 265 out.println(" />"); 266 266 } else { 267 out.println(" </" + tagname + ">");267 out.println(" </" + tagname + '>'); 268 268 } 269 269 } 270 270 … … 275 275 protected void addCommon(IPrimitive osm, String tagname) { 276 276 out.print(" <"+tagname); 277 277 if (osm.getUniqueId() != 0) { 278 out.print(" id='"+ osm.getUniqueId()+ "'");278 out.print(" id='"+ osm.getUniqueId()+ '\''); 279 279 } else 280 280 throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found")); 281 281 if (!isOsmChange) { … … 287 287 action = "modify"; 288 288 } 289 289 if (action != null) { 290 out.print(" action='"+action+ "'");290 out.print(" action='"+action+ '\''); 291 291 } 292 292 } 293 293 if (!osm.isTimestampEmpty()) { 294 out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+ "'");294 out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+ '\''); 295 295 } 296 296 // user and visible added with 0.4 API 297 297 if (osm.getUser() != null) { 298 298 if(osm.getUser().isLocalUser()) { 299 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+ "'");299 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+ '\''); 300 300 } else if (osm.getUser().isOsmUser()) { 301 301 // uid added with 0.6 302 out.print(" uid='"+ osm.getUser().getId()+ "'");303 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+ "'");302 out.print(" uid='"+ osm.getUser().getId()+ '\''); 303 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+ '\''); 304 304 } 305 305 } 306 out.print(" visible='"+osm.isVisible()+ "'");306 out.print(" visible='"+osm.isVisible()+ '\''); 307 307 } 308 308 if (osm.getVersion() != 0) { 309 out.print(" version='"+osm.getVersion()+ "'");309 out.print(" version='"+osm.getVersion()+ '\''); 310 310 } 311 311 if (this.changeset != null && this.changeset.getId() != 0) { 312 out.print(" changeset='"+this.changeset.getId()+ "'");312 out.print(" changeset='"+this.changeset.getId()+ '\''); 313 313 } else if (osm.getChangesetId() > 0 && !osm.isNew()) { 314 out.print(" changeset='"+osm.getChangesetId()+ "'");314 out.print(" changeset='"+osm.getChangesetId()+ '\''); 315 315 } 316 316 } 317 317 } -
org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
44 44 * file (username=="") and each time after authentication failed 45 45 * (noSuccessWithLastResponse == true). 46 46 */ 47 } else if (noSuccessWithLastResponse || username. equals("") || password.equals("")) {47 } else if (noSuccessWithLastResponse || username.isEmpty() || password.isEmpty()) { 48 48 GuiHelper.runInEDTAndWait(new Runnable() { 49 49 @Override 50 50 public void run() { -
org/openstreetmap/josm/io/imagery/ImageryReader.java
130 130 } else if (qName.equals("bounds")) { 131 131 try { 132 132 bounds = new ImageryBounds( 133 atts.getValue("min-lat") + ","+134 atts.getValue("min-lon") + ","+135 atts.getValue("max-lat") + ","+133 atts.getValue("min-lat") + ',' + 134 atts.getValue("min-lon") + ',' + 135 atts.getValue("max-lat") + ',' + 136 136 atts.getValue("max-lon"), ","); 137 137 } catch (IllegalArgumentException e) { 138 138 break; -
org/openstreetmap/josm/io/imagery/WMSGrabber.java
46 46 super(mv, layer, localOnly); 47 47 this.info = layer.getInfo(); 48 48 this.baseURL = info.getUrl(); 49 if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies(). equals("")) {49 if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().isEmpty()) { 50 50 props.put("Cookie", layer.getInfo().getCookies()); 51 51 } 52 52 Pattern pattern = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}"); -
org/openstreetmap/josm/io/imagery/WMSImagery.java
72 72 a.append("://"); 73 73 a.append(serviceUrl.getHost()); 74 74 if (serviceUrl.getPort() != -1) { 75 a.append( ":");75 a.append(':'); 76 76 a.append(serviceUrl.getPort()); 77 77 } 78 78 a.append(serviceUrl.getPath()); 79 a.append( "?");79 a.append('?'); 80 80 if (serviceUrl.getQuery() != null) { 81 81 a.append(serviceUrl.getQuery()); 82 82 if (!serviceUrl.getQuery().isEmpty() && !serviceUrl.getQuery().endsWith("&")) { 83 a.append( "&");83 a.append('&'); 84 84 } 85 85 } 86 86 return a.toString(); … … 110 110 getCapabilitiesUrl = new URL(serviceUrlStr); 111 111 final String getCapabilitiesQuery = "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities"; 112 112 if (getCapabilitiesUrl.getQuery() == null) { 113 getCapabilitiesUrl = new URL(serviceUrlStr + "?"+ getCapabilitiesQuery);113 getCapabilitiesUrl = new URL(serviceUrlStr + '?' + getCapabilitiesQuery); 114 114 } else if (!getCapabilitiesUrl.getQuery().isEmpty() && !getCapabilitiesUrl.getQuery().endsWith("&")) { 115 getCapabilitiesUrl = new URL(serviceUrlStr + "&"+ getCapabilitiesQuery);115 getCapabilitiesUrl = new URL(serviceUrlStr + '&' + getCapabilitiesQuery); 116 116 } else { 117 117 getCapabilitiesUrl = new URL(serviceUrlStr + getCapabilitiesQuery); 118 118 } … … 134 134 StringBuilder ba = new StringBuilder(); 135 135 while ((line = br.readLine()) != null) { 136 136 ba.append(line); 137 ba.append( "\n");137 ba.append('\n'); 138 138 } 139 139 String incomingData = ba.toString(); 140 140 -
org/openstreetmap/josm/io/imagery/WMSRequest.java
107 107 @Override 108 108 public String toString() { 109 109 return "WMSRequest [xIndex=" + xIndex + ", yIndex=" + yIndex 110 + ", pixelPerDegree=" + pixelPerDegree + "]";110 + ", pixelPerDegree=" + pixelPerDegree + ']'; 111 111 } 112 112 113 113 public boolean isReal() { -
org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
102 102 { 103 103 command = command.substring(1); 104 104 } 105 String commandWithSlash = "/"+ command;105 String commandWithSlash = '/' + command; 106 106 if (handlers.get(commandWithSlash) != null) { 107 107 System.out.println("RemoteControl: ignoring duplicate command " + command 108 108 + " with handler " + handler.getName()); 109 109 } else { 110 110 if (!silent) { 111 111 System.out.println("RemoteControl: adding command \"" + 112 command + "\" (handled by " + handler.getSimpleName() + ")");112 command + "\" (handled by " + handler.getSimpleName() + ')'); 113 113 } 114 114 handlers.put(commandWithSlash, handler); 115 115 } -
org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
62 62 private void addNode(HashMap<String, String> args){ 63 63 64 64 // Parse the arguments 65 System.out.println("Adding node at (" + lat + ", " + lon + ")");65 System.out.println("Adding node at (" + lat + ", " + lon + ')'); 66 66 67 67 // Create a new node 68 68 LatLon ll = new LatLon(lat, lon); … … 99 99 lat = Double.parseDouble(args.get("lat")); 100 100 lon = Double.parseDouble(args.get("lon")); 101 101 } catch (NumberFormatException e) { 102 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ")");102 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')'); 103 103 } 104 104 if (!Main.main.hasEditLayer()) { 105 105 throw new RequestHandlerBadRequestException(tr("There is no layer opened to add node")); -
org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
81 81 double lon = Double.parseDouble(coordinates[1]); 82 82 allCoordinates.add(new LatLon(lat, lon)); 83 83 } catch (NumberFormatException e) { 84 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ")");84 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')'); 85 85 } 86 86 } 87 87 if (allCoordinates.isEmpty()) { -
org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
53 53 try { 54 54 imgInfo.setDefaultMinZoom(Integer.parseInt(min_zoom)); 55 55 } catch (NumberFormatException e) { 56 System.err.println("NumberFormatException ("+e.getMessage()+ ")");56 System.err.println("NumberFormatException ("+e.getMessage()+ ')'); 57 57 } 58 58 } 59 59 String max_zoom = args.get("max_zoom"); … … 61 61 try { 62 62 imgInfo.setDefaultMaxZoom(Integer.parseInt(max_zoom)); 63 63 } catch (NumberFormatException e) { 64 System.err.println("NumberFormatException ("+e.getMessage()+ ")");64 System.err.println("NumberFormatException ("+e.getMessage()+ ')'); 65 65 } 66 66 } 67 67 GuiHelper.runInEDT(new Runnable() { -
org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
221 221 minlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("left"))); 222 222 maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right"))); 223 223 } catch (NumberFormatException e) { 224 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ")");224 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')'); 225 225 } 226 226 227 227 // Process optional argument 'select' -
org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
201 201 String value = args.get(key); 202 202 if ((value == null) || (value.length() == 0)) { 203 203 error = true; 204 System.out.println( "'"+ myCommand + "' remote control request must have '" + key + "' parameter");204 System.out.println('\'' + myCommand + "' remote control request must have '" + key + "' parameter"); 205 205 missingKeys.add(key); 206 206 } 207 207 } -
org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java
22 22 content = RequestProcessor.PROTOCOLVERSION; 23 23 contentType = "application/json"; 24 24 if (args.containsKey("jsonp")) { 25 content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ")";25 content = args.get("jsonp") + " && " + args.get("jsonp") + '(' + content + ')'; 26 26 } 27 27 } 28 28 -
org/openstreetmap/josm/io/session/GpxTracksSessionImporter.java
32 32 XPath xpath = xPathFactory.newXPath(); 33 33 XPathExpression fileExp = xpath.compile("file/text()"); 34 34 String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING); 35 if (fileStr == null || fileStr. equals("")) {35 if (fileStr == null || fileStr.isEmpty()) { 36 36 throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex())); 37 37 } 38 38 -
org/openstreetmap/josm/io/session/MarkerSessionImporter.java
36 36 XPath xpath = xPathFactory.newXPath(); 37 37 XPathExpression fileExp = xpath.compile("file/text()"); 38 38 String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING); 39 if (fileStr == null || fileStr. equals("")) {39 if (fileStr == null || fileStr.isEmpty()) { 40 40 throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex())); 41 41 } 42 42 -
org/openstreetmap/josm/io/session/OsmDataSessionImporter.java
33 33 XPath xpath = xPathFactory.newXPath(); 34 34 XPathExpression fileExp = xpath.compile("file/text()"); 35 35 String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING); 36 if (fileStr == null || fileStr. equals("")) {36 if (fileStr == null || fileStr.isEmpty()) { 37 37 throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex())); 38 38 } 39 39 -
org/openstreetmap/josm/plugins/PluginHandler.java
214 214 for (DeprecatedPlugin depr: removedPlugins) { 215 215 sb.append("<li>").append(depr.name); 216 216 if (depr.reason != null) { 217 sb.append(" (").append(depr.reason).append( ")");217 sb.append(" (").append(depr.reason).append(')'); 218 218 } 219 219 sb.append("</li>"); 220 220 } … … 1119 1119 int pos = stack.length; 1120 1120 for (PluginProxy p : pluginList) { 1121 1121 String baseClass = p.getPluginInformation().className; 1122 baseClass = baseClass.substring(0, baseClass.lastIndexOf( "."));1122 baseClass = baseClass.substring(0, baseClass.lastIndexOf('.')); 1123 1123 for (int elpos = 0; elpos < pos; ++elpos) { 1124 1124 if (stack[elpos].getClassName().startsWith(baseClass)) { 1125 1125 pos = elpos; … … 1179 1179 for (final PluginProxy pp : pluginList) { 1180 1180 PluginInformation pi = pp.getPluginInformation(); 1181 1181 pl.remove(pi.name); 1182 pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion. equals("")1183 ? pi.localversion : "unknown") + ")");1182 pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion.isEmpty() 1183 ? pi.localversion : "unknown") + ')'); 1184 1184 } 1185 1185 Collections.sort(pl); 1186 1186 for (String s : pl) { 1187 text += "Plugin: " + s + "\n";1187 text += "Plugin: " + s + '\n'; 1188 1188 } 1189 1189 return text; 1190 1190 } … … 1194 1194 for (final PluginProxy p : pluginList) { 1195 1195 final PluginInformation info = p.getPluginInformation(); 1196 1196 String name = info.name 1197 + (info.version != null && !info.version. equals("") ? " Version: " + info.version : "");1197 + (info.version != null && !info.version.isEmpty() ? " Version: " + info.version : ""); 1198 1198 pluginTab.add(new JLabel(name), GBC.std()); 1199 1199 pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 1200 1200 pluginTab.add(new JButton(new AbstractAction(tr("Information")) { … … 1204 1204 b.append(e.getKey()); 1205 1205 b.append(": "); 1206 1206 b.append(e.getValue()); 1207 b.append( "\n");1207 b.append('\n'); 1208 1208 } 1209 1209 JosmTextArea a = new JosmTextArea(10, 40); 1210 1210 a.setEditable(false); -
org/openstreetmap/josm/plugins/PluginInformation.java
229 229 if(mv <= myv && (mv > mainversion || mainversion > myv)) 230 230 { 231 231 String v = (String)entry.getValue(); 232 int i = v.indexOf( ";");232 int i = v.indexOf(';'); 233 233 if(i > 0) 234 234 { 235 235 downloadlink = v.substring(i+1); … … 277 277 } 278 278 if (downloadlink != null && !downloadlink.startsWith("http://svn.openstreetmap.org/applications/editors/josm/dist/") 279 279 && !downloadlink.startsWith("http://trac.openstreetmap.org/browser/applications/editors/josm/dist/")) { 280 sb.append("<p> </p><p>" +tr("<b>Plugin provided by an external source:</b> {0}", downloadlink)+"</p>");280 sb.append("<p> </p><p>").append(tr("<b>Plugin provided by an external source:</b> {0}", downloadlink)).append("</p>"); 281 281 } 282 282 sb.append("</body></html>"); 283 283 return sb.toString(); -
org/openstreetmap/josm/plugins/PluginListParser.java
77 77 if (line.startsWith("\t")) { 78 78 line = line.substring(1); 79 79 while (line.length() > 70) { 80 manifest.append(line.substring(0, 70)).append( "\n");81 line = " "+ line.substring(70);80 manifest.append(line.substring(0, 70)).append('\n'); 81 line = ' ' + line.substring(70); 82 82 } 83 manifest.append(line).append( "\n");83 manifest.append(line).append('\n'); 84 84 continue; 85 85 } 86 86 addPluginInformation(ret, name, url, manifest.toString()); -
org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
107 107 URL url = new URL(site); 108 108 StringBuilder sb = new StringBuilder(); 109 109 sb.append("site-"); 110 sb.append(url.getHost()).append( "-");110 sb.append(url.getHost()).append('-'); 111 111 if (url.getPort() != -1) { 112 sb.append(url.getPort()).append( "-");112 sb.append(url.getPort()).append('-'); 113 113 } 114 114 String path = url.getPath(); 115 115 for (int i =0;i<path.length(); i++) { … … 117 117 if (Character.isLetterOrDigit(c)) { 118 118 sb.append(c); 119 119 } else { 120 sb.append( "_");120 sb.append('_'); 121 121 } 122 122 } 123 123 switch (type) { … … 167 167 in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); 168 168 String line; 169 169 while((line = in.readLine()) != null) { 170 sb.append(line).append( "\n");170 sb.append(line).append('\n'); 171 171 } 172 172 return sb.toString(); 173 173 } catch(MalformedURLException e) { -
org/openstreetmap/josm/tools/BugReportExceptionHandler.java
121 121 if(urltext.length() > maxlen) 122 122 { 123 123 urltext = urltext.substring(0,maxlen); 124 int idx = urltext.lastIndexOf( "\n");124 int idx = urltext.lastIndexOf('\n'); 125 125 /* cut whole line when not loosing too much */ 126 126 if(maxlen-idx < 200) { 127 127 urltext = urltext.substring(0,idx+1); -
org/openstreetmap/josm/tools/ColorHelper.java
32 32 public static String color2html(Color col) { 33 33 if (col == null) 34 34 return null; 35 return "#"+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());35 return '#' +int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue()); 36 36 } 37 37 } -
org/openstreetmap/josm/tools/ExceptionUtil.java
271 271 String msg = null; 272 272 if (header != null) { 273 273 if (body != null && !header.equals(body)) { 274 msg = header + " (" + body + ")";274 msg = header + " (" + body + ')'; 275 275 } else { 276 276 msg = header; 277 277 } … … 428 428 */ 429 429 public static String explainGeneric(Exception e) { 430 430 String msg = e.getMessage(); 431 if (msg == null || msg.trim(). equals("")) {431 if (msg == null || msg.trim().isEmpty()) { 432 432 msg = e.toString(); 433 433 } 434 434 e.printStackTrace(); -
org/openstreetmap/josm/tools/I18n.java
254 254 private static final String gettext(String text, String ctx, boolean lazy) 255 255 { 256 256 int i; 257 if(ctx == null && text.startsWith("_:") && (i = text.indexOf( "\n")) >= 0)257 if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0) 258 258 { 259 259 ctx = text.substring(2,i-1); 260 260 text = text.substring(i+1); 261 261 } 262 262 if(strings != null) 263 263 { 264 String trans = strings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);264 String trans = strings.get(ctx == null ? text : "_:"+ctx+ '\n' +text); 265 265 if(trans != null) 266 266 return trans; 267 267 } 268 268 if(pstrings != null) { 269 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);269 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ '\n' +text); 270 270 if(trans != null) 271 271 return trans[0]; 272 272 } … … 286 286 private static final String gettextn(String text, String plural, String ctx, long num) 287 287 { 288 288 int i; 289 if(ctx == null && text.startsWith("_:") && (i = text.indexOf( "\n")) >= 0)289 if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0) 290 290 { 291 291 ctx = text.substring(2,i-1); 292 292 text = text.substring(i+1); … … 294 294 if(pstrings != null) 295 295 { 296 296 i = pluralEval(num); 297 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);297 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ '\n' +text); 298 298 if(trans != null && trans.length > i) 299 299 return trans[i]; 300 300 } -
org/openstreetmap/josm/tools/ImageProvider.java
402 402 403 403 if (subdir == null) { 404 404 subdir = ""; 405 } else if (!subdir. equals("")) {405 } else if (!subdir.isEmpty()) { 406 406 subdir += "/"; 407 407 } 408 408 String[] extensions; … … 425 425 String cache_name = full_name; 426 426 /* cache separately */ 427 427 if (dirs != null && dirs.size() > 0) { 428 cache_name = "id:" + id + ":"+ full_name;428 cache_name = "id:" + id + ':' + full_name; 429 429 if(archive != null) { 430 cache_name += ":"+ archive.getName();430 cache_name += ':' + archive.getName(); 431 431 } 432 432 } 433 433 … … 510 510 } 511 511 } else { 512 512 final String fn_md5 = Utils.md5Hex(fn); 513 url = b + fn_md5.substring(0,1) + "/" + fn_md5.substring(0,2) + "/"+ fn;513 url = b + fn_md5.substring(0,1) + '/' + fn_md5.substring(0,2) + '/' + fn; 514 514 } 515 515 result = getIfAvailableHttp(url, type); 516 516 if (result != null) { -
org/openstreetmap/josm/tools/LanguageInfo.java
44 44 } 45 45 } else if(type == LocaleType.DEFAULTNOTENGLISH && code == "en") 46 46 return null; 47 return code.substring(0,1).toUpperCase() + code.substring(1) + ":";47 return code.substring(0,1).toUpperCase() + code.substring(1) + ':'; 48 48 } 49 49 50 50 /** … … 119 119 120 120 static public String getLanguageCodeXML() 121 121 { 122 return getJOSMLocaleCode()+ ".";122 return getJOSMLocaleCode()+ '.'; 123 123 } 124 124 static public String getLanguageCodeManifest() 125 125 { 126 return getJOSMLocaleCode()+ "_";126 return getJOSMLocaleCode()+ '_'; 127 127 } 128 128 } -
org/openstreetmap/josm/tools/MultiMap.java
162 162 public String toString() { 163 163 List<String> entries = new ArrayList<String>(map.size()); 164 164 for (A key : map.keySet()) { 165 entries.add(key + "->{" + Utils.join(",", map.get(key)) + "}");165 entries.add(key + "->{" + Utils.join(",", map.get(key)) + '}'); 166 166 } 167 return "(" + Utils.join(",", entries) + ")";167 return '(' + Utils.join(",", entries) + ')'; 168 168 } 169 169 } -
org/openstreetmap/josm/tools/MultikeyActionsHandler.java
127 127 } 128 128 129 129 private String formatMenuText(KeyStroke keyStroke, String index, String description) { 130 String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + "+" + KeyEvent.getKeyText(keyStroke.getKeyCode()) + ","+ index;130 String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode()) + ',' + index; 131 131 132 132 return "<html><i>" + shortcutText + "</i> " + description; 133 133 -
org/openstreetmap/josm/tools/OsmUrlToBounds.java
73 73 private static double parseDouble(HashMap<String, String> map, String key) { 74 74 if (map.containsKey(key)) 75 75 return Double.parseDouble(map.get(key)); 76 return Double.parseDouble(map.get( "m"+key));76 return Double.parseDouble(map.get('m' +key)); 77 77 } 78 78 79 79 private static final char[] SHORTLINK_CHARS = { -
org/openstreetmap/josm/tools/Pair.java
44 44 45 45 @Override 46 46 public String toString() { 47 return "<" +a+","+b+">";47 return "<" + a + ',' + b + '>'; 48 48 } 49 49 50 50 /* convenience constructor method */ -
org/openstreetmap/josm/tools/PlatformHookOsx.java
227 227 if (canHtml) { 228 228 result += "<font size='-2'>"; 229 229 } 230 result += "("+sc.getKeyText()+")";230 result += '(' +sc.getKeyText()+ ')'; 231 231 if (canHtml) { 232 232 result += "</font>"; 233 233 } … … 255 255 */ 256 256 @Override 257 257 public String getOSDescription() { 258 return System.getProperty("os.name") + " "+ System.getProperty("os.version");258 return System.getProperty("os.name") + ' ' + System.getProperty("os.version"); 259 259 } 260 260 } -
org/openstreetmap/josm/tools/PlatformHookUnixoid.java
36 36 String[] programs = {"gnome-open", "kfmclient openURL", "firefox"}; 37 37 for (String program : programs) { 38 38 try { 39 Runtime.getRuntime().exec(program+ " "+url);39 Runtime.getRuntime().exec(program+ ' ' +url); 40 40 return; 41 41 } catch (IOException e) { 42 42 } … … 64 64 if (sc != null && sc.getKeyText().length() != 0) { 65 65 result += " "; 66 66 result += "<font size='-2'>"; 67 result += "("+sc.getKeyText()+")";67 result += '(' +sc.getKeyText()+ ')'; 68 68 result += "</font>"; 69 69 } 70 70 result += " </html>"; … … 166 166 167 167 @Override public String toString() { 168 168 return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField + 169 ", idField=" + idField + ", releaseField=" + releaseField + "]";169 ", idField=" + idField + ", releaseField=" + releaseField + ']'; 170 170 } 171 171 172 172 /** … … 204 204 } 205 205 // If no description has been found, try to rebuild it with "id" + "release" (i.e. "name" + "version") 206 206 if (result == null && id != null && release != null) { 207 result = id + " "+ release;207 result = id + ' ' + release; 208 208 } 209 209 } catch (IOException e) { 210 210 // Ignore -
org/openstreetmap/josm/tools/PlatformHookWindows.java
128 128 */ 129 129 @Override 130 130 public String getOSDescription() { 131 return Utils.strip(System.getProperty("os.name")) + " "+131 return Utils.strip(System.getProperty("os.name")) + ' ' + 132 132 ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit"; 133 133 } 134 134 } -
org/openstreetmap/josm/tools/Shortcut.java
225 225 KeyStroke keyStroke = getKeyStroke(); 226 226 if (keyStroke == null) return ""; 227 227 String modifText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()); 228 if ( "".equals (modifText)) return KeyEvent.getKeyText (keyStroke.getKeyCode ());229 return modifText + "+"+ KeyEvent.getKeyText(keyStroke.getKeyCode ());228 if (modifText != null && modifText.isEmpty()) return KeyEvent.getKeyText (keyStroke.getKeyCode ()); 229 return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode ()); 230 230 } 231 231 232 232 @Override -
org/openstreetmap/josm/tools/TextTagParser.java
247 247 for (String key: tags.keySet()) { 248 248 value = tags.get(key); 249 249 if (key.length() > MAX_KEY_LENGTH) { 250 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+ "="+value, "tags.paste.keytoolong");250 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+ '=' +value, "tags.paste.keytoolong"); 251 251 if (r==2 || r==3) return false; if (r==4) return true; 252 252 } 253 253 if (!key.matches(KEY_PATTERN)) { -
org/openstreetmap/josm/tools/WikiReader.java
88 88 String b = ""; 89 89 for (String line = in.readLine(); line != null; line = in.readLine()) { 90 90 if (!line.contains("[[TranslatedPages]]")) { 91 b += line.replaceAll(" />", ">") + "\n";91 b += line.replaceAll(" />", ">") + '\n'; 92 92 } 93 93 } 94 94 return "<html>" + b + "</html>"; … … 123 123 // 124 124 b += line.replaceAll("<img ", "<img border=\"0\" ") 125 125 .replaceAll("<span class=\"icon\">.</span>", "") 126 .replaceAll("href=\"/", "href=\"" + baseurl + "/")126 .replaceAll("href=\"/", "href=\"" + baseurl + '/') 127 127 .replaceAll(" />", ">") 128 + "\n";128 + '\n'; 129 129 } else if (transl && line.contains("</div>")) { 130 130 transl = false; 131 131 } -
org/openstreetmap/josm/tools/WindowGeometry.java
162 162 163 163 protected void initFromPreferences(String preferenceKey) throws WindowGeometryException { 164 164 String value = Main.pref.get(preferenceKey); 165 if (value == null || value. equals(""))165 if (value == null || value.isEmpty()) 166 166 throw new WindowGeometryException(tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey)); 167 167 topLeft = new Point(); 168 168 extent = new Dimension(); … … 248 248 */ 249 249 public void remember(String preferenceKey) { 250 250 StringBuffer value = new StringBuffer(); 251 value.append("x=").append(topLeft.x).append( ",")252 .append("y=").append(topLeft.y).append( ",")253 .append("width=").append(extent.width).append( ",")251 value.append("x=").append(topLeft.x).append(',') 252 .append("y=").append(topLeft.y).append(',') 253 .append("width=").append(extent.width).append(',') 254 254 .append("height=").append(extent.height); 255 255 Main.pref.put(preferenceKey, value.toString()); 256 256 } … … 390 390 } 391 391 392 392 public String toString() { 393 return "WindowGeometry{topLeft="+topLeft+",extent="+extent+ "}";393 return "WindowGeometry{topLeft="+topLeft+",extent="+extent+ '}'; 394 394 } 395 395 } -
org/openstreetmap/josm/tools/XmlObjectParser.java
75 75 if (msg == null) { 76 76 msg = getClass().getName(); 77 77 } 78 msg = msg + " "+ tr("(at line {0}, column {1})", lineNumber, columnNumber);78 msg = msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber); 79 79 return msg; 80 80 } 81 81 … … 100 100 101 101 @Override 102 102 public void startElement (String uri, String localName, String qName, Attributes atts) throws SAXException { 103 if ( "".equals(uri)) {103 if (uri != null && uri.isEmpty()) { 104 104 super.startElement(namespace, localName, qName, atts); 105 105 } else { 106 106 super.startElement(uri, localName, qName, atts); -
org/openstreetmap/josm/tools/template_engine/Condition.java
46 46 if (entry instanceof SearchExpressionCondition) { 47 47 sb.append(entry.toString()); 48 48 } else { 49 sb.append( "'");49 sb.append('\''); 50 50 sb.append(entry.toString()); 51 sb.append( "'");51 sb.append('\''); 52 52 } 53 sb.append( "|");53 sb.append('|'); 54 54 } 55 55 return sb.toString(); 56 56 } -
org/openstreetmap/josm/tools/template_engine/SearchExpressionCondition.java
25 25 26 26 @Override 27 27 public String toString() { 28 return condition.toString() + " '" + text.toString() + "'";28 return condition.toString() + " '" + text.toString() + '\''; 29 29 } 30 30 31 31 } -
org/openstreetmap/josm/tools/template_engine/Tokenizer.java
35 35 36 36 @Override 37 37 public String toString() { 38 return type + (text != null? " "+ text:"");38 return type + (text != null? ' ' + text:""); 39 39 } 40 40 } 41 41 -
org/openstreetmap/josm/tools/template_engine/Variable.java
35 35 } else { 36 36 first = false; 37 37 } 38 result.append(key).append( "=").append(dataProvider.getTemplateValue(key, false));38 result.append(key).append('=').append(dataProvider.getTemplateValue(key, false)); 39 39 } 40 40 } else { 41 41 Object value = dataProvider.getTemplateValue(variableName, special); … … 55 55 56 56 @Override 57 57 public String toString() { 58 return "{" + variableName + "}";58 return '{' + variableName + '}'; 59 59 } 60 60 61 61 public boolean isSpecial() {