Ticket #8902: emptystring.diff
File emptystring.diff, 44.1 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
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().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().isEmpty()) { 255 255 OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer); 256 256 } 257 257 Main.main.menu.imageryMenu.refreshOffsetMenu(); -
src/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("")) {177 if(s.wmsUrl.isEmpty()) { 178 178 addWMSLayer(s.name + " (" + text + ")", text); 179 179 break outer; 180 180 } -
src/org/openstreetmap/josm/actions/search/SearchCompiler.java
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); -
src/org/openstreetmap/josm/data/Preferences.java
440 440 synchronized public String get(final String key, final String def) { 441 441 putDefault(key, def); 442 442 final String prop = properties.get(key); 443 if (prop == null || prop. equals(""))443 if (prop == null || prop.isEmpty()) 444 444 return def; 445 445 return prop; 446 446 } … … 773 773 } 774 774 putDefault("color."+colKey, ColorHelper.color2html(def)); 775 775 String colStr = specName != null ? get("color."+specName) : ""; 776 if(colStr. equals("")) {776 if(colStr.isEmpty()) { 777 777 colStr = get("color."+colKey); 778 778 } 779 return colStr. equals("") ? def : ColorHelper.html2color(colStr);779 return colStr.isEmpty() ? def : ColorHelper.html2color(colStr); 780 780 } 781 781 782 782 synchronized public Color getDefaultColor(String colKey) { 783 783 String colStr = defaults.get("color."+colKey); 784 return colStr == null || "".equals(colStr) ? null : ColorHelper.html2color(colStr);784 return colStr == null || colStr.isEmpty() ? null : ColorHelper.html2color(colStr); 785 785 } 786 786 787 787 synchronized public boolean putColor(String colKey, Color val) { -
src/org/openstreetmap/josm/data/Version.java
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*#.*$")) { -
src/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.isEmpty() && !b.isEmpty() && (a.contains(b) || b.contains(a))); 130 130 } 131 131 132 132 public void add(ImageryInfo info) { -
src/org/openstreetmap/josm/data/osm/TagCollection.java
601 601 if (! isApplicableToPrimitive()) 602 602 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 603 603 for (Tag tag: tags) { 604 if (tag.getValue() == null || tag.getValue(). equals("")) {604 if (tag.getValue() == null || tag.getValue().isEmpty()) { 605 605 primitive.remove(tag.getKey()); 606 606 } else { 607 607 primitive.put(tag.getKey(), tag.getValue()); -
src/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) -
src/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 { … … 255 255 } else if (evt.getKey().equals("osm-server.url")) { 256 256 if (!(evt.getNewValue() instanceof StringSetting)) return; 257 257 String newValue = ((StringSetting) evt.getNewValue()).getValue(); 258 if (newValue == null || newValue.trim(). equals("")) {258 if (newValue == null || newValue.trim().isEmpty()) { 259 259 setAnonymous(); 260 260 } else if (isFullyIdentified()) { 261 261 setPartiallyIdentified(getUserName()); -
src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
603 603 public boolean isValid() { 604 604 String value = getComponent().getText().trim(); 605 605 try { 606 if (value. equals("")) {606 if (value.isEmpty()) { 607 607 tileIndex = 0; 608 608 } else { 609 609 tileIndex = Integer.parseInt(value); -
src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
461 461 case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break; 462 462 case RELATION: msg = trn("{0} relation", "{0} relations", numPrimitives, numPrimitives); break; 463 463 } 464 text = text. equals("") ? msg : text + ", " + msg;464 text = text.isEmpty() ? msg : text + ", " + msg; 465 465 } 466 466 setText(text); 467 467 } -
src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
173 173 public Command buildTagApplyCommands(Collection<? extends OsmPrimitive> primitives) { 174 174 if (!cbTagRelations.isSelected()) 175 175 return null; 176 if (tfKey.getText().trim(). equals(""))176 if (tfKey.getText().trim().isEmpty()) 177 177 return null; 178 if (tfValue.getText().trim(). equals(""))178 if (tfValue.getText().trim().isEmpty()) 179 179 return null; 180 180 if (primitives == null || primitives.isEmpty()) 181 181 return null; -
src/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 { -
src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
183 183 184 184 protected void validate() { 185 185 String value = tfUrl.getText(); 186 if (value.trim(). equals("")) {186 if (value.trim().isEmpty()) { 187 187 feedbackNone(); 188 188 return; 189 189 } -
src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
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 } -
src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
339 339 String value = values.getEditor().getItem().toString().trim(); 340 340 // is not Java 1.5 341 341 //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC); 342 if (value. equals("")) {342 if (value.isEmpty()) { 343 343 value = null; // delete the key 344 344 } 345 345 String newkey = keys.getEditor().getItem().toString().trim(); 346 346 //newkey = java.text.Normalizer.normalize(newkey, java.text.Normalizer.Form.NFC); 347 if (newkey. equals("")) {347 if (newkey.isEmpty()) { 348 348 newkey = key; 349 349 value = null; // delete the key instead 350 350 } -
src/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) { -
src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
201 201 JOptionPane.QUESTION_MESSAGE) 202 202 ); 203 203 b.setArea(currentArea); 204 if (b.getName() != null && !b.getName(). equals("")) {204 if (b.getName() != null && !b.getName().isEmpty()) { 205 205 ((DefaultListModel)bookmarks.getModel()).addElement(b); 206 206 bookmarks.save(); 207 207 } -
src/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() { -
src/org/openstreetmap/josm/gui/io/FilenameCellEditor.java
114 114 115 115 @Override 116 116 public boolean stopCellEditing() { 117 if (tfFileName.getText() == null || tfFileName.getText().trim(). equals("")) {117 if (tfFileName.getText() == null || tfFileName.getText().trim().isEmpty()) { 118 118 value = null; 119 119 } else { 120 120 value = new File(tfFileName.getText()); -
src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java
225 225 226 226 @Override 227 227 public boolean stopCellEditing() { 228 if (tfFilename.getText() == null || tfFilename.getText().trim(). equals("")) {228 if (tfFilename.getText() == null || tfFilename.getText().trim().isEmpty()) { 229 229 value = null; 230 230 } else { 231 231 value = new File(tfFilename.getText()); -
src/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 } -
src/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 -
src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
440 440 class SearchFieldAdapter implements DocumentListener { 441 441 public void filter() { 442 442 String expr = tfFilter.getText().trim(); 443 if (expr. equals("")) {443 if (expr.isEmpty()) { 444 444 expr = null; 445 445 } 446 446 model.filterDisplayedPlugins(expr); -
src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
1082 1082 new Comparator<String>() { 1083 1083 @Override 1084 1084 public int compare(String o1, String o2) { 1085 if (o1. equals("") && o2.equals(""))1085 if (o1.isEmpty() && o2.isEmpty()) 1086 1086 return 0; 1087 if (o1. equals("")) return 1;1088 if (o2. equals("")) return -1;1087 if (o1.isEmpty()) return 1; 1088 if (o2.isEmpty()) return -1; 1089 1089 return o1.compareTo(o2); 1090 1090 } 1091 1091 } … … 1240 1240 ExtendedSourceEntry last = null; 1241 1241 1242 1242 while ((line = reader.readLine()) != null && !canceled) { 1243 if (line.trim(). equals("")) {1243 if (line.trim().isEmpty()) { 1244 1244 continue; // skip empty lines 1245 1245 } 1246 1246 if (line.startsWith("\t")) { -
src/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); … … 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 } -
src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
197 197 198 198 protected void updateEnabledState() { 199 199 boolean enabled = 200 !tfOsmServerUrl.getText().trim(). equals("")200 !tfOsmServerUrl.getText().trim().isEmpty() 201 201 && !tfOsmServerUrl.getText().trim().equals(lastTestedUrl); 202 202 if (enabled) { 203 203 lblValid.setIcon(null); … … 235 235 236 236 @Override 237 237 public boolean isValid() { 238 if (getComponent().getText().trim(). equals(""))238 if (getComponent().getText().trim().isEmpty()) 239 239 return false; 240 240 241 241 try { … … 248 248 249 249 @Override 250 250 public void validate() { 251 if (getComponent().getText().trim(). equals("")) {251 if (getComponent().getText().trim().isEmpty()) { 252 252 feedbackInvalid(tr("OSM API URL must not be empty. Please enter the OSM API URL.")); 253 253 return; 254 254 } -
src/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 } -
src/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.isEmpty()) 120 120 return null; 121 121 try { 122 122 return Integer.parseInt(str); -
src/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 } -
src/org/openstreetmap/josm/io/ChangesetQuery.java
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); -
src/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; -
src/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()) { // FIX ? same check 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 -
src/org/openstreetmap/josm/io/OsmApiException.java
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)); -
src/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() { -
src/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\\(([^,]+),([^}]+)\\)\\}"); -
src/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 -
src/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 -
src/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 -
src/org/openstreetmap/josm/plugins/PluginHandler.java
1182 1182 for (final PluginProxy pp : pluginList) { 1183 1183 PluginInformation pi = pp.getPluginInformation(); 1184 1184 pl.remove(pi.name); 1185 pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion. equals("")1185 pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion.isEmpty() 1186 1186 ? pi.localversion : "unknown") + ")"); 1187 1187 } 1188 1188 Collections.sort(pl); … … 1197 1197 for (final PluginProxy p : pluginList) { 1198 1198 final PluginInformation info = p.getPluginInformation(); 1199 1199 String name = info.name 1200 + (info.version != null && !info.version. equals("") ? " Version: " + info.version : "");1200 + (info.version != null && !info.version.isEmpty() ? " Version: " + info.version : ""); 1201 1201 pluginTab.add(new JLabel(name), GBC.std()); 1202 1202 pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 1203 1203 pluginTab.add(new JButton(new AbstractAction(tr("Information")) { -
src/org/openstreetmap/josm/tools/ExceptionUtil.java
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(); -
src/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; -
src/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();