Ticket #8902: emptystring.diff

File emptystring.diff, 44.1 KB (added by shinigami, 11 years ago)

some of string.equals("") => string.isEmpty()

  • src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

     
    237237
    238238        @Override
    239239        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() &&
    241241                    OffsetBookmark.getBookmarkByName(layer, tBookmarkName.getText()) != null) {
    242242                if (!confirmOverwriteBookmark()) return;
    243243            }
     
    251251            offsetDialog = null;
    252252            if (getValue() != 1) {
    253253                layer.setOffset(oldDx, oldDy);
    254             } else if (tBookmarkName.getText() != null && !"".equals(tBookmarkName.getText())) {
     254            } else if (tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty()) {
    255255                OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer);
    256256            }
    257257            Main.main.menu.imageryMenu.refreshOffsetMenu();
  • src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java

     
    125125            // Checks clipboard contents against current service if no match has been found yet.
    126126            // If the contents match, they will be inserted into the text field and the corresponding
    127127            // service will be pre-selected.
    128             if(!clip.equals("") && tfWmsUrl.getText().equals("")
     128            if(!clip.isEmpty() && tfWmsUrl.getText().isEmpty()
    129129                    && (s.urlRegEx.matcher(clip).find() || s.idValidator.matcher(clip).matches())) {
    130130                serviceBtn.setSelected(true);
    131131                tfWmsUrl.setText(clip);
    132132            }
    133133            s.btn = serviceBtn;
    134134            group.add(serviceBtn);
    135             if(!s.url.equals("")) {
     135            if(!s.url.isEmpty()) {
    136136                panel.add(serviceBtn, GBC.std());
    137137                panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST));
    138138            } else {
     
    141141        }
    142142
    143143        // Fallback in case no match was found
    144         if(tfWmsUrl.getText().equals("") && firstBtn != null) {
     144        if(tfWmsUrl.getText().isEmpty() && firstBtn != null) {
    145145            firstBtn.setSelected(true);
    146146        }
    147147
     
    174174
    175175                // We've reached the custom WMS URL service
    176176                // Just set the URL and hope everything works out
    177                 if(s.wmsUrl.equals("")) {
     177                if(s.wmsUrl.isEmpty()) {
    178178                    addWMSLayer(s.name + " (" + text + ")", text);
    179179                    break outer;
    180180                }
  • src/org/openstreetmap/josm/actions/search/SearchCompiler.java

     
    679679
    680680        @Override public boolean match(OsmPrimitive osm) {
    681681            if (!osm.hasKeys() && osm.getUser() == null)
    682                 return search.equals("");
     682                return search.isEmpty();
    683683
    684684            for (String key: osm.keySet()) {
    685685                String value = osm.get(key);
  • src/org/openstreetmap/josm/data/Preferences.java

     
    440440    synchronized public String get(final String key, final String def) {
    441441        putDefault(key, def);
    442442        final String prop = properties.get(key);
    443         if (prop == null || prop.equals(""))
     443        if (prop == null || prop.isEmpty())
    444444            return def;
    445445        return prop;
    446446    }
     
    773773        }
    774774        putDefault("color."+colKey, ColorHelper.color2html(def));
    775775        String colStr = specName != null ? get("color."+specName) : "";
    776         if(colStr.equals("")) {
     776        if(colStr.isEmpty()) {
    777777            colStr = get("color."+colKey);
    778778        }
    779         return colStr.equals("") ? def : ColorHelper.html2color(colStr);
     779        return colStr.isEmpty() ? def : ColorHelper.html2color(colStr);
    780780    }
    781781
    782782    synchronized public Color getDefaultColor(String colKey) {
    783783        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);
    785785    }
    786786
    787787    synchronized public boolean putColor(String colKey, Color val) {
  • src/org/openstreetmap/josm/data/Version.java

     
    7878        if (content == null) return properties;
    7979        Pattern p = Pattern.compile("^([^:]+):(.*)$");
    8080        for (String line: content.split("\n")) {
    81             if (line == null || line.trim().equals("")) {
     81            if (line == null || line.trim().isEmpty()) {
    8282                continue;
    8383            }
    8484            if (line.matches("^\\s*#.*$")) {
  • src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

     
    126126
    127127    // some additional checks to respect extended URLs in preferences (legacy workaround)
    128128    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)));
    130130    }
    131131
    132132    public void add(ImageryInfo info) {
  • src/org/openstreetmap/josm/data/osm/TagCollection.java

     
    601601        if (! isApplicableToPrimitive())
    602602            throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values."));
    603603        for (Tag tag: tags) {
    604             if (tag.getValue() == null || tag.getValue().equals("")) {
     604            if (tag.getValue() == null || tag.getValue().isEmpty()) {
    605605                primitive.remove(tag.getKey());
    606606            } else {
    607607                primitive.put(tag.getKey(), tag.getValue());
  • src/org/openstreetmap/josm/gui/ExtendedDialog.java

     
    572572     * @return true if dialog should not be shown again
    573573     */
    574574    private boolean toggleCheckState(String togglePref) {
    575         toggleable = togglePref != null && !togglePref.equals("");
     575        toggleable = togglePref != null && !togglePref.isEmpty();
    576576
    577577        toggleValue = Main.pref.getInteger("message."+togglePref+".value", -1);
    578578        // No identifier given, so return false (= show the dialog)
  • src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

     
    101101     */
    102102    public void setPartiallyIdentified(String userName) throws IllegalArgumentException {
    103103        CheckParameterUtil.ensureParameterNotNull(userName, "userName");
    104         if (userName.trim().equals(""))
     104        if (userName.trim().isEmpty())
    105105            throw new IllegalArgumentException(MessageFormat.format("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName));
    106106        this.userName = userName;
    107107        userInfo = null;
     
    119119     */
    120120    public void setFullyIdentified(String username, UserInfo userinfo) throws IllegalArgumentException {
    121121        CheckParameterUtil.ensureParameterNotNull(username, "username");
    122         if (username.trim().equals(""))
     122        if (username.trim().isEmpty())
    123123            throw new IllegalArgumentException(tr("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName));
    124124        CheckParameterUtil.ensureParameterNotNull(userinfo, "userinfo");
    125125        this.userName = username;
     
    191191    public void initFromPreferences() {
    192192        String userName = CredentialsManager.getInstance().getUsername();
    193193        if (isAnonymous()) {
    194             if (userName != null && ! userName.trim().equals("")) {
     194            if (userName != null && !userName.trim().isEmpty()) {
    195195                setPartiallyIdentified(userName);
    196196            }
    197197        } else {
     
    255255        } else if (evt.getKey().equals("osm-server.url")) {
    256256            if (!(evt.getNewValue() instanceof StringSetting)) return;
    257257            String newValue = ((StringSetting) evt.getNewValue()).getValue();
    258             if (newValue == null || newValue.trim().equals("")) {
     258            if (newValue == null || newValue.trim().isEmpty()) {
    259259                setAnonymous();
    260260            } else if (isFullyIdentified()) {
    261261                setPartiallyIdentified(getUserName());
  • src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

     
    603603        public boolean isValid() {
    604604            String value = getComponent().getText().trim();
    605605            try {
    606                 if (value.equals("")) {
     606                if (value.isEmpty()) {
    607607                    tileIndex = 0;
    608608                } else {
    609609                    tileIndex = Integer.parseInt(value);
  • src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java

     
    461461                case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break;
    462462                case RELATION: msg = trn("{0} relation", "{0} relations", numPrimitives, numPrimitives); break;
    463463                }
    464                 text = text.equals("") ? msg : text + ", " + msg;
     464                text = text.isEmpty() ? msg : text + ", " + msg;
    465465            }
    466466            setText(text);
    467467        }
  • src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java

     
    173173    public Command buildTagApplyCommands(Collection<? extends OsmPrimitive> primitives) {
    174174        if (!cbTagRelations.isSelected())
    175175            return null;
    176         if (tfKey.getText().trim().equals(""))
     176        if (tfKey.getText().trim().isEmpty())
    177177            return null;
    178         if (tfValue.getText().trim().equals(""))
     178        if (tfValue.getText().trim().isEmpty())
    179179            return null;
    180180        if (primitives == null || primitives.isEmpty())
    181181            return null;
  • src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java

     
    4747
    4848    protected void renderUploadComment(Changeset cs) {
    4949        String comment = cs.get("comment");
    50         if (comment == null || comment.trim().equals("")) {
     50        if (comment == null || comment.trim().isEmpty()) {
    5151            setText(trc("changeset.upload-comment", "empty"));
    5252            setFont(UIManager.getFont("Table.font").deriveFont(Font.ITALIC));
    5353        } else {
     
    6868
    6969    protected void renderUser(Changeset cs) {
    7070        User user = cs.getUser();
    71         if (user == null || user.getName().trim().equals("")) {
     71        if (user == null || user.getName().trim().isEmpty()) {
    7272            setFont(UIManager.getFont("Table.font").deriveFont(Font.ITALIC));
    7373            setText(tr("anonymous"));
    7474        } else {
  • src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java

     
    183183
    184184        protected void validate() {
    185185            String value = tfUrl.getText();
    186             if (value.trim().equals("")) {
     186            if (value.trim().isEmpty()) {
    187187                feedbackNone();
    188188                return;
    189189            }
  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

     
    10481048                            ((Relation)membershipData.getValueAt(row, 0)).get("type"), "UTF-8"
    10491049                            );
    10501050
    1051                     if (type != null && !type.equals("")) {
     1051                    if (type != null && !type.isEmpty()) {
    10521052                        uris.add(new URI(String.format("%s%sRelation:%s", base, lang, type)));
    10531053                        uris.add(new URI(String.format("%sRelation:%s", base, type)));
    10541054                    }
  • src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

     
    339339            String value = values.getEditor().getItem().toString().trim();
    340340            // is not Java 1.5
    341341            //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC);
    342             if (value.equals("")) {
     342            if (value.isEmpty()) {
    343343                value = null; // delete the key
    344344            }
    345345            String newkey = keys.getEditor().getItem().toString().trim();
    346346            //newkey = java.text.Normalizer.normalize(newkey, java.text.Normalizer.Form.NFC);
    347             if (newkey.equals("")) {
     347            if (newkey.isEmpty()) {
    348348                newkey = key;
    349349                value = null; // delete the key instead
    350350            }
  • src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

     
    15721572        }
    15731573
    15741574        protected boolean isEmptyRole() {
    1575             return tfRole.getText() == null || tfRole.getText().trim().equals("");
     1575            return tfRole.getText() == null || tfRole.getText().trim().isEmpty();
    15761576        }
    15771577
    15781578        protected boolean confirmSettingEmptyRole(int onNumMembers) {
  • src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

     
    201201                            JOptionPane.QUESTION_MESSAGE)
    202202            );
    203203            b.setArea(currentArea);
    204             if (b.getName() != null && !b.getName().equals("")) {
     204            if (b.getName() != null && !b.getName().isEmpty()) {
    205205                ((DefaultListModel)bookmarks.getModel()).addElement(b);
    206206                bookmarks.save();
    207207            }
  • src/org/openstreetmap/josm/gui/io/CredentialDialog.java

     
    229229            password = password == null ? "" : password;
    230230            tfUserName.setText(username);
    231231            tfPassword.setText(password);
    232             cbSaveCredentials.setSelected(!username.equals("") && ! password.equals(""));
     232            cbSaveCredentials.setSelected(!username.isEmpty() && !password.isEmpty());
    233233        }
    234234
    235235        public void startUserInput() {
  • src/org/openstreetmap/josm/gui/io/FilenameCellEditor.java

     
    114114
    115115    @Override
    116116    public boolean stopCellEditing() {
    117         if (tfFileName.getText() == null || tfFileName.getText().trim().equals("")) {
     117        if (tfFileName.getText() == null || tfFileName.getText().trim().isEmpty()) {
    118118            value = null;
    119119        } else {
    120120            value = new File(tfFileName.getText());
  • src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

     
    225225
    226226    @Override
    227227    public boolean stopCellEditing() {
    228         if (tfFilename.getText() == null || tfFilename.getText().trim().equals("")) {
     228        if (tfFilename.getText() == null || tfFilename.getText().trim().isEmpty()) {
    229229            value = null;
    230230        } else {
    231231            value = new File(tfFilename.getText());
  • src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

     
    5555        if (comment.equals(commentInTag))
    5656            return;
    5757
    58         if (comment.equals("")) {
     58        if (comment.isEmpty()) {
    5959            pnlTagEditor.getModel().delete("comment");
    6060            return;
    6161        }
  • src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java

     
    182182
    183183        @Override
    184184        public boolean isValid() {
    185             return ! getComponent().getText().trim().equals("");
     185            return !getComponent().getText().trim().isEmpty();
    186186        }
    187187
    188188        @Override
     
    202202
    203203        @Override
    204204        public boolean isValid() {
    205             return ! getComponent().getText().trim().equals("");
     205            return !getComponent().getText().trim().isEmpty();
    206206        }
    207207
    208208        @Override
  • src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

     
    440440    class SearchFieldAdapter implements DocumentListener {
    441441        public void filter() {
    442442            String expr = tfFilter.getText().trim();
    443             if (expr.equals("")) {
     443            if (expr.isEmpty()) {
    444444                expr = null;
    445445            }
    446446            model.filterDisplayedPlugins(expr);
  • src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

     
    10821082                    new Comparator<String>() {
    10831083                        @Override
    10841084                        public int compare(String o1, String o2) {
    1085                             if (o1.equals("") && o2.equals(""))
     1085                            if (o1.isEmpty() && o2.isEmpty())
    10861086                                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;
    10891089                            return o1.compareTo(o2);
    10901090                        }
    10911091                    }
     
    12401240                ExtendedSourceEntry last = null;
    12411241
    12421242                while ((line = reader.readLine()) != null && !canceled) {
    1243                     if (line.trim().equals("")) {
     1243                    if (line.trim().isEmpty()) {
    12441244                        continue; // skip empty lines
    12451245                    }
    12461246                    if (line.startsWith("\t")) {
  • src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java

     
    4444
    4545    protected String formatPluginRemoteVersion(PluginInformation pi) {
    4646        StringBuilder sb = new StringBuilder();
    47         if (pi.version == null || pi.version.trim().equals("")) {
     47        if (pi.version == null || pi.version.trim().isEmpty()) {
    4848            sb.append(tr("unknown"));
    4949        } else {
    5050            sb.append(pi.version);
     
    5757
    5858    protected String formatPluginLocalVersion(PluginInformation pi) {
    5959        if (pi == null) return tr("unknown");
    60         if (pi.localversion == null || pi.localversion.trim().equals(""))
     60        if (pi.localversion == null || pi.localversion.trim().isEmpty())
    6161            return tr("unknown");
    6262        return pi.localversion;
    6363    }
  • src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

     
    197197
    198198        protected void updateEnabledState() {
    199199            boolean enabled =
    200                 !tfOsmServerUrl.getText().trim().equals("")
     200                !tfOsmServerUrl.getText().trim().isEmpty()
    201201                && !tfOsmServerUrl.getText().trim().equals(lastTestedUrl);
    202202            if (enabled) {
    203203                lblValid.setIcon(null);
     
    235235
    236236        @Override
    237237        public boolean isValid() {
    238             if (getComponent().getText().trim().equals(""))
     238            if (getComponent().getText().trim().isEmpty())
    239239                return false;
    240240
    241241            try {
     
    248248
    249249        @Override
    250250        public void validate() {
    251             if (getComponent().getText().trim().equals("")) {
     251            if (getComponent().getText().trim().isEmpty()) {
    252252                feedbackInvalid(tr("OSM API URL must not be empty. Please enter the OSM API URL."));
    253253                return;
    254254            }
  • src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java

     
    148148            break;
    149149        case 1:
    150150            String v = (String)value;
    151             if (tag.getValueCount() > 1 && ! v.equals("")) {
     151            if (tag.getValueCount() > 1 && !v.isEmpty()) {
    152152                updateTagValue(tag, v);
    153153            } else if (tag.getValueCount() <= 1) {
    154154                updateTagValue(tag, v);
     
    429429
    430430            // tag name holds an empty key. Don't apply it to the selection.
    431431            //
    432             if (tag.getName().trim().equals("") || tag.getValue().trim().equals("")) {
     432            if (tag.getName().trim().isEmpty() || tag.getValue().trim().isEmpty()) {
    433433                continue;
    434434            }
    435435            tags.put(tag.getName().trim(), tag.getValue().trim());
     
    475475
    476476        // tag name holds an empty key. Don't apply it to the selection.
    477477        //
    478         if (tag.getName().trim().equals(""))
     478        if (tag.getName().trim().isEmpty())
    479479            return null;
    480480
    481481        String newkey = tag.getName();
     
    516516    public List<String> getKeys() {
    517517        ArrayList<String> keys = new ArrayList<String>();
    518518        for (TagModel tag: tags) {
    519             if (!tag.getName().trim().equals("")) {
     519            if (!tag.getName().trim().isEmpty()) {
    520520                keys.add(tag.getName());
    521521            }
    522522        }
  • src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

     
    9696            if (value.equals(DIFFERENT))
    9797                return "<b>"+DIFFERENT.replaceAll("<", "&lt;").replaceAll(">", "&gt;")+"</b>";
    9898
    99             if (value.equals(""))
     99            if (value.isEmpty())
    100100                return "&nbsp;";
    101101
    102102            final StringBuilder res = new StringBuilder("<b>");
     
    116116        }
    117117
    118118        private Integer parseInteger(String str) {
    119             if (str == null || "".equals(str))
     119            if (str == null || str.isEmpty())
    120120                return null;
    121121            try {
    122122                return Integer.parseInt(str);
  • src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java

     
    149149
    150150                    @Override
    151151                    public void keyReleased(KeyEvent e) {
    152                         if (getText().equals("")) {
     152                        if (getText().isEmpty()) {
    153153                            applyFilter("");
    154154                        }
    155155                    }
  • src/org/openstreetmap/josm/io/ChangesetQuery.java

     
    301301
    302302    public static class ChangesetQueryUrlParser {
    303303        protected int parseUid(String value) throws ChangesetQueryUrlException {
    304             if (value == null || value.trim().equals(""))
     304            if (value == null || value.trim().isEmpty())
    305305                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid",value));
    306306            int id;
    307307            try {
     
    315315        }
    316316
    317317        protected boolean parseOpen(String value) throws ChangesetQueryUrlException {
    318             if (value == null || value.trim().equals(""))
     318            if (value == null || value.trim().isEmpty())
    319319                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "open",value));
    320320            if (value.equals("true"))
    321321                return true;
     
    326326        }
    327327
    328328        protected boolean parseBoolean(String value, String parameter) throws ChangesetQueryUrlException {
    329             if (value == null || value.trim().equals(""))
     329            if (value == null || value.trim().isEmpty())
    330330                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter,value));
    331331            if (value.equals("true"))
    332332                return true;
     
    337337        }
    338338
    339339        protected Date parseDate(String value, String parameter) throws ChangesetQueryUrlException {
    340             if (value == null || value.trim().equals(""))
     340            if (value == null || value.trim().isEmpty())
    341341                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter,value));
    342342            if (value.endsWith("Z")) {
    343343                // OSM API generates date strings we time zone abbreviation "Z" which Java SimpleDateFormat
     
    435435            if (query == null)
    436436                return new ChangesetQuery();
    437437            query = query.trim();
    438             if (query.equals(""))
     438            if (query.isEmpty())
    439439                return new ChangesetQuery();
    440440            Map<String,String> queryParams  = createMapFromQueryString(query);
    441441            return crateFromMap(queryParams);
  • src/org/openstreetmap/josm/io/DefaultProxySelector.java

     
    107107        }
    108108        String host = Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST, null);
    109109        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) {
    111111            httpProxySocketAddress = new InetSocketAddress(host,port);
    112112        } else {
    113113            httpProxySocketAddress = null;
     
    119119
    120120        host = Main.pref.get(ProxyPreferencesPanel.PROXY_SOCKS_HOST, null);
    121121        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) {
    123123            socksProxySocketAddress = new InetSocketAddress(host,port);
    124124        } else {
    125125            socksProxySocketAddress = null;
  • src/org/openstreetmap/josm/io/NmeaReader.java

     
    234234    // Returns true if the input made sence, false otherwise.
    235235    private boolean ParseNMEASentence(String s, NMEAParserState ps) {
    236236        try {
    237             if (s.equals(""))
     237            if (s.isEmpty())
    238238                throw new NullPointerException();
    239239
    240240            // checksum check:
     
    303303                if(accu.equals("M")) {
    304304                    // Ignore heights that are not in meters for now
    305305                    accu=e[GPGGA.HEIGHT.position];
    306                     if(!accu.equals("")) {
     306                    if(!accu.isEmpty()) {
    307307                        Double.parseDouble(accu);
    308308                        // if it throws it's malformed; this should only happen if the
    309309                        // device sends nonstandard data.
    310                         if(!accu.equals("")) {
     310                        if(!accu.isEmpty()) { // FIX ? same check
    311311                            currentwp.attr.put("ele", accu);
    312312                        }
    313313                    }
     
    315315                // number of sattelites
    316316                accu=e[GPGGA.SATELLITE_COUNT.position];
    317317                int sat = 0;
    318                 if(!accu.equals("")) {
     318                if(!accu.isEmpty()) {
    319319                    sat = Integer.parseInt(accu);
    320320                    currentwp.attr.put("sat", accu);
    321321                }
    322322                // h-dilution
    323323                accu=e[GPGGA.HDOP.position];
    324                 if(!accu.equals("")) {
     324                if(!accu.isEmpty()) {
    325325                    currentwp.attr.put("hdop", Float.parseFloat(accu));
    326326                }
    327327                // fix
    328328                accu=e[GPGGA.QUALITY.position];
    329                 if(!accu.equals("")) {
     329                if(!accu.isEmpty()) {
    330330                    int fixtype = Integer.parseInt(accu);
    331331                    switch(fixtype) {
    332332                    case 0:
     
    352352                if(accu.equals("T")) {
    353353                    // other values than (T)rue are ignored
    354354                    accu = e[GPVTG.COURSE.position];
    355                     if(!accu.equals("")) {
     355                    if(!accu.isEmpty()) {
    356356                        Double.parseDouble(accu);
    357357                        currentwp.attr.put("course", accu);
    358358                    }
     
    361361                accu = e[GPVTG.SPEED_KMH_UNIT.position];
    362362                if(accu.startsWith("K")) {
    363363                    accu = e[GPVTG.SPEED_KMH.position];
    364                     if(!accu.equals("")) {
     364                    if(!accu.isEmpty()) {
    365365                        double speed = Double.parseDouble(accu);
    366366                        speed /= 3.6; // speed in m/s
    367367                        currentwp.attr.put("speed", Double.toString(speed));
     
    370370            } else if(e[0].equals("$GPGSA") || e[0].equals("$GNGSA")) {
    371371                // vdop
    372372                accu=e[GPGSA.VDOP.position];
    373                 if(!accu.equals("")) {
     373                if(!accu.isEmpty()) {
    374374                    currentwp.attr.put("vdop", Float.parseFloat(accu));
    375375                }
    376376                // hdop
    377377                accu=e[GPGSA.HDOP.position];
    378                 if(!accu.equals("")) {
     378                if(!accu.isEmpty()) {
    379379                    currentwp.attr.put("hdop", Float.parseFloat(accu));
    380380                }
    381381                // pdop
    382382                accu=e[GPGSA.PDOP.position];
    383                 if(!accu.equals("")) {
     383                if(!accu.isEmpty()) {
    384384                    currentwp.attr.put("pdop", Float.parseFloat(accu));
    385385                }
    386386            }
     
    411411                currentwp.attr.put("time", DateUtils.fromDate(d));
    412412                // speed
    413413                accu = e[GPRMC.SPEED.position];
    414                 if(!accu.equals("") && !currentwp.attr.containsKey("speed")) {
     414                if(!accu.isEmpty() && !currentwp.attr.containsKey("speed")) {
    415415                    double speed = Double.parseDouble(accu);
    416416                    speed *= 0.514444444; // to m/s
    417417                    currentwp.attr.put("speed", Double.toString(speed));
    418418                }
    419419                // course
    420420                accu = e[GPRMC.COURSE.position];
    421                 if(!accu.equals("") && !currentwp.attr.containsKey("course")) {
     421                if(!accu.isEmpty() && !currentwp.attr.containsKey("course")) {
    422422                    Double.parseDouble(accu);
    423423                    currentwp.attr.put("course", accu);
    424424                }
     
    463463
    464464        // return a zero latlon instead of null so it is logged as zero coordinate
    465465        // 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);
    467467
    468468        // The format is xxDDLL.LLLL
    469469        // xx optional whitespace
  • src/org/openstreetmap/josm/io/OsmApiException.java

     
    169169        if (errorHeader != null) {
    170170            sb.append(tr(errorHeader));
    171171            sb.append(tr("(Code={0})", responseCode));
    172         } else if (errorBody != null && !errorBody.trim().equals("")) {
     172        } else if (errorBody != null && !errorBody.trim().isEmpty()) {
    173173            errorBody = errorBody.trim();
    174174            sb.append(tr(errorBody));
    175175            sb.append(tr("(Code={0})", responseCode));
  • src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java

     
    4444         * file (username=="") and each time after authentication failed
    4545         * (noSuccessWithLastResponse == true).
    4646         */
    47         } else if (noSuccessWithLastResponse || username.equals("") || password.equals("")) {
     47        } else if (noSuccessWithLastResponse || username.isEmpty() || password.isEmpty()) {
    4848            GuiHelper.runInEDTAndWait(new Runnable() {
    4949                @Override
    5050                public void run() {
  • src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

     
    4646        super(mv, layer, localOnly);
    4747        this.info = layer.getInfo();
    4848        this.baseURL = info.getUrl();
    49         if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().equals("")) {
     49        if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().isEmpty()) {
    5050            props.put("Cookie", layer.getInfo().getCookies());
    5151        }
    5252        Pattern pattern = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}");
  • src/org/openstreetmap/josm/io/session/GpxTracksSessionImporter.java

     
    3232            XPath xpath = xPathFactory.newXPath();
    3333            XPathExpression fileExp = xpath.compile("file/text()");
    3434            String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING);
    35             if (fileStr == null || fileStr.equals("")) {
     35            if (fileStr == null || fileStr.isEmpty()) {
    3636                throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex()));
    3737            }
    3838
  • src/org/openstreetmap/josm/io/session/MarkerSessionImporter.java

     
    3636            XPath xpath = xPathFactory.newXPath();
    3737            XPathExpression fileExp = xpath.compile("file/text()");
    3838            String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING);
    39             if (fileStr == null || fileStr.equals("")) {
     39            if (fileStr == null || fileStr.isEmpty()) {
    4040                throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex()));
    4141            }
    4242
  • src/org/openstreetmap/josm/io/session/OsmDataSessionImporter.java

     
    3333            XPath xpath = xPathFactory.newXPath();
    3434            XPathExpression fileExp = xpath.compile("file/text()");
    3535            String fileStr = (String) fileExp.evaluate(elem, XPathConstants.STRING);
    36             if (fileStr == null || fileStr.equals("")) {
     36            if (fileStr == null || fileStr.isEmpty()) {
    3737                throw new IllegalDataException(tr("File name expected for layer no. {0}", support.getLayerIndex()));
    3838            }
    3939
  • src/org/openstreetmap/josm/plugins/PluginHandler.java

     
    11821182        for (final PluginProxy pp : pluginList) {
    11831183            PluginInformation pi = pp.getPluginInformation();
    11841184            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()
    11861186                    ? pi.localversion : "unknown") + ")");
    11871187        }
    11881188        Collections.sort(pl);
     
    11971197        for (final PluginProxy p : pluginList) {
    11981198            final PluginInformation info = p.getPluginInformation();
    11991199            String name = info.name
    1200             + (info.version != null && !info.version.equals("") ? " Version: " + info.version : "");
     1200            + (info.version != null && !info.version.isEmpty() ? " Version: " + info.version : "");
    12011201            pluginTab.add(new JLabel(name), GBC.std());
    12021202            pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
    12031203            pluginTab.add(new JButton(new AbstractAction(tr("Information")) {
  • src/org/openstreetmap/josm/tools/ExceptionUtil.java

     
    428428     */
    429429    public static String explainGeneric(Exception e) {
    430430        String msg = e.getMessage();
    431         if (msg == null || msg.trim().equals("")) {
     431        if (msg == null || msg.trim().isEmpty()) {
    432432            msg = e.toString();
    433433        }
    434434        e.printStackTrace();
  • src/org/openstreetmap/josm/tools/ImageProvider.java

     
    402402
    403403            if (subdir == null) {
    404404                subdir = "";
    405             } else if (!subdir.equals("")) {
     405            } else if (!subdir.isEmpty()) {
    406406                subdir += "/";
    407407            }
    408408            String[] extensions;
  • src/org/openstreetmap/josm/tools/WindowGeometry.java

     
    162162
    163163    protected void initFromPreferences(String preferenceKey) throws WindowGeometryException {
    164164        String value = Main.pref.get(preferenceKey);
    165         if (value == null || value.equals(""))
     165        if (value == null || value.isEmpty())
    166166            throw new WindowGeometryException(tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey));
    167167        topLeft = new Point();
    168168        extent = new Dimension();