Ticket #8902: perf.patch

File perf.patch, 242.7 KB (added by shinigami, 11 years ago)
  • org/openstreetmap/josm/actions/CombineWayAction.java

     
    296296        @Override
    297297        public String toString() {
    298298            return new StringBuilder()
    299             .append("[")
     299            .append('[')
    300300            .append(a.getId())
    301             .append(",")
     301            .append(',')
    302302            .append(b.getId())
    303             .append("]")
     303            .append(']')
    304304            .toString();
    305305        }
    306306
  • org/openstreetmap/josm/actions/CopyAction.java

     
    5050        /* copy ids to the clipboard */
    5151        StringBuilder idsBuilder = new StringBuilder();
    5252        for (OsmPrimitive p : primitives) {
    53             idsBuilder.append(p.getId()).append(",");
     53            idsBuilder.append(p.getId()).append(',');
    5454        }
    5555        String ids = idsBuilder.substring(0, idsBuilder.length() - 1);
    5656        Utils.copyToClipboard(ids);
  • org/openstreetmap/josm/actions/CopyCoordinatesAction.java

     
    3131            s.append(n.getCoor().lat());
    3232            s.append(", ");
    3333            s.append(n.getCoor().lon());
    34             s.append("\n");
     34            s.append('\n');
    3535        }
    3636        Utils.copyToClipboard(s.toString().trim());
    3737    }
  • org/openstreetmap/josm/actions/ExtensionFileFilter.java

     
    249249    public boolean acceptName(String filename) {
    250250        String name = filename.toLowerCase();
    251251        for (String ext : extensions.split(","))
    252             if (name.endsWith("."+ext))
     252            if (name.endsWith('.' +ext))
    253253                return true;
    254254        return false;
    255255    }
  • org/openstreetmap/josm/actions/HistoryInfoWebAction.java

     
    2424    @Override
    2525    protected  String createInfoUrl(Object infoObject) {
    2626        OsmPrimitive primitive = (OsmPrimitive) infoObject;
    27         return getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId() + "/history";
     27        return getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId() + "/history";
    2828    }
    2929}
  • org/openstreetmap/josm/actions/ImageryAdjustAction.java

     
    216216            int precision = Main.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7;
    217217            // US locale to force decimal separator to be '.'
    218218            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',
    220220                    layer.getDx(), layer.getDy()).toString());
    221221        }
    222222
     
    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() != 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() != null && !tBookmarkName.getText().isEmpty()) {
    255255                OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer);
    256256            }
    257257            Main.main.menu.imageryMenu.refreshOffsetMenu();
  • org/openstreetmap/josm/actions/InfoWebAction.java

     
    2424    @Override
    2525    protected  String createInfoUrl(Object infoObject) {
    2626        OsmPrimitive primitive = (OsmPrimitive)infoObject;
    27         return getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId();
     27        return getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId();
    2828    }
    2929}
  • 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("")) {
    178                     addWMSLayer(s.name + " (" + text + ")", text);
     177                if(s.wmsUrl.isEmpty()) {
     178                    addWMSLayer(s.name + " (" + text + ')', text);
    179179                    break outer;
    180180                }
    181181
     
    184184                if(m.find()) {
    185185                    String id = m.group(1);
    186186                    String newURL = s.wmsUrl.replaceAll("__s__", id);
    187                     String title = s.name + " (" + id + ")";
     187                    String title = s.name + " (" + id + ')';
    188188                    addWMSLayer(title, newURL);
    189189                    break outer;
    190190                }
    191191                // If not, look if it's a valid ID for the selected service
    192192                if(s.idValidator.matcher(text).matches()) {
    193193                    String newURL = s.wmsUrl.replaceAll("__s__", text);
    194                     String title = s.name + " (" + text + ")";
     194                    String title = s.name + " (" + text + ')';
    195195                    addWMSLayer(title, newURL);
    196196                    break outer;
    197197                }
  • org/openstreetmap/josm/actions/PasteTagsAction.java

     
    271271        String v;
    272272        for (String key: tags.keySet()) {
    273273            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));
    275275        }
    276276        commitCommands(selection, commands);
    277277        return !commands.isEmpty();
     
    288288        PasteTagsAction.TagPaster tagPaster = new PasteTagsAction.TagPaster(directlyAdded, selection);
    289289        List<Command> commands = new ArrayList<Command>();
    290290        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()));
    292292        }
    293293        commitCommands(selection, commands);
    294294        return true;
     
    304304            String title2 = trn("to {0} object", "to {0} objects", selection.size(), selection.size());
    305305            Main.main.undoRedo.add(
    306306                    new SequenceCommand(
    307                             title1 + " " + title2,
     307                            title1 + ' ' + title2,
    308308                            commands
    309309                    ));
    310310        }
  • org/openstreetmap/josm/actions/PurgeAction.java

     
    243243                    return (Long.valueOf(o1.getUniqueId())).compareTo(o2.getUniqueId());
    244244                }
    245245            });
    246             JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[0]));
     246            JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));
    247247            /* force selection to be active for all entries */
    248248            list.setCellRenderer(new OsmPrimitivRenderer() {
    249249                @Override
  • org/openstreetmap/josm/actions/RenameLayerAction.java

     
    7777            Main.pref.put("layer.rename-file", filerename.isSelected());
    7878            if (filerename.isSelected()) {
    7979                String newname = nameText;
    80                 if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1) {
     80                if (newname.indexOf('/') == -1 && newname.indexOf('\\') == -1) {
    8181                    newname = file.getParent() + File.separator + newname;
    8282                }
    8383                String oldname = file.getName();
  • org/openstreetmap/josm/actions/RestartAction.java

     
    8989            } else {
    9090                // else it's a .class, add the classpath and mainClass
    9191                cmd.add("-cp");
    92                 cmd.add("\"" + System.getProperty("java.class.path") + "\"");
     92                cmd.add('"' + System.getProperty("java.class.path") + '"');
    9393                cmd.add(mainCommand[0]);
    9494            }
    9595            // finally add program arguments
     
    101101                @Override
    102102                public void run() {
    103103                    try {
    104                         Runtime.getRuntime().exec(cmd.toArray(new String[]{}));
     104                        Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
    105105                    } catch (IOException e) {
    106106                        e.printStackTrace();
    107107                    }
  • org/openstreetmap/josm/actions/SaveActionBase.java

     
    159159            // No filefilter accepts current filename, add default extension
    160160            String fn = file.getPath();
    161161            if (ff instanceof ExtensionFileFilter) {
    162                 fn += "." + ((ExtensionFileFilter)ff).getDefaultExtension();
     162                fn += '.' + ((ExtensionFileFilter)ff).getDefaultExtension();
    163163            } else if (extension != null) {
    164                 fn += "." + extension;
     164                fn += '.' + extension;
    165165            }
    166166            file = new File(fn);
    167167            if (!confirmOverwrite(file))
  • org/openstreetmap/josm/actions/ShowStatusReportAction.java

     
    5959
    6060    private static void shortenParam(ListIterator<String> it, String[] param, String source, String target) {
    6161        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));
    6363        }
    6464    }
    6565
     
    7171    {
    7272        StringBuilder text = new StringBuilder();
    7373        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');
    7777        text.append("Memory Usage: ");
    7878        text.append(Runtime.getRuntime().totalMemory()/1024/1024);
    7979        text.append(" MB / ");
     
    8181        text.append(" MB (");
    8282        text.append(Runtime.getRuntime().freeMemory()/1024/1024);
    8383        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');
    8787        try {
    8888            final String env_java_home = System.getenv("JAVA_HOME");
    8989            final String env_java_home_alt = Main.platform instanceof PlatformHookWindows ? "%JAVA_HOME%" : "${JAVA_HOME}";
     
    106106                }
    107107            }
    108108            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');
    111111            }
    112112        } catch (SecurityException e) {
    113113            // Ignore exception
    114114        }
    115115        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');
    118118        }
    119119        if (Main.main != null) {
    120120            DataSet dataset = Main.main.getCurrentDataSet();
     
    123123                if (result.length() == 0) {
    124124                    text.append("Dataset consistency test: No problems found\n");
    125125                } else {
    126                     text.append("\nDataset consistency test:\n"+result+"\n");
     126                    text.append("\nDataset consistency test:\n").append(result).append('\n');
    127127                }
    128128            }
    129129        }
    130         text.append("\n");
     130        text.append('\n');
    131131        text.append(PluginHandler.getBugReportText());
    132         text.append("\n");
     132        text.append('\n');
    133133
    134134        return text.toString();
    135135    }
     
    151151                }
    152152            }
    153153            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');
    155155            }
    156156        } catch (Exception x) {
    157157            x.printStackTrace();
  • org/openstreetmap/josm/actions/UnGlueAction.java

     
    120120            }
    121121        } else {
    122122            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' +
    132132                tr("Note: If a way is selected, this way will get fresh copies of the unglued\n"+
    133133                        "nodes and the new nodes will be selected. Otherwise, all ways will get their\n"+
    134134                "own copy and all nodes will be selected.");
  • org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

     
    321321            String urlString = url.toExternalForm();
    322322            if (urlString.matches(PATTERN_OSM_API_URL)) {
    323323                // 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>" +
    325325                        tr("Command")+": "+url.getPath()+"</li>";
    326326                if (url.getQuery() != null) {
    327327                    message += "<li>" + tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", ")) + "</li>";
  • org/openstreetmap/josm/actions/mapmode/DrawAction.java

     
    12091209         */
    12101210        if (currentBaseNode != null && !wayIsFinished) {
    12111211            if (alt) {
    1212                 rv += " " + tr("Start new way from last node.");
     1212                rv += ' ' + tr("Start new way from last node.");
    12131213            } else {
    1214                 rv += " " + tr("Continue way from last node.");
     1214                rv += ' ' + tr("Continue way from last node.");
    12151215            }
    12161216            if (snapHelper.isSnapOn()) {
    1217                 rv += " "+ tr("Angle snapping active.");
     1217                rv += ' ' + tr("Angle snapping active.");
    12181218            }
    12191219        }
    12201220
     
    12371237            Way w = getCurrentDataSet().getSelectedWays().iterator().next();
    12381238            for (Node m : w.getNodes()) {
    12391239                if (m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) {
    1240                     rv += " " + tr("Finish drawing.");
     1240                    rv += ' ' + tr("Finish drawing.");
    12411241                    break;
    12421242                }
    12431243            }
  • org/openstreetmap/josm/actions/mapmode/SelectAction.java

     
    884884                return tr("Release the mouse button to select the objects in the rectangle.");
    885885            else if (mode == Mode.move && (System.currentTimeMillis() - mouseDownTime >= initialMoveDelay)) {
    886886                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.")) : "";
    888888                return tr("Release the mouse button to stop moving.") + mergeHelp;
    889889            } else if (mode == Mode.rotate)
    890890                return tr("Release the mouse button to stop rotating.");
  • org/openstreetmap/josm/actions/search/PushbackTokenizer.java

     
    3636         */
    3737        @Override
    3838        public String toString() {
    39             return "Range [start=" + start + ", end=" + end + "]";
     39            return "Range [start=" + start + ", end=" + end + ']';
    4040        }
    4141    }
    4242
  • org/openstreetmap/josm/actions/search/SearchAction.java

     
    194194                    public void mouseClicked(MouseEvent e) {
    195195                        try {
    196196                            JTextComponent tf = (JTextComponent) hcb.getEditor().getEditorComponent();
    197                             tf.getDocument().insertString(tf.getCaretPosition(), " " + insertText, null);
     197                            tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null);
    198198                        } catch (BadLocationException ex) {
    199199                            throw new RuntimeException(ex.getMessage(), ex);
    200200                        }
     
    636636                            /*regex search*/ trc("search", "RX")) : "";
    637637                    String all = allElements ? (", " +
    638638                            /*all elements*/ trc("search", "A")) : "";
    639                     return "\"" + text + "\" (" + cs + rx + all + ", " + mode + ")";
     639                    return '"' + text + "\" (" + cs + rx + all + ", " + mode + ')';
    640640        }
    641641
    642642        @Override
  • org/openstreetmap/josm/actions/search/SearchCompiler.java

     
    142142                else if ("nth%".equals(keyword))
    143143                    return new Nth(tokenizer, true);
    144144                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", ""})
    146146                    String[] rangeA = rangeS.split("/");
    147147                    if (rangeA.length == 1)
    148148                        return new KeyValue(keyword, rangeS.trim(), regexSearch, caseSensitive);
     
    514514
    515515            return false;
    516516        }
    517         @Override public String toString() {return key+"="+value;}
     517        @Override public String toString() {return key+ '=' +value;}
    518518    }
    519519
    520520    /**
     
    534534        private final Mode mode;
    535535
    536536        public ExactKeyValue(boolean regexp, String key, String value) throws ParseError {
    537             if ("".equals(key))
     537            if (key != null && key.isEmpty())
    538538                throw new ParseError(tr("Key cannot be empty when tag operator is used. Sample use: key=value"));
    539539            this.key = key;
    540540            this.value = value == null?"":value;
    541             if ("".equals(this.value) && "*".equals(key)) {
     541            if (this.value != null && this.value.isEmpty() && "*".equals(key)) {
    542542                mode = Mode.NONE;
    543             } else if ("".equals(this.value)) {
     543            } else if (this.value != null && this.value.isEmpty()) {
    544544                if (regexp) {
    545545                    mode = Mode.MISSING_KEY_REGEXP;
    546546                } else {
     
    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);
     
    862862
    863863        @Override
    864864        public String toString() {
    865             return getString() + "=" + min + "-" + max;
     865            return getString() + '=' + min + '-' + max;
    866866        }
    867867    }
    868868
     
    10241024            }
    10251025            return isParent;
    10261026        }
    1027         @Override public String toString() {return "parent(" + match + ")";}
     1027        @Override public String toString() {return "parent(" + match + ')';}
    10281028    }
    10291029
    10301030    /**
     
    10431043            }
    10441044            return isChild;
    10451045        }
    1046         @Override public String toString() {return "child(" + match + ")";}
     1046        @Override public String toString() {return "child(" + match + ')';}
    10471047    }
    10481048
    10491049    /**
  • org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java

     
    2020    protected String formatRelation(Relation r) {
    2121        StringBuffer sb = new StringBuffer();
    2222        if (r.getName() != null) {
    23             sb.append("'").append(r.getName()).append("'");
     23            sb.append('\'').append(r.getName()).append('\'');
    2424        } else if (!r.isNew()) {
    2525            sb.append(r.getId());
    2626        } else {
     
    3333    public String getMessage() {
    3434        StringBuffer sb = new StringBuffer();
    3535        sb.append(tr("Cyclic dependency between relations:"));
    36         sb.append("[");
     36        sb.append('[');
    3737        for (int i=0; i< cycle.size(); i++) {
    3838            if (i >0 ) {
    39                 sb.append(",");
     39                sb.append(',');
    4040            }
    4141            sb.append(formatRelation(cycle.get(i)));
    4242        }
    43         sb.append("]");
     43        sb.append(']');
    4444        return sb.toString();
    4545    }
    4646
  • org/openstreetmap/josm/command/ChangePropertyKeyCommand.java

     
    7272        if (objects.size() == 1) {
    7373            NameVisitor v = new NameVisitor();
    7474            objects.iterator().next().accept(v);
    75             text += " "+tr(v.className)+" "+v.name;
     75            text += ' ' +tr(v.className)+ ' ' +v.name;
    7676        } else {
    77             text += " "+objects.size()+" "+trn("object","objects",objects.size());
     77            text += " "+objects.size()+ ' ' +trn("object","objects",objects.size());
    7878        }
    7979        return text;
    8080    }
  • org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

     
    6767        public StringSwitcher(String a, String b) {
    6868            this.a = a;
    6969            this.b = b;
    70             this.pattern = getPatternFor(a + "|" + b);
     70            this.pattern = getPatternFor(a + '|' + b);
    7171        }
    7272
    7373        public String apply(String text) {
  • org/openstreetmap/josm/corrector/TagCorrector.java

     
    8686                p.add(propertiesLabel, GBC.std());
    8787
    8888                final JLabel primitiveLabel = new JLabel(
    89                         primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ":",
     89                        primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ':',
    9090                        ImageProvider.get(primitive.getDisplayType()),
    9191                        JLabel.LEFT
    9292                );
  • org/openstreetmap/josm/data/Bounds.java

     
    186186    }
    187187
    188188    @Override public String toString() {
    189         return "Bounds["+minLat+","+minLon+","+maxLat+","+maxLon+"]";
     189        return "Bounds["+minLat+ ',' +minLon+ ',' +maxLat+ ',' +maxLon+ ']';
    190190    }
    191191
    192192    public String toShortString(DecimalFormat format) {
    193193        return
    194         format.format(minLat) + " "
     194        format.format(minLat) + ' '
    195195        + format.format(minLon) + " / "
    196         + format.format(maxLat) + " "
     196        + format.format(maxLat) + ' '
    197197        + format.format(maxLon);
    198198    }
    199199
  • org/openstreetmap/josm/data/CustomConfigurator.java

     
    6464
    6565    public static void log(String s) {
    6666        summary.append(s);
    67         summary.append("\n");
     67        summary.append('\n');
    6868    }
    6969
    7070    public static String getLog() {
     
    453453                engine.eval("API={}; API.pref={}; API.fragments={};");
    454454
    455455                engine.eval("homeDir='"+normalizeDirName(Main.pref.getPreferencesDir()) +"';");
    456                 engine.eval("josmVersion="+Version.getInstance().getVersion()+";");
     456                engine.eval("josmVersion="+Version.getInstance().getVersion()+ ';');
    457457                String className =  CustomConfigurator.class.getName();
    458458                engine.eval("API.messageBox="+className+".messageBox");
    459459                engine.eval("API.askText=function(text) { return String("+className+".askForText(text));}");
     
    11061106            "    jsList.push(String(list.get(i)));"+
    11071107            "  }"+
    11081108            "return jsList;"+
    1109             "}"+
     1109                    '}' +
    11101110            "function getJSMap( javaMap ) {"+
    11111111            " var jsMap; var it; var e; "+
    11121112            " if (javaMap == null) return null;"+
     
    11161116            "    jsMap[ String(e.getKey()) ] = String(e.getValue()); "+
    11171117            "  }"+
    11181118            "  return jsMap;"+
    1119             "}"+
     1119                    '}' +
    11201120            "for (it = stringMap.entrySet().iterator(); it.hasNext();) {"+
    11211121            "  e = it.next();"+
    11221122            whereToPutInJS+"[String(e.getKey())] = String(e.getValue());"+
  • org/openstreetmap/josm/data/Preferences.java

     
    437437    synchronized public String get(final String key, final String def) {
    438438        putDefault(key, def);
    439439        final String prop = properties.get(key);
    440         if (prop == null || prop.equals(""))
     440        if (prop == null || prop.isEmpty())
    441441            return def;
    442442        return prop;
    443443    }
     
    511511
    512512    synchronized public boolean getBoolean(final String key, final String specName, final boolean def) {
    513513        putDefault(key, Boolean.toString(def));
    514         String skey = key+"."+specName;
     514        String skey = key+ '.' +specName;
    515515        if(properties.containsKey(skey))
    516516            return Boolean.parseBoolean(properties.get(skey));
    517517        return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : def;
     
    770770        }
    771771        putDefault("color."+colKey, ColorHelper.color2html(def));
    772772        String colStr = specName != null ? get("color."+specName) : "";
    773         if(colStr.equals("")) {
     773        if(colStr.isEmpty()) {
    774774            colStr = get("color."+colKey);
    775775        }
    776         return colStr.equals("") ? def : ColorHelper.html2color(colStr);
     776        return colStr.isEmpty() ? def : ColorHelper.html2color(colStr);
    777777    }
    778778
    779779    synchronized public Color getDefaultColor(String colKey) {
    780780        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);
    782782    }
    783783
    784784    synchronized public boolean putColor(String colKey, Color val) {
     
    801801
    802802    synchronized public int getInteger(String key, String specName, int def) {
    803803        putDefault(key, Integer.toString(def));
    804         String v = get(key+"."+specName);
     804        String v = get(key+ '.' +specName);
    805805        if(v.isEmpty())
    806806            v = get(key);
    807807        if(v.isEmpty())
  • org/openstreetmap/josm/data/ProjectionBounds.java

     
    6161    }
    6262
    6363    @Override public String toString() {
    64         return "ProjectionBounds["+minEast+","+minNorth+","+maxEast+","+maxNorth+"]";
     64        return "ProjectionBounds["+minEast+ ',' +minNorth+ ',' +maxEast+ ',' +maxNorth+ ']';
    6565    }
    6666
    6767    /**
  • org/openstreetmap/josm/data/ServerSidePreferences.java

     
    5151                String username = get("applet.username");
    5252                String password = get("applet.password");
    5353                if(password.isEmpty() && username.isEmpty()) {
    54                     con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password));
     54                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ':' +password));
    5555                }
    5656                con.connect();
    5757                if(username.isEmpty() && con instanceof HttpURLConnection
     
    6565                StringBuilder b = new StringBuilder();
    6666                for (String line = reader.readLine(); line != null; line = reader.readLine()) {
    6767                    b.append(line);
    68                     b.append("\n");
     68                    b.append('\n');
    6969                }
    7070                if (con instanceof HttpURLConnection) {
    7171                    ((HttpURLConnection) con).disconnect();
     
    8484                String username = get("applet.username");
    8585                String password = get("applet.password");
    8686                if(password.isEmpty() && username.isEmpty()) {
    87                     con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password));
     87                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+ ':' +password));
    8888                }
    8989                con.setRequestMethod("POST");
    9090                con.setDoOutput(true);
  • org/openstreetmap/josm/data/Version.java

     
    4040            StringBuffer sb = new StringBuffer();
    4141            try {
    4242                for (String line = in.readLine(); line != null; line = in.readLine()) {
    43                     sb.append(line).append("\n");
     43                    sb.append(line).append('\n');
    4444                }
    4545            } finally {
    4646                Utils.close(in);
     
    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*#.*$")) {
     
    146146        //
    147147        StringBuffer sb = new StringBuffer();
    148148        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');
    150150        }
    151151        releaseDescription = sb.toString();
    152152    }
     
    228228        int v = getVersion();
    229229        String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v);
    230230        if (buildName != null) {
    231             s += " " + buildName;
     231            s += ' ' + buildName;
    232232        }
    233233        if (isLocalBuild() && v != JOSM_UNKNOWN_VERSION) {
    234234            s += " SVN";
    235235        }
    236         String result = "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+")";
     236        String result = "JOSM/1.5 ("+ s+ ' ' +LanguageInfo.getJOSMLocaleCode()+ ')';
    237237        if (includeOsDetails) {
    238             result += " " + Main.platform.getOSDescription();
     238            result += ' ' + Main.platform.getOSDescription();
    239239        }
    240240        return result;
    241241    }
  • org/openstreetmap/josm/data/coor/CachedLatLon.java

     
    5858        return eastNorth;
    5959    }
    6060    @Override public String toString() {
    61         return "CachedLatLon[lat="+lat()+",lon="+lon()+"]";
     61        return "CachedLatLon[lat="+lat()+",lon="+lon()+ ']';
    6262    }
    6363
    6464    // Only for Node.get3892DebugInfo()
  • org/openstreetmap/josm/data/coor/EastNorth.java

     
    9191    }
    9292
    9393    @Override public String toString() {
    94         return "EastNorth[e="+x+", n="+y+"]";
     94        return "EastNorth[e="+x+", n="+y+ ']';
    9595    }
    9696
    9797    /**
  • org/openstreetmap/josm/data/coor/LatLon.java

     
    128128            sDegrees = Integer.toString(tDegree+1);
    129129        }
    130130
    131         return sDegrees + "\u00B0" + sMinutes + "\'" + sSeconds + "\"";
     131        return sDegrees + '\u00B0' + sMinutes + '\'' + sSeconds + '"';
    132132    }
    133133
    134134    /**
     
    150150            sDegrees = Integer.toString(tDegree+1);
    151151        }
    152152
    153         return sDegrees + "\u00B0" + sMinutes + "\'";
     153        return sDegrees + '\u00B0' + sMinutes + '\'';
    154154    }
    155155
    156156    public LatLon(double lat, double lon) {
     
    273273    public String toDisplayString() {
    274274        NumberFormat nf = NumberFormat.getInstance();
    275275        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';
    277277    }
    278278
    279279    public LatLon interpolate(LatLon ll2, double proportion) {
     
    286286    }
    287287
    288288    @Override public String toString() {
    289         return "LatLon[lat="+lat()+",lon="+lon()+"]";
     289        return "LatLon[lat="+lat()+",lon="+lon()+ ']';
    290290    }
    291291
    292292    /**
  • org/openstreetmap/josm/data/gpx/WayPoint.java

     
    9696
    9797    @Override
    9898    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 + ')';
    100100    }
    101101
    102102    /**
  • org/openstreetmap/josm/data/imagery/ImageryInfo.java

     
    521521
    522522    public String getExtendedUrl() {
    523523        return imageryType.getUrlString() + (defaultMaxZoom != 0
    524             ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":" + url;
     524            ? '[' +(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+ ']' : "") + ':' + url;
    525525    }
    526526
    527527    public String getToolbarName()
     
    537537    {
    538538        String res = name;
    539539        if(pixelPerDegree != 0.0) {
    540             res += " ("+pixelPerDegree+")";
     540            res += " ("+pixelPerDegree+ ')';
    541541        }
    542542        return res;
    543543    }
  • 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 != null && !a.isEmpty() && b != null && !b.isEmpty() && (a.contains(b) || b.contains(a)));
    130130    }
    131131
    132132    public void add(ImageryInfo info) {
  • org/openstreetmap/josm/data/imagery/WmsCache.java

     
    302302    }
    303303
    304304    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);
    306306    }
    307307
    308308
  • org/openstreetmap/josm/data/osm/AbstractPrimitive.java

     
    428428        StringBuilder builder = new StringBuilder();
    429429
    430430        if (isIncomplete()) {
    431             builder.append("I");
     431            builder.append('I');
    432432        }
    433433        if (isModified()) {
    434             builder.append("M");
     434            builder.append('M');
    435435        }
    436436        if (isVisible()) {
    437             builder.append("V");
     437            builder.append('V');
    438438        }
    439439        if (isDeleted()) {
    440             builder.append("D");
     440            builder.append('D');
    441441        }
    442442        return builder.toString();
    443443    }
     
    697697        String key = "name:" + Locale.getDefault().toString();
    698698        if (get(key) != null)
    699699            return get(key);
    700         key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
     700        key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry();
    701701        if (get(key) != null)
    702702            return get(key);
    703703        key = "name:" + Locale.getDefault().getLanguage();
  • org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java

     
    2828    private void printError(String type, String message, Object... args) {
    2929        errorCount++;
    3030        if (errorCount <= MAX_ERRORS) {
    31             writer.println("[" + type + "] " + String.format(message, args));
     31            writer.println('[' + type + "] " + String.format(message, args));
    3232        }
    3333    }
    3434
  • org/openstreetmap/josm/data/osm/Node.java

     
    261261    @Override
    262262    public String toString() {
    263263        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+ '}';
    265265    }
    266266
    267267    @Override
  • org/openstreetmap/josm/data/osm/OsmPrimitive.java

     
    11851185
    11861186        if (isDisabled()) {
    11871187            if (isDisabledAndHidden()) {
    1188                 builder.append("h");
     1188                builder.append('h');
    11891189            } else {
    1190                 builder.append("d");
     1190                builder.append('d');
    11911191            }
    11921192        }
    11931193        if (isTagged()) {
    1194             builder.append("T");
     1194            builder.append('T');
    11951195        }
    11961196        if (hasDirectionKeys()) {
    11971197            if (reversedDirection()) {
    1198                 builder.append("<");
     1198                builder.append('<');
    11991199            } else {
    1200                 builder.append(">");
     1200                builder.append('>');
    12011201            }
    12021202        }
    12031203        return builder.toString();
  • org/openstreetmap/josm/data/osm/QuadBuckets.java

     
    4343        if (now - last_out < 300)
    4444            return;
    4545        last_out = now;
    46         System.out.print(s + "\r");
     46        System.out.print(s + '\r');
    4747    }
    4848    void pout(String s, int i, int total)
    4949    {
     
    5353            return;
    5454        last_out = now;
    5555        // 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");
    5757    }
    5858
    5959    public static final int MAX_OBJECTS_PER_LEVEL = 16;
     
    111111
    112112        @Override
    113113        public String toString()  {
    114             return super.toString()+ "["+level+"]: " + bbox();
     114            return super.toString()+ '[' +level+"]: " + bbox();
    115115        }
    116116        /**
    117117         * Constructor for root node
     
    472472                return;
    473473
    474474            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()));
    476476            }
    477477
    478478            if (parent.nw == this) {
  • org/openstreetmap/josm/data/osm/Relation.java

     
    263263        result.append(getUniqueId());
    264264        result.append(" version=");
    265265        result.append(getVersion());
    266         result.append(" ");
     266        result.append(' ');
    267267        result.append(getFlagsAsString());
    268268        result.append(" [");
    269269        for (RelationMember rm:getMembers()) {
    270270            result.append(OsmPrimitiveType.from(rm.getMember()));
    271             result.append(" ");
     271            result.append(' ');
    272272            result.append(rm.getMember().getUniqueId());
    273273            result.append(", ");
    274274        }
    275275        result.delete(result.length()-2, result.length());
    276         result.append("]");
    277         result.append("}");
     276        result.append(']');
     277        result.append('}');
    278278        return result.toString();
    279279    }
    280280
  • org/openstreetmap/josm/data/osm/RelationMember.java

     
    3434     * @since 1930
    3535     */
    3636    public boolean hasRole() {
    37         return !"".equals(role);
     37        return role != null && !role.isEmpty();
    3838    }
    3939
    4040    /**
  • org/openstreetmap/josm/data/osm/RelationMemberData.java

     
    3030    }
    3131
    3232    public boolean hasRole() {
    33         return !"".equals(role);
     33        return role != null && !role.isEmpty();
    3434    }
    3535
    3636    @Override
    3737    public String toString() {
    38         return (memberType != null ? memberType.getAPIName() : "undefined") + " " + memberId;
     38        return (memberType != null ? memberType.getAPIName() : "undefined") + ' ' + memberId;
    3939    }
    4040
    4141    /**
  • org/openstreetmap/josm/data/osm/Tag.java

     
    9898
    9999    @Override
    100100    public String toString() {
    101         return key + "=" + value;
     101        return key + '=' + value;
    102102    }
    103103}
  • org/openstreetmap/josm/data/osm/TagCollection.java

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

     
    204204    @Override
    205205    public String toString() {
    206206        StringBuffer s = new StringBuffer();
    207         s.append("id:"+uid);
     207        s.append("id:").append(uid);
    208208        if (names.size() == 1) {
    209             s.append(" name:"+getName());
     209            s.append(" name:").append(getName());
    210210        }
    211211        else if (names.size() > 1) {
    212212            s.append(String.format(" %d names:%s", names.size(), getName()));
  • org/openstreetmap/josm/data/osm/Way.java

     
    321321    @Override
    322322    public String toString() {
    323323        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 + '}';
    325325    }
    326326
    327327    @Override
  • org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

     
    221221        String key = "name:" + Locale.getDefault().toString();
    222222        if (get(key) != null)
    223223            return get(key);
    224         key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
     224        key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry();
    225225        if (get(key) != null)
    226226            return get(key);
    227227        key = "name:" + Locale.getDefault().getLanguage();
     
    264264                + (timestamp != null ? "timestamp=" + timestamp : "") + ", "
    265265                + (user != null ? "user=" + user + ", " : "") + "changesetId="
    266266                + changesetId
    267                 + "]";
     267                + ']';
    268268    }
    269269}
  • org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

     
    120120    }
    121121
    122122    @Override public String toString() {
    123         return "BoundingXYVisitor["+bounds+"]";
     123        return "BoundingXYVisitor["+bounds+ ']';
    124124    }
    125125
    126126    public void computeBoundingBox(Collection<? extends OsmPrimitive> primitives) {
  • org/openstreetmap/josm/data/projection/CustomProjection.java

     
    396396        boolean dms = false;
    397397        double deg = 0.0, min = 0.0, sec = 0.0;
    398398        // degrees
    399         m = Pattern.compile("^"+FLOAT+"d").matcher(s);
     399        m = Pattern.compile('^' +FLOAT+ 'd').matcher(s);
    400400        if (m.find()) {
    401401            s = s.substring(m.end());
    402402            deg = Double.parseDouble(m.group(1));
    403403            dms = true;
    404404        }
    405405        // minutes
    406         m = Pattern.compile("^"+FLOAT+"'").matcher(s);
     406        m = Pattern.compile('^' +FLOAT+ '\'').matcher(s);
    407407        if (m.find()) {
    408408            s = s.substring(m.end());
    409409            min = Double.parseDouble(m.group(1));
    410410            dms = true;
    411411        }
    412412        // seconds
    413         m = Pattern.compile("^"+FLOAT+"\"").matcher(s);
     413        m = Pattern.compile('^' +FLOAT+ '"').matcher(s);
    414414        if (m.find()) {
    415415            s = s.substring(m.end());
    416416            sec = Double.parseDouble(m.group(1));
     
    420420        if (dms) {
    421421            value = deg + (min/60.0) + (sec/3600.0);
    422422        } else {
    423             m = Pattern.compile("^"+FLOAT).matcher(s);
     423            m = Pattern.compile('^' +FLOAT).matcher(s);
    424424            if (m.find()) {
    425425                s = s.substring(m.end());
    426426                value += Double.parseDouble(m.group(1));
  • org/openstreetmap/josm/data/projection/Ellipsoid.java

     
    128128
    129129    @Override
    130130    public String toString() {
    131         return "Ellipsoid{a="+a+", b="+b+"}";
     131        return "Ellipsoid{a="+a+", b="+b+ '}';
    132132    }
    133133
    134134    /**
  • org/openstreetmap/josm/data/projection/datum/CentricDatum.java

     
    2626
    2727    @Override
    2828    public String toString() {
    29         return "CentricDatum{ellipsoid="+ellps+"}";
     29        return "CentricDatum{ellipsoid="+ellps+ '}';
    3030    }
    3131}
  • org/openstreetmap/josm/data/validation/TestError.java

     
    182182            } else if (o instanceof Node) {
    183183                type = "n";
    184184            }
    185             strings.add(type + "_" + o.getId());
     185            strings.add(type + '_' + o.getId());
    186186        }
    187187        for (String o : strings) {
    188             ignorestring += ":" + o;
     188            ignorestring += ':' + o;
    189189        }
    190190        return ignorestring;
    191191    }
     
    193193    public String getIgnoreSubGroup() {
    194194        String ignorestring = getIgnoreGroup();
    195195        if (description_en != null) {
    196             ignorestring += "_" + description_en;
     196            ignorestring += '_' + description_en;
    197197        }
    198198        return ignorestring;
    199199    }
     
    321321
    322322    @Override
    323323    public String toString() {
    324         return "TestError [tester=" + tester + ", code=" + code + "]";
     324        return "TestError [tester=" + tester + ", code=" + code + ']';
    325325    }
    326326}
  • org/openstreetmap/josm/data/validation/tests/RelationChecker.java

     
    146146                for (Role r : allroles) {
    147147                    done.add(r.key);
    148148                    String keyname = r.key;
    149                     if ("".equals(keyname)) {
     149                    if (keyname != null && keyname.isEmpty()) {
    150150                        keyname = tr("<empty>");
    151151                    }
    152152                    RoleInfo ri = map.get(r.key);
  • org/openstreetmap/josm/data/validation/tests/TagChecker.java

     
    8686    protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();
    8787
    8888    /** 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();
    9090
    9191    public static final String PREF_CHECK_VALUES = PREFIX + ".checkValues";
    9292    public static final String PREF_CHECK_KEYS = PREFIX + ".checkKeys";
     
    182182            if (sources == null || sources.length() == 0) {
    183183                sources = DATA_FILE;
    184184            } else {
    185                 sources = DATA_FILE + ";" + sources;
     185                sources = DATA_FILE + ';' + sources;
    186186            }
    187187        }
    188188        if (Main.pref.getBoolean(PREF_USE_IGNORE_FILE, true)) {
    189189            if (sources == null || sources.length() == 0) {
    190190                sources = IGNORE_FILE;
    191191            } else {
    192                 sources = IGNORE_FILE + ";" + sources;
     192                sources = IGNORE_FILE + ';' + sources;
    193193            }
    194194        }
    195195        if (Main.pref.getBoolean(PREF_USE_SPELL_FILE, true)) {
    196196            if( sources == null || sources.length() == 0) {
    197197                sources = SPELL_FILE;
    198198            } else {
    199                 sources = SPELL_FILE + ";" + sources;
     199                sources = SPELL_FILE + ';' + sources;
    200200            }
    201201        }
    202202
     
    244244                            ignoreDataEndsWith.add(line);
    245245                        } else if (key.equals("K:")) {
    246246                            IgnoreKeyPair tmp = new IgnoreKeyPair();
    247                             int mid = line.indexOf("=");
     247                            int mid = line.indexOf('=');
    248248                            tmp.key = line.substring(0, mid);
    249249                            tmp.value = line.substring(mid+1);
    250250                            ignoreDataKeyPair.add(tmp);
     
    270270                    }
    271271                }
    272272            } catch (IOException e) {
    273                 errorSources += source + "\n";
     273                errorSources += source + '\n';
    274274            }
    275275        }
    276276
     
    401401                        tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) );
    402402                withErrors.put(p, "IPK");
    403403            }
    404             if (checkKeys && key.indexOf(" ") >= 0 && !withErrors.contains(p, "IPK")) {
     404            if (checkKeys && key.indexOf(' ') >= 0 && !withErrors.contains(p, "IPK")) {
    405405                errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"),
    406406                        tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
    407407                withErrors.put(p, "IPK");
  • org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

     
    3939public class UnconnectedWays extends Test {
    4040
    4141    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();
    4343
    4444    Set<MyWaySegment> ways;
    4545    QuadBuckets<Node> endnodes; // nodes at end of way
  • org/openstreetmap/josm/gui/BookmarkList.java

     
    215215            Bounds area = b.getArea();
    216216            StringBuffer sb = new StringBuffer();
    217217            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>")
    219219            .append("<br>")
    220220            .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>")
    222222            .append("</html>");
    223223            return sb.toString();
    224224
  • org/openstreetmap/josm/gui/DefaultNameFormatter.java

     
    172172                }
    173173
    174174                if (n == null) {
    175                     n = node.isNew() ? tr("node") : ""+ node.getId();
     175                    n = node.isNew() ? tr("node") : Long.toString(node.getId());
    176176                }
    177177                name.append(n);
    178178            } else {
    179179                preset.nameTemplate.appendText(name, node);
    180180            }
    181181            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(')');
    183183            }
    184184        }
    185185        decorateNameWithId(name, node);
     
    271271               nevertheless, who knows what future brings */
    272272            /* I18n: count of nodes as parameter */
    273273            String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo);
    274             name.append(" (").append(nodes).append(")");
     274            name.append(" (").append(nodes).append(')');
    275275        }
    276276        decorateNameWithId(name, way);
    277277
     
    319319                name.append(", ").append(tr("incomplete"));
    320320            }
    321321
    322             name.append(")");
     322            name.append(')');
    323323        }
    324324        decorateNameWithId(name, relation);
    325325
     
    340340            if (relationName == null) {
    341341                relationName = Long.toString(relation.getId());
    342342            } else {
    343                 relationName = "\"" + relationName + "\"";
     343                relationName = '"' + relationName + '"';
    344344            }
    345345            result.append(" (").append(relationName).append(", ");
    346346        } else {
    347347            preset.nameTemplate.appendText(result, relation);
    348             result.append("(");
     348            result.append('(');
    349349        }
    350350    }
    351351
     
    434434        }
    435435        String admin_level = relation.get("admin_level");
    436436        if (admin_level != null) {
    437             name += "["+admin_level+"]";
     437            name += '[' +admin_level+ ']';
    438438        }
    439439
    440440        for (NameFormatterHook hook: formatHooks) {
     
    509509            sb.append("<strong>")
    510510            .append(key)
    511511            .append("</strong>")
    512             .append("=");
     512            .append('=');
    513513            String value = primitive.get(key);
    514514            while(value.length() != 0) {
    515515                sb.append(value.substring(0,Math.min(50, value.length())));
     
    565565            .append(coord.latToString(CoordinateFormat.getDefaultFormat()))
    566566            .append(", ")
    567567            .append(coord.lonToString(CoordinateFormat.getDefaultFormat()))
    568             .append(")");
     568            .append(')');
    569569        }
    570570        decorateNameWithId(sb, node);
    571571        return sb.toString();
     
    607607        }
    608608        /* note: length == 0 should no longer happen, but leave the bracket code
    609609           nevertheless, who knows what future brings */
    610         sb.append((sb.length() > 0) ? " ("+nodes+")" : nodes);
     610        sb.append((sb.length() > 0) ? " ("+nodes+ ')' : nodes);
    611611        decorateNameWithId(sb, way);
    612612        return sb.toString();
    613613    }
     
    647647        if (nameTag == null) {
    648648            sb.append(Long.toString(relation.getId())).append(", ");
    649649        } else {
    650             sb.append("\"").append(nameTag).append("\", ");
     650            sb.append('"').append(nameTag).append("\", ");
    651651        }
    652652
    653653        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(')');
    655655
    656656        decorateNameWithId(sb, relation);
    657657        return sb.toString();
     
    679679            sb.append("<strong>")
    680680            .append(key)
    681681            .append("</strong>")
    682             .append("=");
     682            .append('=');
    683683            String value = primitive.get(key);
    684684            while(value.length() != 0) {
    685685                sb.append(value.substring(0,Math.min(50, value.length())));
  • 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)
  • org/openstreetmap/josm/gui/GettingStarted.java

     
    156156            String im = m.group(1);
    157157            URL u = getClass().getResource(im);
    158158            if (u != null) {
    159                 m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u.toString() + "\""));
     159                m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u.toString() + '"'));
    160160            }
    161161        }
    162162        m.appendTail(sb);
  • 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 {
     
    254254        } else if (evt.getKey().equals("osm-server.url")) {
    255255            if (!(evt.getNewValue() instanceof StringSetting)) return;
    256256            String newValue = ((StringSetting) evt.getNewValue()).getValue();
    257             if (newValue == null || newValue.trim().equals("")) {
     257            if (newValue == null || newValue.trim().isEmpty()) {
    258258                setAnonymous();
    259259            } else if (isFullyIdentified()) {
    260260                setPartiallyIdentified(getUserName());
  • org/openstreetmap/josm/gui/MainApplet.java

     
    7979            }
    8080        }
    8181        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")}));
    8383        }
    8484    }
    8585
     
    119119                p.add(pass, GBC.eol().fill(GBC.HORIZONTAL));
    120120                JOptionPane.showMessageDialog(null, p);
    121121                username = user.getText();
    122                 if("".equals(username))
     122                if(username != null && username.isEmpty())
    123123                    username = null;
    124124                password = new String(pass.getPassword());
    125                 if("".equals(password))
     125                if(password != null && password.isEmpty())
    126126                    password = null;
    127127            }
    128128            if (username != null && password != null) {
  • org/openstreetmap/josm/gui/MainApplication.java

     
    100100                tr("usage")+":\n"+
    101101                "\tjava -jar josm.jar <options>...\n\n"+
    102102                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' +
    112112                "\t--reset-preferences                       "+tr("Reset the preferences to default")+"\n\n"+
    113113                "\t--load-preferences=<url-to-xml>           "+tr("Changes preferences according to the XML file")+"\n\n"+
    114114                "\t--set=<key>=<value>                       "+tr("Set preference key to value")+"\n\n"+
     
    126126                        "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+
    127127                        "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+
    128128                        "\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'
    131131                );
    132132    }
    133133
     
    180180            los.add(new LongOpt(o.getName(), o.requiresArgument() ? LongOpt.REQUIRED_ARGUMENT : LongOpt.NO_ARGUMENT, null, 0));
    181181        }
    182182
    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()]));
    184184
    185185        Map<Option, Collection<String>> argMap = new HashMap<Option, Collection<String>>();
    186186
  • org/openstreetmap/josm/gui/MapStatus.java

     
    535535            // fix #7557 - do not show ID twice
    536536
    537537            if (!osm.isNew() && !idShown) {
    538                 text.append(" [id="+osm.getId()+"]");
     538                text.append(" [id=").append(osm.getId()).append(']');
    539539            }
    540540
    541541            if(osm.getUser() != null) {
    542                 text.append(" [" + tr("User:") + " " + osm.getUser().getName() + "]");
     542                text.append(" [").append(tr("User:")).append(' ').append(osm.getUser().getName()).append(']');
    543543            }
    544544
    545545            for (String key : osm.keySet()) {
    546                 text.append("<br>" + key + "=" + osm.get(key));
     546                text.append("<br>").append(key).append('=').append(osm.get(key));
    547547            }
    548548
    549549            final JLabel l = new JLabel(
  • org/openstreetmap/josm/gui/MultiSplitLayout.java

     
    10541054            int nChildren = getChildren().size();
    10551055            StringBuffer sb = new StringBuffer("MultiSplitLayout.Split");
    10561056            sb.append(isRowLayout() ? " ROW [" : " COLUMN [");
    1057             sb.append(nChildren + ((nChildren == 1) ? " child" : " children"));
     1057            sb.append(nChildren).append((nChildren == 1) ? " child" : " children");
    10581058            sb.append("] ");
    10591059            sb.append(getBounds());
    10601060            return sb.toString();
     
    11101110            StringBuffer sb = new StringBuffer("MultiSplitLayout.Leaf");
    11111111            sb.append(" \"");
    11121112            sb.append(getName());
    1113             sb.append("\"");
     1113            sb.append('"');
    11141114            sb.append(" weight=");
    11151115            sb.append(getWeight());
    1116             sb.append(" ");
     1116            sb.append(' ');
    11171117            sb.append(getBounds());
    11181118            return sb.toString();
    11191119        }
     
    11811181            }
    11821182        }
    11831183        else {
    1184             throwParseException(st, "unrecognized attribute \"" + name + "\"");
     1184            throwParseException(st, "unrecognized attribute \"" + name + '"');
    11851185        }
    11861186    }
    11871187
     
    12431243                    parseSplit(st, split);
    12441244                }
    12451245                else {
    1246                     throwParseException(st, "unrecognized node type '" + nodeType + "'");
     1246                    throwParseException(st, "unrecognized node type '" + nodeType + '\'');
    12471247                }
    12481248            }
    12491249        }
  • org/openstreetmap/josm/gui/NavigatableComponent.java

     
    13511351     * Return a ID which is unique as long as viewport dimensions are the same
    13521352     */
    13531353    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();
    13561356        java.util.zip.CRC32 id = new java.util.zip.CRC32();
    13571357        id.update(x.getBytes());
    13581358        return (int)id.getValue();
     
    14751475            if ((!lowerOnly && areaCustomValue > 0 && a > areaCustomValue / (aValue*aValue) && a < (bValue*bValue) / (aValue*aValue)) || customAreaOnly)
    14761476                return formatText(area / areaCustomValue, areaCustomName);
    14771477            else if (!lowerOnly && a >= (bValue*bValue) / (aValue*aValue))
    1478                 return formatText(area / (bValue*bValue), bName+"\u00b2");
     1478                return formatText(area / (bValue*bValue), bName+ '\u00b2');
    14791479            else if (a < 0.01)
    1480                 return "< 0.01 " + aName+"\u00b2";
     1480                return "< 0.01 " + aName+ '\u00b2';
    14811481            else
    1482                 return formatText(a, aName+"\u00b2");
     1482                return formatText(a, aName+ '\u00b2');
    14831483        }
    14841484
    14851485        private static String formatText(double v, String unit) {
  • org/openstreetmap/josm/gui/SideButton.java

     
    8888        setActionCommand(name);
    8989        addActionListener(actionListener);
    9090        setToolTipText(tooltip);
    91         putClientProperty("help", "Dialog/"+property+"/"+name);
     91        putClientProperty("help", "Dialog/"+property+ '/' +name);
    9292    }
    9393
    9494    private void doStyle()
  • org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

     
    593593        public boolean isValid() {
    594594            String value = getComponent().getText().trim();
    595595            try {
    596                 if (value.equals("")) {
     596                if (value.isEmpty()) {
    597597                    tileIndex = 0;
    598598                } else {
    599599                    tileIndex = Integer.parseInt(value);
     
    644644        @Override
    645645        public String toString() {
    646646            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(',');
    649649            sb.append("zoom=").append(zoomLevel);
    650650            return sb.toString();
    651651        }
  • org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java

     
    6767            sb.append("<strong>")
    6868            .append(key)
    6969            .append("</strong>")
    70             .append("=");
     70            .append('=');
    7171            // make sure long values are split into several rows. Otherwise
    7272            // the tool tip window can become to wide
    7373            //
  • org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java

     
    290290        if (coord == null)
    291291            return tr("(none)");
    292292        StringBuilder sb = new StringBuilder();
    293         sb.append("(")
     293        sb.append('(')
    294294        .append(COORD_FORMATTER.format(coord.lat()))
    295         .append(",")
     295        .append(',')
    296296        .append(COORD_FORMATTER.format(coord.lon()))
    297         .append(")");
     297        .append(')');
    298298        return sb.toString();
    299299    }
    300300
  • org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java

     
    5252            sb.append("<strong>")
    5353            .append(key)
    5454            .append("</strong>")
    55             .append("=");
     55            .append('=');
    5656            String value = primitive.get(key);
    5757            while(value.length() != 0) {
    5858                sb.append(value.substring(0,Math.min(50, value.length())));
  • org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java

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

     
    171171    public Command buildTagApplyCommands(Collection<? extends OsmPrimitive> primitives) {
    172172        if (!cbTagRelations.isSelected())
    173173            return null;
    174         if (tfKey.getText().trim().equals(""))
     174        if (tfKey.getText().trim().isEmpty())
    175175            return null;
    176         if (tfValue.getText().trim().equals(""))
     176        if (tfValue.getText().trim().isEmpty())
    177177            return null;
    178178        if (primitives == null || primitives.isEmpty())
    179179            return null;
  • org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

     
    353353            txtMappaint.append(tr("\n\nList of generated Styles:\n"));
    354354            StyleList sl = elemstyles.get(osm, scale, nc);
    355355            for (ElemStyle s : sl) {
    356                 txtMappaint.append(" * " + s + "\n");
     356                txtMappaint.append(" * " + s + '\n');
    357357            }
    358358            txtMappaint.append("\n\n");
    359359        }
  • org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

     
    5858    private static final Pattern p = Pattern.compile(
    5959            "([+|-]?\\d+[.,]\\d+)|"             // (1)
    6060            + "([+|-]?\\d+)|"                   // (2)
    61             + "("+DEG+"|o|deg)|"                // (3)
     61            + '(' +DEG+"|o|deg)|"                // (3)
    6262            + "('|"+MIN+"|min)|"                // (4)
    6363            + "(\"|"+SEC+"|sec)|"               // (5)
    6464            + "(,|;)|"                          // (6)
     
    179179            ll = new LatLon(0,0);
    180180        }
    181181        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()));
    183183        EastNorth en = Main.getProjection().latlon2eastNorth(ll);
    184184        tfEastNorth.setText(en.east()+" "+en.north());
    185185        setOkEnabled(true);
     
    353353            } else if (m.group(6) != null) {
    354354                sb.append(',');     // separator
    355355            } else if (m.group(7) != null) {
    356                 sb.append("x");     // cardinal direction
     356                sb.append('x');     // cardinal direction
    357357                String c = m.group(7).toUpperCase();
    358358                if (c.equals("N") || c.equals("S") || c.equals("E") || c.equals("W")) {
    359359                    list.add(c);
  • org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

     
    668668                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    669669                String line;
    670670                while ((line = reader.readLine()) != null) {
    671                     txtSource.append(line + "\n");
     671                    txtSource.append(line + '\n');
    672672                }
    673673            } catch (IOException ex) {
    674674                txtSource.append("<ERROR: failed to read file!>");
     
    683683            txtErrors.setEditable(false);
    684684            p.add(new JScrollPane(txtErrors), GBC.std().fill());
    685685            for (Throwable t : s.getErrors()) {
    686                 txtErrors.append(t.toString() + "\n");
     686                txtErrors.append(t.toString() + '\n');
    687687            }
    688688        }
    689689    }
  • org/openstreetmap/josm/gui/dialogs/UserListDialog.java

     
    214214        protected String createInfoUrl(Object infoObject) {
    215215            User user = (User)infoObject;
    216216            try {
    217                 return getBaseUserUrl() + "/" + URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20");
     217                return getBaseUserUrl() + '/' + URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20");
    218218            } catch(UnsupportedEncodingException e) {
    219219                e.printStackTrace();
    220220                JOptionPane.showMessageDialog(
  • 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 {
  • org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java

     
    4040            sb.append(" - ");
    4141            sb.append(cs.isOpen() ? tr("open") : tr("closed"));
    4242            if (comment != null) {
    43                 sb.append(" - ").append("'").append(comment).append("'");
     43                sb.append(" - ").append('\'').append(comment).append('\'');
    4444            }
    4545        }
    4646        setText(sb.toString());
  • org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java

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

     
    821821                    if (cur == last + 1) {
    822822                        ++cnt;
    823823                    } else if (cnt == 0) {
    824                         positionString += "," + String.valueOf(cur);
     824                        positionString += ',' + String.valueOf(cur);
    825825                    } else {
    826                         positionString += "-" + String.valueOf(last);
    827                         positionString += "," + String.valueOf(cur);
     826                        positionString += '-' + String.valueOf(last);
     827                        positionString += ',' + String.valueOf(cur);
    828828                        cnt = 0;
    829829                    }
    830830                    last = cur;
    831831                }
    832832                if (cnt >= 1) {
    833                     positionString += "-" + String.valueOf(last);
     833                    positionString += '-' + String.valueOf(last);
    834834                }
    835835            }
    836836            if (positionString.length() > 20) {
     
    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                    }
     
    12411241                } else if (p instanceof Relation) {
    12421242                    t = "type:relation ";
    12431243                }
    1244                 s += sep + "(" + t + "\"" +
     1244                s += sep + '(' + t + '"' +
    12451245                        org.openstreetmap.josm.actions.search.SearchAction.escapeStringForSearch(key) + "\"=\"" +
    12461246                        org.openstreetmap.josm.actions.search.SearchAction.escapeStringForSearch(val) + "\")";
    12471247                sep = " OR ";
  • org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

     
    337337            String value = values.getEditor().getItem().toString().trim();
    338338            // is not Java 1.5
    339339            //value = java.text.Normalizer.normalize(value, java.text.Normalizer.Form.NFC);
    340             if (value.equals("")) {
     340            if (value.isEmpty()) {
    341341                value = null; // delete the key
    342342            }
    343343            String newkey = keys.getEditor().getItem().toString().trim();
    344344            //newkey = java.text.Normalizer.normalize(newkey, java.text.Normalizer.Form.NFC);
    345             if (newkey.equals("")) {
     345            if (newkey.isEmpty()) {
    346346                newkey = key;
    347347                value = null; // delete the key instead
    348348            }
  • 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) {
  • org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java

     
    8686
    8787        @Override
    8888        public String toString() {
    89             return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + "]";
     89            return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + ']';
    9090        }
    9191    }
    9292
  • org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionType.java

     
    6969    public String toString() {
    7070        return "[P "+linkPrev+" ;N "+linkNext+" ;D "+direction+" ;L "+isLoop+
    7171                " ;FP " + isOnewayLoopForwardPart+";BP " + isOnewayLoopBackwardPart+
    72                 ";OH " + isOnewayHead+";OT " + isOnewayTail+"]";
     72                ";OH " + isOnewayHead+";OT " + isOnewayTail+ ']';
    7373    }
    7474
    7575    public String getToolTip() {
  • org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java

     
    210210            for (Entry<String, Set<TestError>> msgErrors : severityErrors.entrySet()) {
    211211                // Message node
    212212                Set<TestError> errs = msgErrors.getValue();
    213                 String msg = msgErrors.getKey() + " (" + errs.size() + ")";
     213                String msg = msgErrors.getKey() + " (" + errs.size() + ')';
    214214                DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg);
    215215                severityNode.add(messageNode);
    216216
     
    229229                MultiMap<String, TestError> errorlist = bag.getValue();
    230230                DefaultMutableTreeNode groupNode = null;
    231231                if (errorlist.size() > 1) {
    232                     String nmsg = bag.getKey() + " (" + errorlist.size() + ")";
     232                    String nmsg = bag.getKey() + " (" + errorlist.size() + ')';
    233233                    groupNode = new DefaultMutableTreeNode(nmsg);
    234234                    severityNode.add(groupNode);
    235235                    if (oldSelectedRows.contains(bag.getKey())) {
     
    242242                    Set<TestError> errs = msgErrors.getValue();
    243243                    String msg;
    244244                    if (groupNode != null) {
    245                         msg = msgErrors.getKey() + " (" + errs.size() + ")";
     245                        msg = msgErrors.getKey() + " (" + errs.size() + ')';
    246246                    } else {
    247                         msg = msgErrors.getKey() + " - " + bag.getKey() + " (" + errs.size() + ")";
     247                        msg = msgErrors.getKey() + " - " + bag.getKey() + " (" + errs.size() + ')';
    248248                    }
    249249                    DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg);
    250250                    if (groupNode != null) {
  • org/openstreetmap/josm/gui/download/BookmarkSelection.java

     
    197197                            JOptionPane.QUESTION_MESSAGE)
    198198            );
    199199            b.setArea(currentArea);
    200             if (b.getName() != null && !b.getName().equals("")) {
     200            if (b.getName() != null && !b.getName().isEmpty()) {
    201201                ((DefaultListModel)bookmarks.getModel()).addElement(b);
    202202                bookmarks.save();
    203203            }
  • org/openstreetmap/josm/gui/download/PlaceSelection.java

     
    511511                if (line.length() == 0) {
    512512                    line.append(t);
    513513                } else if (line.length() < 80) {
    514                     line.append(" ").append(t);
     514                    line.append(' ').append(t);
    515515                } else {
    516                     line.append(" ").append(t).append("<br>");
     516                    line.append(' ').append(t).append("<br>");
    517517                    ret.append(line);
    518518                    line = new StringBuffer();
    519519                }
  • org/openstreetmap/josm/gui/help/HelpBrowser.java

     
    140140            String line = null;
    141141            while ((line = reader.readLine()) != null) {
    142142                css.append(line);
    143                 css.append("\n");
     143                css.append('\n');
    144144            }
    145145        } catch(Exception e) {
    146146            System.err.println(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
     
    583583        public void hyperlinkUpdate(HyperlinkEvent e) {
    584584            if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
    585585                return;
    586             if (e.getURL() == null || e.getURL().toString().startsWith(url+"#")) {
     586            if (e.getURL() == null || e.getURL().toString().startsWith(url+ '#')) {
    587587                // Probably hyperlink event on a an A-element with a href consisting of
    588588                // a fragment only, i.e. "#ALocalFragment".
    589589                //
  • org/openstreetmap/josm/gui/help/HelpUtil.java

     
    118118        String ret = LanguageInfo.getWikiLanguagePrefix(type);
    119119        if(ret == null)
    120120            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 /;
    122122        return ret.replaceAll("\\/+", "\\/"); // collapse sequences of //
    123123    }
    124124
     
    137137        String prefix = getHelpTopicPrefix(type);
    138138        if (prefix == null || topic == null || topic.trim().length() == 0 || topic.trim().equals("/"))
    139139            return prefix;
    140         prefix += "/" + topic;
     140        prefix += '/' + topic;
    141141        return prefix.replaceAll("\\/+", "\\/"); // collapse sequences of //
    142142    }
    143143
  • org/openstreetmap/josm/gui/history/VersionInfoPanel.java

     
    142142
    143143            try {
    144144                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");
    146146                    lblUser.setUrl(url);
    147147                } else {
    148148                    lblUser.setUrl(null);
     
    163163                lblUser.setUrl(null);
    164164            } else {
    165165                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");
    167167                    lblUser.setUrl(url);
    168168                } catch(UnsupportedEncodingException e) {
    169169                    e.printStackTrace();
  • 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() {
     
    298298            tfPassword.setToolTipText(tr("Please enter the password for authenticating at your proxy server"));
    299299            lblHeading.setText(
    300300                    "<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>");
    302302            lblWarning.setText("<html>" + tr("Warning: depending on the authentication method the proxy server uses the password may be transferred unencrypted.") + "</html>");
    303303        }
    304304
  • org/openstreetmap/josm/gui/io/FilenameCellEditor.java

     
    107107    }
    108108
    109109    public boolean stopCellEditing() {
    110         if (tfFileName.getText() == null || tfFileName.getText().trim().equals("")) {
     110        if (tfFileName.getText() == null || tfFileName.getText().trim().isEmpty()) {
    111111            value = null;
    112112        } else {
    113113            value = new File(tfFileName.getText());
  • org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

     
    3333class LayerNameAndFilePathTableCell extends JPanel implements TableCellRenderer, TableCellEditor {
    3434    private final static Color colorError = new Color(255,197,197);
    3535    private final static String separator = System.getProperty("file.separator");
    36     private final static String ellipsis = "…" + separator;
     36    private final static String ellipsis = '…' + separator;
    3737
    3838    private final JLabel lblLayerName = new JLabel();
    3939    private final JLabel lblFilename = new JLabel("");
     
    216216    }
    217217
    218218    public boolean stopCellEditing() {
    219         if (tfFilename.getText() == null || tfFilename.getText().trim().equals("")) {
     219        if (tfFilename.getText() == null || tfFilename.getText().trim().isEmpty()) {
    220220            value = null;
    221221        } else {
    222222            value = new File(tfFilename.getText());
  • 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        }
     
    8888        if (created_by == null || created_by.isEmpty()) {
    8989            tags.put("created_by", agent);
    9090        } else if (!created_by.contains(agent)) {
    91             tags.put("created_by", created_by + ";" + agent);
     91            tags.put("created_by", created_by + ';' + agent);
    9292        }
    9393        pnlTagEditor.getModel().initFromTags(tags);
    9494    }
  • org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

     
    4747                    uploadComment
    4848            ));
    4949        }
    50         msg.append(" ");
     50        msg.append(' ');
    5151        if (closeChangesetAfterNextUpload) {
    5252            msg.append(tr("The changeset is going to be <strong>closed</strong> after this upload"));
    5353        } else {
    5454            msg.append(tr("The changeset is <strong>left open</strong> after this upload"));
    5555        }
    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>)");
    5757        return msg.toString();
    5858    }
    5959
     
    116116                f.isBold() ? "bold" : "normal",
    117117                        f.isItalic() ? "italic" : "normal"
    118118        );
    119         rule = "body {" + rule + "}";
     119        rule = "body {" + rule + '}';
    120120        rule = MessageFormat.format(
    121121                "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
    122122                f.getName(),
     
    124124                "bold",
    125125                f.isItalic() ? "italic" : "normal"
    126126        );
    127         rule = "strong {" + rule + "}";
     127        rule = "strong {" + rule + '}';
    128128        ss.addRule(rule);
    129129        ss.addRule("a {text-decoration: underline; color: blue}");
    130130        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
  • org/openstreetmap/josm/gui/layer/GpxLayer.java

     
    152152
    153153            if (earliestDate.equals(latestDate)) {
    154154                DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT);
    155                 ts += earliestDate + " ";
     155                ts += earliestDate + ' ';
    156156                ts += tf.format(bounds[0]) + " - " + tf.format(bounds[1]);
    157157            } else {
    158158                DateFormat dtf = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
     
    183183        }
    184184
    185185        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>");
    192191
    193192            for (GpxTrack trk : data.tracks) {
    194193                info.append("<tr><td>");
     
    197196                }
    198197                info.append("</td><td>");
    199198                if (trk.getAttributes().containsKey("desc")) {
    200                     info.append(" ").append(trk.getAttributes().get("desc"));
     199                    info.append(' ').append(trk.getAttributes().get("desc"));
    201200                }
    202201                info.append("</td><td>");
    203202                info.append(getTimespanForTrack(trk));
  • org/openstreetmap/josm/gui/layer/ImageryLayer.java

     
    133133                panel.add(new UrlLabel(url), GBC.eol().insets(2, 5, 10, 0));
    134134            }
    135135            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));
    137137            }
    138138        }
    139139        return panel;
  • org/openstreetmap/josm/gui/layer/OsmDataLayer.java

     
    460460
    461461        String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes);
    462462        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)+ ')';
    464464        }
    465465
    466466        String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways);
    467467        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)+ ')';
    469469        }
    470470
    471471        String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations);
    472472        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)+ ')';
    474474        }
    475475
    476476        p.add(new JLabel(tr("{0} consists of:", getName())), GBC.eol());
     
    523523                new ConsistencyTestAction(),
    524524                SeparatorLayerAction.INSTANCE,
    525525                new LayerListPopup.InfoAction(this)}));
    526         return actions.toArray(new Action[0]);
     526        return actions.toArray(new Action[actions.size()]);
    527527    }
    528528
    529529    public static GpxData toGpxData(DataSet data, File file) {
  • org/openstreetmap/josm/gui/layer/WMSLayer.java

     
    953953            for (int i=0; i<threadCount; i++) {
    954954                Grabber grabber = getGrabber(i == 0 && threadCount > 1);
    955955                grabbers.add(grabber);
    956                 Thread t = new Thread(grabber, "WMS " + getName() + " " + i);
     956                Thread t = new Thread(grabber, "WMS " + getName() + ' ' + i);
    957957                t.setDaemon(true);
    958958                t.start();
    959959                grabberThreads.add(t);
  • org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

     
    193193                    x.printStackTrace();
    194194                    JOptionPane.showMessageDialog(
    195195                            Main.parent,
    196                             tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage(),
     196                            tr("Could not read \"{0}\"",sel.getName())+ '\n' +x.getMessage(),
    197197                            tr("Error"),
    198198                            JOptionPane.ERROR_MESSAGE
    199199                    );
     
    898898                    ? (int)Math.floor(tz/2) + ":00"
    899899                            : (int)Math.floor(tz/2) + ":30";
    900900                    if(sldTimezone.getValue() < 0) {
    901                         zone = "-" + zone;
     901                        zone = '-' + zone;
    902902                    }
    903903
    904904                    lblTimezone.setText(tr("Timezone: {0}", zone));
  • org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

     
    300300        entries.add(SeparatorLayerAction.INSTANCE);
    301301        entries.add(new LayerListPopup.InfoAction(this));
    302302
    303         return entries.toArray(new Action[0]);
     303        return entries.toArray(new Action[entries.size()]);
    304304
    305305    }
    306306
     
    311311                i++;
    312312            }
    313313        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);
    315315    }
    316316
    317317    @Override public Object getInfoComponent() {
  • org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

     
    529529                int ascent = metrics.getAscent();
    530530                Color bkground = new Color(255, 255, 255, 128);
    531531                int lastPos = 0;
    532                 int pos = osdText.indexOf("\n");
     532                int pos = osdText.indexOf('\n');
    533533                int x = 3;
    534534                int y = 3;
    535535                String line;
     
    542542                    g.drawString(line, x, y + ascent);
    543543                    y += (int) lineSize.getHeight();
    544544                    lastPos = pos + 1;
    545                     pos = osdText.indexOf("\n", lastPos);
     545                    pos = osdText.indexOf('\n', lastPos);
    546546                }
    547547
    548548                line = osdText.substring(lastPos);
  • org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java

     
    6565    }
    6666
    6767    private BufferedImage loadThumb(ImageEntry entry) {
    68         final String cacheIdent = entry.getFile().toString()+":"+maxSize;
     68        final String cacheIdent = entry.getFile().toString() + ':' + maxSize;
    6969
    7070        if (!cacheOff) {
    7171            BufferedImage cached = cache.getImg(cacheIdent);
  • org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

     
    248248                        (startTime - w1.time) / (w2.time - w1.time)));
    249249                wayPointFromTimeStamp.time = startTime;
    250250                String name = wavFile.getName();
    251                 int dot = name.lastIndexOf(".");
     251                int dot = name.lastIndexOf('.');
    252252                if (dot > 0) {
    253253                    name = name.substring(0, dot);
    254254                }
  • org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

     
    103103        public static TemplateEntryProperty forMarker(String layerName) {
    104104            String key = "draw.rawgps.layer.wpt.pattern";
    105105            if (layerName != null) {
    106                 key += "." + layerName;
     106                key += '.' + layerName;
    107107            }
    108108            TemplateEntryProperty result = cache.get(key);
    109109            if (result == null) {
     
    122122        public static TemplateEntryProperty forAudioMarker(String layerName) {
    123123            String key = "draw.rawgps.layer.audiowpt.pattern";
    124124            if (layerName != null) {
    125                 key += "." + layerName;
     125                key += '.' + layerName;
    126126            }
    127127            TemplateEntryProperty result = cache.get(key);
    128128            if (result == null) {
  • org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

     
    251251        components.add(new RenameLayerAction(getAssociatedFile(), this));
    252252        components.add(SeparatorLayerAction.INSTANCE);
    253253        components.add(new LayerListPopup.InfoAction(this));
    254         return components.toArray(new Action[0]);
     254        return components.toArray(new Action[components.size()]);
    255255    }
    256256
    257257    public boolean synchronizeAudioMarkers(AudioMarker startMarker) {
  • org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java

     
    3737            JOptionPane.showMessageDialog(Main.parent,
    3838                    "<html><b>" +
    3939                            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,
    4141                            tr("Error displaying URL"), JOptionPane.ERROR_MESSAGE);
    4242        }
    4343    }
  • org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java

     
    222222
    223223    @Override
    224224    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 + '}';
    226226    }
    227227
    228228}
  • org/openstreetmap/josm/gui/mappaint/Cascade.java

     
    192192    public String toString() {
    193193        StringBuilder res = new StringBuilder("Cascade{ ");
    194194        for (String key : prop.keySet()) {
    195             res.append(key+":");
     195            res.append(key).append(':');
    196196            Object val = prop.get(key);
    197197            if (val instanceof float[]) {
    198198                res.append(Arrays.toString((float[]) val));
    199199            } else if (val instanceof Color) {
    200200                res.append(Utils.toString((Color)val));
    201201            } else {
    202                 res.append(val+"");
     202                res.append(val);
    203203            }
    204204            res.append("; ");
    205205        }
    206         return res.append("}").toString();
     206        return res.append('}').toString();
    207207    }
    208208
    209209    public boolean containsKey(String key) {
  • org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategy.java

     
    6363
    6464        @Override
    6565        public String toString() {
    66             return "{"  + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + "}";
     66            return '{' + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + '}';
    6767        }
    6868
    6969        @Override
     
    118118
    119119        @Override
    120120        public String toString() {
    121             return "{" + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + "}";
     121            return '{' + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + '}';
    122122        }
    123123
    124124        @Override
     
    240240
    241241        @Override
    242242        public String toString() {
    243             return "{" + getClass().getSimpleName() +"}";
     243            return '{' + getClass().getSimpleName() + '}';
    244244        }
    245245    }
    246246}
  • org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java

     
    5252
    5353    @Override
    5454    public String toString() {
    55         return "LineTextElemStyle{" + super.toString() + "text=" + text + "}";
     55        return "LineTextElemStyle{" + super.toString() + "text=" + text + '}';
    5656    }
    5757
    5858}
  • org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

     
    164164        for(String fileset : prefIconDirs)
    165165        {
    166166            String[] a;
    167             if(fileset.indexOf("=") >= 0) {
     167            if(fileset.indexOf('=') >= 0) {
    168168                a = fileset.split("=", 2);
    169169            } else {
    170170                a = new String[] {"", fileset};
  • org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

     
    347347        StringBuilder s = new StringBuilder("NodeElemStyle{");
    348348        s.append(super.toString());
    349349        if (mapImage != null) {
    350             s.append(" icon=[" + mapImage + "]");
     350            s.append(" icon=[").append(mapImage).append(']');
    351351        }
    352352        if (symbol != null) {
    353             s.append(" symbol=[" + symbol + "]");
     353            s.append(" symbol=[").append(symbol).append(']');
    354354        }
    355355        s.append('}');
    356356        return s.toString();
  • org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java

     
    9191    public String toString() {
    9292        return "RepeatImageStyle{" + super.toString() + "pattern=[" + pattern +
    9393                "], offset=" + offset + ", spacing=" + spacing +
    94                 ", phase=" + (-phase) + ", align=" + align + "}";
     94                ", phase=" + (-phase) + ", align=" + align + '}';
    9595    }
    9696}
  • org/openstreetmap/josm/gui/mappaint/TextElement.java

     
    177177
    178178    protected String toStringImpl() {
    179179        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);
    182182        if (xOffset != 0) {
    183             sb.append(" xOffset=" + xOffset);
     183            sb.append(" xOffset=").append(xOffset);
    184184        }
    185185        if (yOffset != 0) {
    186             sb.append(" yOffset=" + yOffset);
     186            sb.append(" yOffset=").append(yOffset);
    187187        }
    188         sb.append(" color=" + Utils.toString(color));
     188        sb.append(" color=").append(Utils.toString(color));
    189189        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);
    192192        }
    193193        return sb.toString();
    194194    }
  • org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

     
    163163
    164164        @Override
    165165        public String toString() {
    166             return "[" + k + "'" + op + "'" + v + "]";
     166            return '[' + k + '\'' + op + '\'' + v + ']';
    167167        }
    168168    }
    169169
     
    251251
    252252        @Override
    253253        public String toString() {
    254             return "[" + (exclamationMarkPresent ? "!" : "") + label + "]";
     254            return '[' + (exclamationMarkPresent ? "!" : "") + label + ']';
    255255        }
    256256    }
    257257
     
    290290
    291291        @Override
    292292        public String toString() {
    293             return ":" + (not ? "!" : "") + id;
     293            return ':' + (not ? "!" : "") + id;
    294294        }
    295295    }
    296296
     
    310310
    311311        @Override
    312312        public String toString() {
    313             return "[" + e + "]";
     313            return "[" + e + ']';
    314314        }
    315315    }
    316316}
  • org/openstreetmap/josm/gui/mappaint/mapcss/LiteralExpression.java

     
    2727        if (literal instanceof float[]) {
    2828            return Arrays.toString((float[]) literal);
    2929        }
    30         return "<" + literal.toString() + ">";
     30        return '<' + literal.toString() + '>';
    3131    }
    3232
    3333}
  • org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

     
    192192
    193193        @Override
    194194        public String toString() {
    195             return left +" "+ (parentSelector? "<" : ">")+link+" " +right;
     195            return left +" "+ (parentSelector? "<" : ">")+link+ ' ' +right;
    196196        }
    197197    }
    198198
  • org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java

     
    2222    public String getKey()
    2323    {
    2424        if(value != null)
    25             return "n" + key + "=" + value;
     25            return 'n' + key + '=' + value;
    2626        else if(boolValue != null)
    27             return "b" + key  + "=" + OsmUtils.getNamedOsmBoolean(boolValue);
     27            return 'b' + key  + '=' + OsmUtils.getNamedOsmBoolean(boolValue);
    2828        else
    29             return "x" + key;
     29            return 'x' + key;
    3030    }
    3131    public void init()
    3232    {
     
    3535
    3636    public String toString()
    3737    {
    38       return "Rule["+key+","+(boolValue != null ? "b="+boolValue:"v="+value)+"]";
     38      return "Rule["+key+ ',' +(boolValue != null ? "b="+boolValue:"v="+value)+ ']';
    3939    }
    4040    public String toCode()
    4141    {
    42       return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+"]";
     42      return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+ ']';
    4343    }
    4444}
  • org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

     
    142142        for (String key : primitive.keySet()) {
    143143            String val = primitive.get(key);
    144144            IconPrototype p;
    145             if ((p = icons.get("n" + key + "=" + val)) != null) {
     145            if ((p = icons.get('n' + key + '=' + val)) != null) {
    146146                icon = update(icon, p, scale, mc);
    147147            }
    148             if ((p = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) {
     148            if ((p = icons.get('b' + key + '=' + OsmUtils.getNamedOsmBoolean(val))) != null) {
    149149                icon = update(icon, p, scale, mc);
    150150            }
    151             if ((p = icons.get("x" + key)) != null) {
     151            if ((p = icons.get('x' + key)) != null) {
    152152                icon = update(icon, p, scale, mc);
    153153            }
    154154        }
     
    175175            AreaPrototype styleArea;
    176176            LinePrototype styleLine;
    177177            LinemodPrototype styleLinemod;
    178             String idx = "n" + key + "=" + val;
     178            String idx = 'n' + key + '=' + val;
    179179            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    180180                p.area = update(p.area, styleArea, scale, mc);
    181181            }
     
    190190                    overlayMap.put(idx, styleLinemod);
    191191                }
    192192            }
    193             idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
     193            idx = 'b' + key + '=' + OsmUtils.getNamedOsmBoolean(val);
    194194            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    195195                p.area = update(p.area, styleArea, scale, mc);
    196196            }
     
    205205                    overlayMap.put(idx, styleLinemod);
    206206                }
    207207            }
    208             idx = "x" + key;
     208            idx = 'x' + key;
    209209            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    210210                p.area = update(p.area, styleArea, scale, mc);
    211211            }
  • org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java

     
    5151
    5252    Color convertColor(String colString)
    5353    {
    54         int i = colString.indexOf("#");
     54        int i = colString.indexOf('#');
    5555        Color ret;
    5656        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);
    5858        } else if(i == 0) {
    5959            ret = ColorHelper.html2color(colString);
    6060        } 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),
    6262                    ColorHelper.html2color(colString.substring(i)));
    6363        }
    6464        return ret;
     
    7373    }
    7474
    7575    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;
    7777        System.err.println(warning);
    7878        style.logError(new Exception(warning));
    7979    }
  • 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
  • org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

     
    205205        // OSM is an OAuth 1.0 provider and JOSM isn't a web app. We just add the oauth request token to
    206206        // the authorisation request, no callback parameter.
    207207        //
    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());
    210210        return sb.toString();
    211211    }
    212212
     
    266266                Entry<String,String> entry = it.next();
    267267                String value = entry.getValue();
    268268                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"));
    270270                if (it.hasNext()) {
    271                     sb.append("&");
     271                    sb.append('&');
    272272                }
    273273            }
    274274            return sb.toString();
  • org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java

     
    9191
    9292        // remove trailing slashes
    9393        while(url.endsWith("/")) {
    94             url = url.substring(0, url.lastIndexOf("/"));
     94            url = url.substring(0, url.lastIndexOf('/'));
    9595        }
    9696        return url;
    9797    }
  • org/openstreetmap/josm/gui/preferences/PluginPreference.java

     
    7777                    ));
    7878            sb.append("<ul>");
    7979            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>");
    8181            }
    8282            sb.append("</ul>");
    8383        }
     
    427427    class SearchFieldAdapter implements DocumentListener {
    428428        public void filter() {
    429429            String expr = tfFilter.getText().trim();
    430             if (expr.equals("")) {
     430            if (expr.isEmpty()) {
    431431                expr = null;
    432432            }
    433433            model.filterDisplayedPlugins(expr);
  • org/openstreetmap/josm/gui/preferences/SourceEditor.java

     
    10641064                    data,
    10651065                    new Comparator<String>() {
    10661066                        public int compare(String o1, String o2) {
    1067                             if (o1.equals("") && o2.equals(""))
     1067                            if (o1.isEmpty() && o2.isEmpty())
    10681068                                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;
    10711071                            return o1.compareTo(o2);
    10721072                        }
    10731073                    }
     
    12161216                ExtendedSourceEntry last = null;
    12171217
    12181218                while ((line = reader.readLine()) != null && !canceled) {
    1219                     if (line.trim().equals("")) {
     1219                    if (line.trim().isEmpty()) {
    12201220                        continue; // skip empty lines
    12211221                    }
    12221222                    if (line.startsWith("\t")) {
  • org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

     
    348348                p.removeAll();
    349349                for (File f: new File(".").listFiles()) {
    350350                   String s = f.getName();
    351                    int idx = s.indexOf("_");
     351                   int idx = s.indexOf('_');
    352352                   if (idx>=0) {
    353353                        String t=s.substring(0,idx);
    354354                        System.out.println(t);
     
    358358                }
    359359                for (File f: Main.pref.getPreferencesDirFile().listFiles()) {
    360360                   String s = f.getName();
    361                    int idx = s.indexOf("_");
     361                   int idx = s.indexOf('_');
    362362                   if (idx>=0) {
    363363                        String t=s.substring(0,idx);
    364364                        if (profileTypes.containsKey(t))
  • org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java

     
    6969            File sel = fc.getSelectedFile();
    7070            if (!sel.getName().endsWith(".xml")) sel=new File(sel.getAbsolutePath()+".xml");
    7171            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());
    7474            }
    7575            return sel;
    7676        }
  • org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanel.java

     
    6767        StringBuilder a = new StringBuilder("tms");
    6868        String z = sanitize(tmsZoom.getText());
    6969        if (!z.isEmpty()) {
    70             a.append("[").append(z).append("]");
     70            a.append('[').append(z).append(']');
    7171        }
    72         a.append(":");
     72        a.append(':');
    7373        a.append(getImageryRawUrl());
    7474        return a.toString();
    7575    }
  • 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);
    5151            if (pi.oldmode) {
    52                 sb.append("*");
     52                sb.append('*');
    5353            }
    5454        }
    5555        return sb.toString();
     
    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    }
  • org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

     
    162162
    163163        private JComponent build() {
    164164            StringBuilder s = new StringBuilder();
    165             s.append("<b>+proj=...</b> - <i>"+tr("Projection name")+"</i><br>");
    166             s.append("&nbsp;&nbsp;&nbsp;&nbsp;"+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("&nbsp;&nbsp;&nbsp;&nbsp;"+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("&nbsp;&nbsp;&nbsp;&nbsp;"+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("&nbsp;&nbsp;&nbsp;&nbsp;"+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("&nbsp;&nbsp;&nbsp;&nbsp;").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("&nbsp;&nbsp;&nbsp;&nbsp;").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("&nbsp;&nbsp;&nbsp;&nbsp;").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("&nbsp;&nbsp;&nbsp;&nbsp;").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>");
    184184
    185185            HtmlPanel info = new HtmlPanel(s.toString());
    186186            return info;
  • org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java

     
    109109                projections.add("EPSG:" + (32600 + zone + (hemisphere == Hemisphere.South?100:0)));
    110110            }
    111111        }
    112         return projections.toArray(new String[0]);
     112        return projections.toArray(new String[projections.size()]);
    113113    }
    114114
    115115    @Override
     
    133133        Hemisphere hemisphere = DEFAULT_HEMISPHERE;
    134134
    135135        if(args != null) {
    136             String[] array = args.toArray(new String[0]);
     136            String[] array = args.toArray(new String[args.size()]);
    137137
    138138            if (array.length > 1) {
    139139                hemisphere = Hemisphere.valueOf(array[1]);
  • org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

     
    156156    protected String getNormalizedApiUrl() {
    157157        String apiUrl = url.trim();
    158158        while(apiUrl.endsWith("/")) {
    159             apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf("/"));
     159            apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf('/'));
    160160        }
    161161        return apiUrl;
    162162    }
     
    196196            bin = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    197197            String line;
    198198            while ((line = bin.readLine()) != null) {
    199                 changesets.append(line).append("\n");
     199                changesets.append(line).append('\n');
    200200            }
    201201            if (! (changesets.toString().contains("<osm") && changesets.toString().contains("</osm>"))) {
    202202                // heuristic: if there isn't an opening and closing "<osm>" tag in the returned content,
  • org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

     
    194194
    195195        protected void updateEnabledState() {
    196196            boolean enabled =
    197                 !tfOsmServerUrl.getText().trim().equals("")
     197                    !tfOsmServerUrl.getText().trim().isEmpty()
    198198                && !tfOsmServerUrl.getText().trim().equals(lastTestedUrl);
    199199            if (enabled) {
    200200                lblValid.setIcon(null);
     
    229229
    230230        @Override
    231231        public boolean isValid() {
    232             if (getComponent().getText().trim().equals(""))
     232            if (getComponent().getText().trim().isEmpty())
    233233                return false;
    234234
    235235            try {
     
    242242
    243243        @Override
    244244        public void validate() {
    245             if (getComponent().getText().trim().equals("")) {
     245            if (getComponent().getText().trim().isEmpty()) {
    246246                feedbackInvalid(tr("OSM API URL must not be empty. Please enter the OSM API URL."));
    247247                return;
    248248            }
  • org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java

     
    159159    private void resetState() {
    160160        String newTitle;
    161161        if (extraText != null) {
    162             newTitle = taskTitle + " " + extraText;
     162            newTitle = taskTitle + ' ' + extraText;
    163163        } else {
    164164            newTitle = taskTitle;
    165165        }
  • org/openstreetmap/josm/gui/progress/ProgressTaskId.java

     
    66    private final String id;
    77
    88    public ProgressTaskId(String component, String task) {
    9         this.id = component + "." + task;
     9        this.id = component + '.' + task;
    1010    }
    1111
    1212    public String getId() {
  • 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        }
  • org/openstreetmap/josm/gui/tagging/TagModel.java

     
    116116            for (int i =0; i < values.size(); i++) {
    117117                sb.append(values.get(i));
    118118                if (i + 1 < values.size()) {
    119                     sb.append(";");
     119                    sb.append(';');
    120120                }
    121121            }
    122122            return sb.toString();
  • org/openstreetmap/josm/gui/tagging/TaggingPreset.java

     
    117117    }
    118118
    119119    public String getName() {
    120         return group != null ? group.getName() + "/" + getLocaleName() : getLocaleName();
     120        return group != null ? group.getName() + '/' + getLocaleName() : getLocaleName();
    121121    }
    122122    public String getRawName() {
    123         return group != null ? group.getRawName() + "/" + name : name;
     123        return group != null ? group.getRawName() + '/' + name : name;
    124124    }
    125125
    126126    /*
  • 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 != null && str.isEmpty())
    120120                return null;
    121121            try {
    122122                return Integer.parseInt(str);
     
    217217                    }
    218218                }
    219219            }
    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));
    221221            p.add(new JLabel(key), GBC.std().insets(0,0,10,0));
    222222            p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0,0,10,0));
    223223            if(types != null){
     
    436436        public String toString() {
    437437            return "KeyedItem [key=" + key + ", text=" + text
    438438                    + ", text_context=" + text_context + ", match=" + match
    439                     + "]";
     439                    + ']';
    440440        }
    441441    }
    442442
     
    468468        public String toString() {
    469469            return "Key [key=" + key + ", value=" + value + ", text=" + text
    470470                    + ", text_context=" + text_context + ", match=" + match
    471                     + "]";
     471                    + ']';
    472472        }
    473473    }
    474474   
     
    589589                pnl.add(releasebutton, GBC.eol());
    590590                value = pnl;
    591591            }
    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));
    593593            p.add(value, GBC.eol().fill(GBC.HORIZONTAL));
    594594            return true;
    595595        }
  • 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                    }
  • org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java

     
    8181        sb.append(value);
    8282        sb.append("',");
    8383        sb.append(priority.toString());
    84         sb.append(">");
     84        sb.append('>');
    8585        return sb.toString();
    8686    }
    8787
  • org/openstreetmap/josm/gui/widgets/HtmlPanel.java

     
    3636                f.isBold() ? "bold" : "normal",
    3737                        f.isItalic() ? "italic" : "normal"
    3838        );
    39         rule = "body {" + rule + "}";
     39        rule = "body {" + rule + '}';
    4040        rule = MessageFormat.format(
    4141                "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
    4242                f.getName(),
     
    4444                "bold",
    4545                f.isItalic() ? "italic" : "normal"
    4646        );
    47         rule = "strong {" + rule + "}";
     47        rule = "strong {" + rule + '}';
    4848        ss.addRule(rule);
    4949        ss.addRule("a {text-decoration: underline; color: blue}");
    5050        ss.addRule("ul {margin-left: 1cm; list-style-type: disc}");
  • org/openstreetmap/josm/io/AllFormatsImporter.java

     
    3434                continue;
    3535            }
    3636            ext.append(fi.filter.getExtensions());
    37             ext.append(",");
     37            ext.append(',');
    3838        }
    3939        // remove last comma
    4040        return ext.substring(0, ext.length()-1).toString();
  • org/openstreetmap/josm/io/BoundingBoxDownloader.java

     
    7272            progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));
    7373            if (crosses180th) {
    7474                // 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));
    7777                return result;
    7878            } else {
    7979                // Simple request
    80                 return downloadRawGps("trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page=", progressMonitor);
     80                return downloadRawGps("trackpoints?bbox="+lon1+ ',' +lat1+ ',' +lon2+ ',' +lat2+"&page=", progressMonitor);
    8181            }
    8282        } catch (IllegalArgumentException e) {
    8383            // caused by HttpUrlConnection in case of illegal stuff in the response
     
    102102    }
    103103
    104104    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;
    106106    }
    107107
    108108    /**
  • org/openstreetmap/josm/io/CacheFiles.java

     
    7070
    7171        boolean dir_writeable;
    7272        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);
    7474        this.dir = new File(cacheDir);
    7575        try {
    7676            this.dir.mkdirs();
     
    8080            dir_writeable = false;
    8181        }
    8282        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);
    8484        if(this.expire < 0) {
    8585            this.expire = CacheFiles.EXPIRE_NEVER;
    8686        }
    87         this.maxsize = Main.pref.getLong("cache." + ident + "." + "maxsize", 50);
     87        this.maxsize = Main.pref.getLong("cache." + ident + '.' + "maxsize", 50);
    8888        if(this.maxsize < 0) {
    8989            this.maxsize = -1;
    9090        }
     
    193193     * @param force will also write it to the preferences
    194194     */
    195195    public void setExpire(int amount, boolean force) {
    196         String key = "cache." + ident + "." + "expire";
     196        String key = "cache." + ident + '.' + "expire";
    197197        if(!Main.pref.get(key).isEmpty() && !force)
    198198            return;
    199199
     
    207207     * @param force will also write it to the preferences
    208208     */
    209209    public void setMaxSize(int amount, boolean force) {
    210         String key = "cache." + ident + "." + "maxsize";
     210        String key = "cache." + ident + '.' + "maxsize";
    211211        if(!Main.pref.get(key).isEmpty() && !force)
    212212            return;
    213213
     
    333333     * @return file structure
    334334     */
    335335    private File getPath(String ident, String ending) {
    336         return new File(dir, getUniqueFilename(ident) + "." + ending);
     336        return new File(dir, getUniqueFilename(ident) + '.' + ending);
    337337    }
    338338
    339339    /**
  • org/openstreetmap/josm/io/ChangesetQuery.java

     
    232232    public String getQueryString() {
    233233        StringBuffer sb = new StringBuffer();
    234234        if (uid != null) {
    235             sb.append("user").append("=").append(uid);
     235            sb.append("user").append('=').append(uid);
    236236        } else if (userName != null) {
    237237            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"));
    239239            } catch (UnsupportedEncodingException e) {
    240240                e.printStackTrace();
    241241            }
    242242        }
    243243        if (bounds != null) {
    244244            if (sb.length() > 0) {
    245                 sb.append("&");
     245                sb.append('&');
    246246            }
    247247            sb.append("bbox=").append(bounds.encodeAsString(","));
    248248        }
    249249        if (closedAfter != null && createdBefore != null) {
    250250            if (sb.length() > 0) {
    251                 sb.append("&");
     251                sb.append('&');
    252252            }
    253253            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));
    256256        } else if (closedAfter != null) {
    257257            if (sb.length() > 0) {
    258                 sb.append("&");
     258                sb.append('&');
    259259            }
    260260            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));
    262262        }
    263263
    264264        if (open != null) {
    265265            if (sb.length() > 0) {
    266                 sb.append("&");
     266                sb.append('&');
    267267            }
    268268            sb.append("open=").append(Boolean.toString(open));
    269269        } else if (closed != null) {
    270270            if (sb.length() > 0) {
    271                 sb.append("&");
     271                sb.append('&');
    272272            }
    273273            sb.append("closed=").append(Boolean.toString(closed));
    274274        }
     
    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);
  • 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;
  • org/openstreetmap/josm/io/GeoJSONWriter.java

     
    5454            insertCommaCoords = true;
    5555            appendCoord(n.getCoor());
    5656        }
    57         out.append("]");
     57        out.append(']');
    5858    }
    5959
    6060    @Override
     
    9090                }
    9191                insertCommaTags = true;
    9292                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('"');
    9494            }
    9595            out.append("\n\t},\n");
    9696        } else {
     
    9999        { // append primitive specific
    100100            out.append("\t\"geometry\": {");
    101101            p.accept(this);
    102             out.append("}");
     102            out.append('}');
    103103        }
    104         out.append("}");
     104        out.append('}');
    105105    }
    106106
    107107    protected void appendCoord(LatLon c) {
    108108        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(']');
    110110        }
    111111    }
    112112}
  • org/openstreetmap/josm/io/GpxReader.java

     
    154154                    currentState = State.link;
    155155                    currentLink = new GpxLink(atts.getValue("href"));
    156156                } 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"));
    158158                }
    159159                break;
    160160            case trk:
  • org/openstreetmap/josm/io/GpxWriter.java

     
    121121            if (attr.containsKey(META_AUTHOR_EMAIL)) {
    122122                String[] tmp = ((String)attr.get(META_AUTHOR_EMAIL)).split("@");
    123123                if (tmp.length == 2) {
    124                     inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+"\"");
     124                    inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+ '"');
    125125                }
    126126            }
    127127            // write the author link
     
    132132        // write the copyright details
    133133        if (attr.containsKey(META_COPYRIGHT_LICENSE)
    134134                || attr.containsKey(META_COPYRIGHT_YEAR)) {
    135             openAtt("copyright", "author=\""+ attr.get(META_COPYRIGHT_AUTHOR) +"\"");
     135            openAtt("copyright", "author=\""+ attr.get(META_COPYRIGHT_AUTHOR) + '"');
    136136            if (attr.containsKey(META_COPYRIGHT_YEAR)) {
    137137                simpleTag("year", (String) attr.get(META_COPYRIGHT_YEAR));
    138138            }
     
    157157        Bounds bounds = data.recalculateBounds();
    158158        if (bounds != null) {
    159159            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() + '"';
    161161            inline("bounds", b);
    162162        }
    163163
     
    208208    }
    209209
    210210    private void open(String tag) {
    211         out.print(indent + "<" + tag + ">");
     211        out.print(indent + '<' + tag + '>');
    212212        indent += "  ";
    213213    }
    214214
    215215    private void openAtt(String tag, String attributes) {
    216         out.println(indent + "<" + tag + " " + attributes + ">");
     216        out.println(indent + '<' + tag + ' ' + attributes + '>');
    217217        indent += "  ";
    218218    }
    219219
    220220    private void inline(String tag, String attributes) {
    221         out.println(indent + "<" + tag + " " + attributes + "/>");
     221        out.println(indent + '<' + tag + ' ' + attributes + "/>");
    222222    }
    223223
    224224    private void close(String tag) {
    225225        indent = indent.substring(2);
    226         out.print(indent + "</" + tag + ">");
     226        out.print(indent + "</" + tag + '>');
    227227    }
    228228
    229229    private void closeln(String tag) {
     
    239239        if (content != null && content.length() > 0) {
    240240            open(tag);
    241241            out.print(encode(content));
    242             out.println("</" + tag + ">");
     242            out.println("</" + tag + '>');
    243243            indent = indent.substring(2);
    244244        }
    245245    }
     
    249249     */
    250250    private void gpxLink(GpxLink link) {
    251251        if (link != null) {
    252             openAtt("link", "href=\"" + link.uri + "\"");
     252            openAtt("link", "href=\"" + link.uri + '"');
    253253            simpleTag("text", link.text);
    254254            simpleTag("type", link.type);
    255255            closeln("link");
     
    276276        }
    277277        if (pnt != null) {
    278278            LatLon c = pnt.getCoor();
    279             String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"";
     279            String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + '"';
    280280            if (pnt.attr.isEmpty()) {
    281281                inline(type, coordAttr);
    282282            } else {
  • org/openstreetmap/josm/io/JpgImporter.java

     
    3434     * @since 5438
    3535     */
    3636    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")+ ')');
    3838
    3939    /**
    4040     * Constructs a new {@code JpgImporter}.
  • org/openstreetmap/josm/io/MirroredInputStream.java

     
    110110            Enumeration<? extends ZipEntry> entries = zipFile.entries();
    111111            while (entries.hasMoreElements()) {
    112112                ZipEntry entry = entries.nextElement();
    113                 if (entry.getName().endsWith("." + extension)) {
     113                if (entry.getName().endsWith('.' + extension)) {
    114114                    /* choose any file with correct extension. When more than
    115115                        one file, prefer the one which matches namepart */
    116116                    if (resentry == null || entry.getName().indexOf(namepart) >= 0) {
     
    170170        StringBuilder prefKey = new StringBuilder("mirror.");
    171171        if (destDir != null) {
    172172            prefKey.append(destDir);
    173             prefKey.append(".");
     173            prefKey.append('.');
    174174        }
    175175        prefKey.append(url.toString());
    176176        return prefKey.toString().replaceAll("=","_");
  • org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

     
    270270        for (int i=0; i<idPackage.size(); i++) {
    271271            sb.append(it.next());
    272272            if (i < idPackage.size()-1) {
    273                 sb.append(",");
     273                sb.append(',');
    274274            }
    275275        }
    276276        return sb.toString();
     
    345345        }
    346346        // Run the fetchers
    347347        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());
    349349            try {
    350350                FetchResult result = ecs.take().get();
    351351                if (result.missingPrimitives != null) {
  • org/openstreetmap/josm/io/NMEAImporter.java

     
    5151
    5252    private void showNmeaInfobox(boolean success, NmeaReader r) {
    5353        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>");
    5757        if (!success) {
    58             msg.append(tr("Unknown sentences: {0}", r.getParserUnknown()) + "<br>");
     58            msg.append(tr("Unknown sentences: {0}", r.getParserUnknown())).append("<br>");
    5959        }
    6060        msg.append(tr("Zero coordinates: {0}", r.getParserZeroCoordinates()));
    6161        msg.append("</html>");
  • 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()) {
    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
  • org/openstreetmap/josm/io/OsmApi.java

     
    316316    public String getBaseUrl() {
    317317        StringBuffer rv = new StringBuffer(serverUrl);
    318318        if (version != null) {
    319             rv.append("/");
     319            rv.append('/');
    320320            rv.append(version);
    321321        }
    322         rv.append("/");
     322        rv.append('/');
    323323        // this works around a ruby (or lighttpd) bug where two consecutive slashes in
    324324        // an URL will cause a "404 not found" response.
    325325        int p; while ((p = rv.indexOf("//", 6)) > -1) { rv.delete(p, p + 1); }
     
    360360            ensureValidChangeset();
    361361            initialize(monitor);
    362362            // 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);
    364364            osm.setOsmId(osm.getId(), Integer.parseInt(ret.trim()));
    365365            osm.setChangesetId(getChangeset().getId());
    366366            osm.setVisible(true);
     
    480480            initialize(monitor);
    481481            /* send "\r\n" instead of empty string, so we don't send zero payload - works around bugs
    482482               in proxy software */
    483             sendRequest("PUT", "changeset" + "/" + changeset.getId() + "/close", "\r\n", monitor);
     483            sendRequest("PUT", "changeset" + '/' + changeset.getId() + "/close", "\r\n", monitor);
    484484            changeset.setOpen(false);
    485485        } finally {
    486486            monitor.finishTask();
     
    595595        while(true) { // the retry loop
    596596            try {
    597597                URL url = new URL(new URL(getBaseUrl()), urlSuffix);
    598                 System.out.print(requestMethod + " " + url + "... ");
     598                System.out.print(requestMethod + ' ' + url + "... ");
    599599                // fix #5369, see http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive
    600600                activeConnection = Utils.openHttpConnection(url, false);
    601601                activeConnection.setConnectTimeout(fastFail ? 1000 : Main.pref.getInteger("socket.timeout.connect",15)*1000);
     
    658658                    String s;
    659659                    while((s = in.readLine()) != null) {
    660660                        responseBody.append(s);
    661                         responseBody.append("\n");
     661                        responseBody.append('\n');
    662662                    }
    663663                }
    664664                String errorHeader = null;
  • org/openstreetmap/josm/io/OsmApiException.java

     
    138138            if (!eh.isEmpty()) {
    139139                sb.append(", Error Header=<")
    140140                .append(eh)
    141                 .append(">");
     141                .append('>');
    142142            }
    143143        }
    144144        catch (Exception e) {
     
    150150            if (!eb.isEmpty() && !eb.equals(eh)) {
    151151                sb.append(", Error Body=<")
    152152                .append(eb)
    153                 .append(">");
     153                .append('>');
    154154            }
    155155        }
    156156        catch (Exception e) {
     
    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));
  • org/openstreetmap/josm/io/OsmConnection.java

     
    9090        } else {
    9191            String username= response.getUsername() == null ? "" : response.getUsername();
    9292            String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword());
    93             token = username + ":" + password;
     93            token = username + ':' + password;
    9494            try {
    9595                ByteBuffer bytes = encoder.encode(CharBuffer.wrap(token));
    9696                con.addRequestProperty("Authorization", "Basic "+Base64.encode(bytes));
  • org/openstreetmap/josm/io/OsmDataParsingException.java

     
    4141        if (msg == null) {
    4242            msg = getClass().getName();
    4343        }
    44         msg = msg + " " + tr("(at line {0}, column {1})", lineNumber, columnNumber);
     44        msg = msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber);
    4545        return msg;
    4646    }
    4747
  • org/openstreetmap/josm/io/OsmExporter.java

     
    6262            // process of writing the file, we might just end up with
    6363            // a truncated file.  That can destroy lots of work.
    6464            if (file.exists()) {
    65                 tmpFile = new File(file.getPath() + "~");
     65                tmpFile = new File(file.getPath() + '~');
    6666                Utils.copyFile(file, tmpFile);
    6767            }
    6868
  • org/openstreetmap/josm/io/OsmHistoryReader.java

     
    5656        protected String getCurrentPosition() {
    5757            if (locator == null)
    5858                return "";
    59             return "(" + locator.getLineNumber() + "," + locator.getColumnNumber() + ")";
     59            return "(" + locator.getLineNumber() + ',' + locator.getColumnNumber() + ')';
    6060        }
    6161
    6262        protected void throwException(String message) throws SAXException {
  • org/openstreetmap/josm/io/OsmReader.java

     
    563563            }
    564564            if (getLocation() == null)
    565565                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());
    567567            return msg;
    568568        }
    569569    }
  • org/openstreetmap/josm/io/OsmServerBackreferenceReader.java

     
    136136            progressMonitor.indeterminateSubTask(tr("Downloading from OSM Server..."));
    137137            StringBuffer sb = new StringBuffer();
    138138            sb.append(primitiveType.getAPIName())
    139             .append("/").append(id).append("/ways");
     139            .append('/').append(id).append("/ways");
    140140
    141141            in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true));
    142142            if (in == null)
     
    170170            progressMonitor.subTask(tr("Contacting OSM Server..."));
    171171            StringBuffer sb = new StringBuffer();
    172172            sb.append(primitiveType.getAPIName())
    173             .append("/").append(id).append("/relations");
     173            .append('/').append(id).append("/relations");
    174174
    175175            in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true));
    176176            if (in == null)
  • org/openstreetmap/josm/io/OsmServerHistoryReader.java

     
    6161            progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));
    6262            StringBuffer sb = new StringBuffer();
    6363            sb.append(primitiveType.getAPIName())
    64             .append("/").append(id).append("/history");
     64            .append('/').append(id).append("/history");
    6565
    6666            in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true));
    6767            if (in == null)
  • org/openstreetmap/josm/io/OsmServerObjectReader.java

     
    123123            progressMonitor.indeterminateSubTask(tr("Downloading OSM data..."));
    124124            StringBuffer sb = new StringBuffer();
    125125            sb.append(id.getType().getAPIName());
    126             sb.append("/");
     126            sb.append('/');
    127127            sb.append(id.getUniqueId());
    128128            if (full && ! id.getType().equals(OsmPrimitiveType.NODE)) {
    129129                sb.append("/full");
    130130            } else if (version > 0) {
    131                 sb.append("/"+version);
     131                sb.append('/').append(version);
    132132            }
    133133
    134134            in = getInputStream(sb.toString(), progressMonitor.createSubTaskMonitor(1, true));
  • org/openstreetmap/josm/io/OsmServerReader.java

     
    127127                            String s;
    128128                            while((s = in.readLine()) != null) {
    129129                                errorBody.append(s);
    130                                 errorBody.append("\n");
     130                                errorBody.append('\n');
    131131                            }
    132132                        }
    133133                    }
  • org/openstreetmap/josm/io/OsmServerWriter.java

     
    6969        int ms_left = (int)(uploads_left / uploads_per_ms);
    7070        int minutes_left = ms_left / MSECS_PER_MINUTE;
    7171        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) + ':';
    7373        if (seconds_left < 10) {
    7474            time_left_str += "0";
    7575        }
  • org/openstreetmap/josm/io/OsmWriter.java

     
    178178            out.println("/>");
    179179        } else {
    180180            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()+ '\'');
    182182            }
    183183            addTags(n, "node", true);
    184184        }
     
    219219
    220220    public void visit(Changeset cs) {
    221221        out.print("  <changeset ");
    222         out.print(" id='"+cs.getId()+"'");
     222        out.print(" id='"+cs.getId()+ '\'');
    223223        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() + '\'');
    226226        }
    227227        if (cs.getCreatedAt() != null) {
    228             out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +"'");
     228            out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) + '\'');
    229229        }
    230230        if (cs.getClosedAt() != null) {
    231             out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +"'");
     231            out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) + '\'');
    232232        }
    233         out.print(" open='"+ (cs.isOpen() ? "true" : "false") +"'");
     233        out.print(" open='"+ (cs.isOpen() ? "true" : "false") + '\'');
    234234        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) + '\'');
    237237        }
    238238        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) + '\'');
    241241        }
    242242        out.println(">");
    243243        addTags(cs, "changeset", false); // also writes closing </changeset>
     
    260260                out.println("    <tag k='"+ XmlWriter.encode(e.getKey()) +
    261261                        "' v='"+XmlWriter.encode(e.getValue())+ "' />");
    262262            }
    263             out.println("  </" + tagname + ">");
     263            out.println("  </" + tagname + '>');
    264264        } else if (tagOpen) {
    265265            out.println(" />");
    266266        } else {
    267             out.println("  </" + tagname + ">");
     267            out.println("  </" + tagname + '>');
    268268        }
    269269    }
    270270
     
    275275    protected void addCommon(IPrimitive osm, String tagname) {
    276276        out.print("  <"+tagname);
    277277        if (osm.getUniqueId() != 0) {
    278             out.print(" id='"+ osm.getUniqueId()+"'");
     278            out.print(" id='"+ osm.getUniqueId()+ '\'');
    279279        } else
    280280            throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found"));
    281281        if (!isOsmChange) {
     
    287287                    action = "modify";
    288288                }
    289289                if (action != null) {
    290                     out.print(" action='"+action+"'");
     290                    out.print(" action='"+action+ '\'');
    291291                }
    292292            }
    293293            if (!osm.isTimestampEmpty()) {
    294                 out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+"'");
     294                out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+ '\'');
    295295            }
    296296            // user and visible added with 0.4 API
    297297            if (osm.getUser() != null) {
    298298                if(osm.getUser().isLocalUser()) {
    299                     out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'");
     299                    out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+ '\'');
    300300                } else if (osm.getUser().isOsmUser()) {
    301301                    // 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())+ '\'');
    304304                }
    305305            }
    306             out.print(" visible='"+osm.isVisible()+"'");
     306            out.print(" visible='"+osm.isVisible()+ '\'');
    307307        }
    308308        if (osm.getVersion() != 0) {
    309             out.print(" version='"+osm.getVersion()+"'");
     309            out.print(" version='"+osm.getVersion()+ '\'');
    310310        }
    311311        if (this.changeset != null && this.changeset.getId() != 0) {
    312             out.print(" changeset='"+this.changeset.getId()+"'" );
     312            out.print(" changeset='"+this.changeset.getId()+ '\'');
    313313        } else if (osm.getChangesetId() > 0 && !osm.isNew()) {
    314             out.print(" changeset='"+osm.getChangesetId()+"'" );
     314            out.print(" changeset='"+osm.getChangesetId()+ '\'');
    315315        }
    316316    }
    317317}
  • 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() {
  • org/openstreetmap/josm/io/imagery/ImageryReader.java

     
    130130                } else if (qName.equals("bounds")) {
    131131                    try {
    132132                        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") + ',' +
    136136                                        atts.getValue("max-lon"), ",");
    137137                    } catch (IllegalArgumentException e) {
    138138                        break;
  • 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\\(([^,]+),([^}]+)\\)\\}");
  • org/openstreetmap/josm/io/imagery/WMSImagery.java

     
    7272        a.append("://");
    7373        a.append(serviceUrl.getHost());
    7474        if (serviceUrl.getPort() != -1) {
    75             a.append(":");
     75            a.append(':');
    7676            a.append(serviceUrl.getPort());
    7777        }
    7878        a.append(serviceUrl.getPath());
    79         a.append("?");
     79        a.append('?');
    8080        if (serviceUrl.getQuery() != null) {
    8181            a.append(serviceUrl.getQuery());
    8282            if (!serviceUrl.getQuery().isEmpty() && !serviceUrl.getQuery().endsWith("&")) {
    83                 a.append("&");
     83                a.append('&');
    8484            }
    8585        }
    8686        return a.toString();
     
    110110                getCapabilitiesUrl = new URL(serviceUrlStr);
    111111                final String getCapabilitiesQuery = "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities";
    112112                if (getCapabilitiesUrl.getQuery() == null) {
    113                     getCapabilitiesUrl = new URL(serviceUrlStr + "?" + getCapabilitiesQuery);
     113                    getCapabilitiesUrl = new URL(serviceUrlStr + '?' + getCapabilitiesQuery);
    114114                } else if (!getCapabilitiesUrl.getQuery().isEmpty() && !getCapabilitiesUrl.getQuery().endsWith("&")) {
    115                     getCapabilitiesUrl = new URL(serviceUrlStr + "&" + getCapabilitiesQuery);
     115                    getCapabilitiesUrl = new URL(serviceUrlStr + '&' + getCapabilitiesQuery);
    116116                } else {
    117117                    getCapabilitiesUrl = new URL(serviceUrlStr + getCapabilitiesQuery);
    118118                }
     
    134134        StringBuilder ba = new StringBuilder();
    135135        while ((line = br.readLine()) != null) {
    136136            ba.append(line);
    137             ba.append("\n");
     137            ba.append('\n');
    138138        }
    139139        String incomingData = ba.toString();
    140140
  • org/openstreetmap/josm/io/imagery/WMSRequest.java

     
    107107    @Override
    108108    public String toString() {
    109109        return "WMSRequest [xIndex=" + xIndex + ", yIndex=" + yIndex
    110                 + ", pixelPerDegree=" + pixelPerDegree + "]";
     110                + ", pixelPerDegree=" + pixelPerDegree + ']';
    111111    }
    112112
    113113    public boolean isReal() {
  • org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

     
    102102        {
    103103            command = command.substring(1);
    104104        }
    105         String commandWithSlash = "/" + command;
     105        String commandWithSlash = '/' + command;
    106106        if (handlers.get(commandWithSlash) != null) {
    107107            System.out.println("RemoteControl: ignoring duplicate command " + command
    108108                    + " with handler " + handler.getName());
    109109        } else {
    110110            if (!silent) {
    111111                System.out.println("RemoteControl: adding command \"" +
    112                     command + "\" (handled by " + handler.getSimpleName() + ")");
     112                    command + "\" (handled by " + handler.getSimpleName() + ')');
    113113            }
    114114            handlers.put(commandWithSlash, handler);
    115115        }
  • org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

     
    6262    private void addNode(HashMap<String, String> args){
    6363
    6464        // Parse the arguments
    65         System.out.println("Adding node at (" + lat + ", " + lon + ")");
     65        System.out.println("Adding node at (" + lat + ", " + lon + ')');
    6666
    6767        // Create a new node
    6868        LatLon ll = new LatLon(lat, lon);
     
    9999            lat = Double.parseDouble(args.get("lat"));
    100100            lon = Double.parseDouble(args.get("lon"));
    101101        } catch (NumberFormatException e) {
    102             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
     102            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')');
    103103        }
    104104        if (!Main.main.hasEditLayer()) {
    105105             throw new RequestHandlerBadRequestException(tr("There is no layer opened to add node"));
  • org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

     
    8181                double lon = Double.parseDouble(coordinates[1]);
    8282                allCoordinates.add(new LatLon(lat, lon));
    8383            } catch (NumberFormatException e) {
    84                 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
     84                throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')');
    8585            }
    8686        }
    8787        if (allCoordinates.isEmpty()) {
  • org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

     
    5353            try {
    5454                imgInfo.setDefaultMinZoom(Integer.parseInt(min_zoom));
    5555            } catch (NumberFormatException e) {
    56                 System.err.println("NumberFormatException ("+e.getMessage()+")");
     56                System.err.println("NumberFormatException ("+e.getMessage()+ ')');
    5757            }
    5858        }
    5959        String max_zoom = args.get("max_zoom");
     
    6161            try {
    6262                imgInfo.setDefaultMaxZoom(Integer.parseInt(max_zoom));
    6363            } catch (NumberFormatException e) {
    64                 System.err.println("NumberFormatException ("+e.getMessage()+")");
     64                System.err.println("NumberFormatException ("+e.getMessage()+ ')');
    6565            }
    6666        }
    6767        GuiHelper.runInEDT(new Runnable() {
  • org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

     
    221221            minlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("left")));
    222222            maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right")));
    223223        } catch (NumberFormatException e) {
    224             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
     224            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+ ')');
    225225        }
    226226
    227227        // Process optional argument 'select'
  • org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

     
    201201            String value = args.get(key);
    202202            if ((value == null) || (value.length() == 0)) {
    203203                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");
    205205                missingKeys.add(key);
    206206            }
    207207        }
  • org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java

     
    2222        content = RequestProcessor.PROTOCOLVERSION;
    2323        contentType = "application/json";
    2424        if (args.containsKey("jsonp")) {
    25             content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ")";
     25            content = args.get("jsonp") + " && " + args.get("jsonp") + '(' + content + ')';
    2626        }
    2727    }
    2828
  • 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
  • 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
  • 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
  • org/openstreetmap/josm/plugins/PluginHandler.java

     
    214214        for (DeprecatedPlugin depr: removedPlugins) {
    215215            sb.append("<li>").append(depr.name);
    216216            if (depr.reason != null) {
    217                 sb.append(" (").append(depr.reason).append(")");
     217                sb.append(" (").append(depr.reason).append(')');
    218218            }
    219219            sb.append("</li>");
    220220        }
     
    11191119        int pos = stack.length;
    11201120        for (PluginProxy p : pluginList) {
    11211121            String baseClass = p.getPluginInformation().className;
    1122             baseClass = baseClass.substring(0, baseClass.lastIndexOf("."));
     1122            baseClass = baseClass.substring(0, baseClass.lastIndexOf('.'));
    11231123            for (int elpos = 0; elpos < pos; ++elpos) {
    11241124                if (stack[elpos].getClassName().startsWith(baseClass)) {
    11251125                    pos = elpos;
     
    11791179        for (final PluginProxy pp : pluginList) {
    11801180            PluginInformation pi = pp.getPluginInformation();
    11811181            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") + ')');
    11841184        }
    11851185        Collections.sort(pl);
    11861186        for (String s : pl) {
    1187             text += "Plugin: " + s + "\n";
     1187            text += "Plugin: " + s + '\n';
    11881188        }
    11891189        return text;
    11901190    }
     
    11941194        for (final PluginProxy p : pluginList) {
    11951195            final PluginInformation info = p.getPluginInformation();
    11961196            String name = info.name
    1197             + (info.version != null && !info.version.equals("") ? " Version: " + info.version : "");
     1197            + (info.version != null && !info.version.isEmpty() ? " Version: " + info.version : "");
    11981198            pluginTab.add(new JLabel(name), GBC.std());
    11991199            pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
    12001200            pluginTab.add(new JButton(new AbstractAction(tr("Information")) {
     
    12041204                        b.append(e.getKey());
    12051205                        b.append(": ");
    12061206                        b.append(e.getValue());
    1207                         b.append("\n");
     1207                        b.append('\n');
    12081208                    }
    12091209                    JosmTextArea a = new JosmTextArea(10, 40);
    12101210                    a.setEditable(false);
  • org/openstreetmap/josm/plugins/PluginInformation.java

     
    229229                        if(mv <= myv && (mv > mainversion || mainversion > myv))
    230230                        {
    231231                            String v = (String)entry.getValue();
    232                             int i = v.indexOf(";");
     232                            int i = v.indexOf(';');
    233233                            if(i > 0)
    234234                            {
    235235                                downloadlink = v.substring(i+1);
     
    277277        }
    278278        if (downloadlink != null && !downloadlink.startsWith("http://svn.openstreetmap.org/applications/editors/josm/dist/")
    279279        && !downloadlink.startsWith("http://trac.openstreetmap.org/browser/applications/editors/josm/dist/")) {
    280             sb.append("<p>&nbsp;</p><p>"+tr("<b>Plugin provided by an external source:</b> {0}", downloadlink)+"</p>");
     280            sb.append("<p>&nbsp;</p><p>").append(tr("<b>Plugin provided by an external source:</b> {0}", downloadlink)).append("</p>");
    281281        }
    282282        sb.append("</body></html>");
    283283        return sb.toString();
  • org/openstreetmap/josm/plugins/PluginListParser.java

     
    7777                if (line.startsWith("\t")) {
    7878                    line = line.substring(1);
    7979                    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);
    8282                    }
    83                     manifest.append(line).append("\n");
     83                    manifest.append(line).append('\n');
    8484                    continue;
    8585                }
    8686                addPluginInformation(ret, name, url, manifest.toString());
  • org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

     
    107107            URL url = new URL(site);
    108108            StringBuilder sb = new StringBuilder();
    109109            sb.append("site-");
    110             sb.append(url.getHost()).append("-");
     110            sb.append(url.getHost()).append('-');
    111111            if (url.getPort() != -1) {
    112                 sb.append(url.getPort()).append("-");
     112                sb.append(url.getPort()).append('-');
    113113            }
    114114            String path = url.getPath();
    115115            for (int i =0;i<path.length(); i++) {
     
    117117                if (Character.isLetterOrDigit(c)) {
    118118                    sb.append(c);
    119119                } else {
    120                     sb.append("_");
     120                    sb.append('_');
    121121                }
    122122            }
    123123            switch (type) {
     
    167167            in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
    168168            String line;
    169169            while((line = in.readLine()) != null) {
    170                 sb.append(line).append("\n");
     170                sb.append(line).append('\n');
    171171            }
    172172            return sb.toString();
    173173        } catch(MalformedURLException e) {
  • org/openstreetmap/josm/tools/BugReportExceptionHandler.java

     
    121121                            if(urltext.length() > maxlen)
    122122                            {
    123123                                urltext = urltext.substring(0,maxlen);
    124                                 int idx = urltext.lastIndexOf("\n");
     124                                int idx = urltext.lastIndexOf('\n');
    125125                                /* cut whole line when not loosing too much */
    126126                                if(maxlen-idx < 200) {
    127127                                    urltext = urltext.substring(0,idx+1);
  • org/openstreetmap/josm/tools/ColorHelper.java

     
    3232    public static String color2html(Color col) {
    3333        if (col == null)
    3434            return null;
    35         return "#"+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());
     35        return '#' +int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());
    3636    }
    3737}
  • org/openstreetmap/josm/tools/ExceptionUtil.java

     
    271271        String msg = null;
    272272        if (header != null) {
    273273            if (body != null && !header.equals(body)) {
    274                 msg = header + " (" + body + ")";
     274                msg = header + " (" + body + ')';
    275275            } else {
    276276                msg = header;
    277277            }
     
    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();
  • org/openstreetmap/josm/tools/I18n.java

     
    254254    private static final String gettext(String text, String ctx, boolean lazy)
    255255    {
    256256        int i;
    257         if(ctx == null && text.startsWith("_:") && (i = text.indexOf("\n")) >= 0)
     257        if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0)
    258258        {
    259259            ctx = text.substring(2,i-1);
    260260            text = text.substring(i+1);
    261261        }
    262262        if(strings != null)
    263263        {
    264             String trans = strings.get(ctx == null ? text : "_:"+ctx+"\n"+text);
     264            String trans = strings.get(ctx == null ? text : "_:"+ctx+ '\n' +text);
    265265            if(trans != null)
    266266                return trans;
    267267        }
    268268        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);
    270270            if(trans != null)
    271271                return trans[0];
    272272        }
     
    286286    private static final String gettextn(String text, String plural, String ctx, long num)
    287287    {
    288288        int i;
    289         if(ctx == null && text.startsWith("_:") && (i = text.indexOf("\n")) >= 0)
     289        if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0)
    290290        {
    291291            ctx = text.substring(2,i-1);
    292292            text = text.substring(i+1);
     
    294294        if(pstrings != null)
    295295        {
    296296            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);
    298298            if(trans != null && trans.length > i)
    299299                return trans[i];
    300300        }
  • 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;
     
    425425                    String cache_name = full_name;
    426426                    /* cache separately */
    427427                    if (dirs != null && dirs.size() > 0) {
    428                         cache_name = "id:" + id + ":" + full_name;
     428                        cache_name = "id:" + id + ':' + full_name;
    429429                        if(archive != null) {
    430                             cache_name += ":" + archive.getName();
     430                            cache_name += ':' + archive.getName();
    431431                        }
    432432                    }
    433433
     
    510510                }
    511511            } else {
    512512                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;
    514514            }
    515515            result = getIfAvailableHttp(url, type);
    516516            if (result != null) {
  • org/openstreetmap/josm/tools/LanguageInfo.java

     
    4444            }
    4545        } else if(type == LocaleType.DEFAULTNOTENGLISH && code == "en")
    4646            return null;
    47         return code.substring(0,1).toUpperCase() + code.substring(1) + ":";
     47        return code.substring(0,1).toUpperCase() + code.substring(1) + ':';
    4848    }
    4949
    5050    /**
     
    119119
    120120    static public String getLanguageCodeXML()
    121121    {
    122         return getJOSMLocaleCode()+".";
     122        return getJOSMLocaleCode()+ '.';
    123123    }
    124124    static public String getLanguageCodeManifest()
    125125    {
    126         return getJOSMLocaleCode()+"_";
     126        return getJOSMLocaleCode()+ '_';
    127127    }
    128128}
  • org/openstreetmap/josm/tools/MultiMap.java

     
    162162    public String toString() {
    163163        List<String> entries = new ArrayList<String>(map.size());
    164164        for (A key : map.keySet()) {
    165             entries.add(key + "->{" + Utils.join(",", map.get(key)) + "}");
     165            entries.add(key + "->{" + Utils.join(",", map.get(key)) + '}');
    166166        }
    167         return "(" + Utils.join(",", entries) + ")";
     167        return '(' + Utils.join(",", entries) + ')';
    168168    }
    169169}
  • org/openstreetmap/josm/tools/MultikeyActionsHandler.java

     
    127127    }
    128128
    129129    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;
    131131
    132132        return "<html><i>" + shortcutText + "</i>&nbsp;&nbsp;&nbsp;&nbsp;" + description;
    133133
  • org/openstreetmap/josm/tools/OsmUrlToBounds.java

     
    7373    private static double parseDouble(HashMap<String, String> map, String key) {
    7474        if (map.containsKey(key))
    7575            return Double.parseDouble(map.get(key));
    76         return Double.parseDouble(map.get("m"+key));
     76        return Double.parseDouble(map.get('m' +key));
    7777    }
    7878
    7979    private static final char[] SHORTLINK_CHARS = {
  • org/openstreetmap/josm/tools/Pair.java

     
    4444
    4545    @Override
    4646    public String toString() {
    47         return "<"+a+","+b+">";
     47        return "<" + a + ',' + b + '>';
    4848    }
    4949
    5050    /* convenience constructor method */
  • org/openstreetmap/josm/tools/PlatformHookOsx.java

     
    227227            if (canHtml) {
    228228                result += "<font size='-2'>";
    229229            }
    230             result += "("+sc.getKeyText()+")";
     230            result += '(' +sc.getKeyText()+ ')';
    231231            if (canHtml) {
    232232                result += "</font>";
    233233            }
     
    255255     */
    256256    @Override
    257257    public String getOSDescription() {
    258         return System.getProperty("os.name") + " " + System.getProperty("os.version");
     258        return System.getProperty("os.name") + ' ' + System.getProperty("os.version");
    259259    }
    260260}
  • org/openstreetmap/josm/tools/PlatformHookUnixoid.java

     
    3636        String[] programs = {"gnome-open", "kfmclient openURL", "firefox"};
    3737        for (String program : programs) {
    3838            try {
    39                 Runtime.getRuntime().exec(program+" "+url);
     39                Runtime.getRuntime().exec(program+ ' ' +url);
    4040                return;
    4141            } catch (IOException e) {
    4242            }
     
    6464        if (sc != null && sc.getKeyText().length() != 0) {
    6565            result += " ";
    6666            result += "<font size='-2'>";
    67             result += "("+sc.getKeyText()+")";
     67            result += '(' +sc.getKeyText()+ ')';
    6868            result += "</font>";
    6969        }
    7070        result += "&nbsp;</html>";
     
    166166
    167167        @Override public String toString() {
    168168            return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField +
    169                     ", idField=" + idField + ", releaseField=" + releaseField + "]";
     169                    ", idField=" + idField + ", releaseField=" + releaseField + ']';
    170170        }
    171171
    172172        /**
     
    204204                        }
    205205                        // If no description has been found, try to rebuild it with "id" + "release" (i.e. "name" + "version")
    206206                        if (result == null && id != null && release != null) {
    207                             result = id + " " + release;
     207                            result = id + ' ' + release;
    208208                        }
    209209                    } catch (IOException e) {
    210210                        // Ignore
  • org/openstreetmap/josm/tools/PlatformHookWindows.java

     
    128128     */
    129129    @Override
    130130    public String getOSDescription() {
    131         return Utils.strip(System.getProperty("os.name")) + " " +
     131        return Utils.strip(System.getProperty("os.name")) + ' ' +
    132132                ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit";
    133133    }
    134134}
  • org/openstreetmap/josm/tools/Shortcut.java

     
    225225        KeyStroke keyStroke = getKeyStroke();
    226226        if (keyStroke == null) return "";
    227227        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 ());
    230230    }
    231231
    232232    @Override
  • org/openstreetmap/josm/tools/TextTagParser.java

     
    247247        for (String key: tags.keySet()) {
    248248            value = tags.get(key);
    249249            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");
    251251                if (r==2 || r==3) return false; if (r==4) return true;
    252252            }
    253253            if (!key.matches(KEY_PATTERN)) {
  • org/openstreetmap/josm/tools/WikiReader.java

     
    8888        String b = "";
    8989        for (String line = in.readLine(); line != null; line = in.readLine()) {
    9090            if (!line.contains("[[TranslatedPages]]")) {
    91                 b += line.replaceAll(" />", ">") + "\n";
     91                b += line.replaceAll(" />", ">") + '\n';
    9292            }
    9393        }
    9494        return "<html>" + b + "</html>";
     
    123123                //
    124124                b += line.replaceAll("<img ", "<img border=\"0\" ")
    125125                         .replaceAll("<span class=\"icon\">.</span>", "")
    126                          .replaceAll("href=\"/", "href=\"" + baseurl + "/")
     126                         .replaceAll("href=\"/", "href=\"" + baseurl + '/')
    127127                         .replaceAll(" />", ">")
    128                          + "\n";
     128                         + '\n';
    129129            } else if (transl && line.contains("</div>")) {
    130130                transl = false;
    131131            }
  • 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();
     
    248248     */
    249249    public void remember(String preferenceKey) {
    250250        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(',')
    254254        .append("height=").append(extent.height);
    255255        Main.pref.put(preferenceKey, value.toString());
    256256    }
     
    390390    }
    391391
    392392    public String toString() {
    393         return "WindowGeometry{topLeft="+topLeft+",extent="+extent+"}";
     393        return "WindowGeometry{topLeft="+topLeft+",extent="+extent+ '}';
    394394    }
    395395}
  • org/openstreetmap/josm/tools/XmlObjectParser.java

     
    7575            if (msg == null) {
    7676                msg = getClass().getName();
    7777            }
    78             msg = msg + " " + tr("(at line {0}, column {1})", lineNumber, columnNumber);
     78            msg = msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber);
    7979            return msg;
    8080        }
    8181
     
    100100
    101101        @Override
    102102        public void startElement (String uri, String localName, String qName, Attributes atts) throws SAXException {
    103             if ("".equals(uri)) {
     103            if (uri != null && uri.isEmpty()) {
    104104                super.startElement(namespace, localName, qName, atts);
    105105            } else {
    106106                super.startElement(uri, localName, qName, atts);
  • org/openstreetmap/josm/tools/template_engine/Condition.java

     
    4646            if (entry instanceof SearchExpressionCondition) {
    4747                sb.append(entry.toString());
    4848            } else {
    49                 sb.append("'");
     49                sb.append('\'');
    5050                sb.append(entry.toString());
    51                 sb.append("'");
     51                sb.append('\'');
    5252            }
    53             sb.append("|");
     53            sb.append('|');
    5454        }
    5555        return sb.toString();
    5656    }
  • org/openstreetmap/josm/tools/template_engine/SearchExpressionCondition.java

     
    2525
    2626    @Override
    2727    public String toString() {
    28         return condition.toString() + " '" + text.toString() + "'";
     28        return condition.toString() + " '" + text.toString() + '\'';
    2929    }
    3030
    3131}
  • org/openstreetmap/josm/tools/template_engine/Tokenizer.java

     
    3535
    3636        @Override
    3737        public String toString() {
    38             return type + (text != null?" " + text:"");
     38            return type + (text != null? ' ' + text:"");
    3939        }
    4040    }
    4141
  • org/openstreetmap/josm/tools/template_engine/Variable.java

     
    3535                } else {
    3636                    first = false;
    3737                }
    38                 result.append(key).append("=").append(dataProvider.getTemplateValue(key, false));
     38                result.append(key).append('=').append(dataProvider.getTemplateValue(key, false));
    3939            }
    4040        } else {
    4141            Object value = dataProvider.getTemplateValue(variableName, special);
     
    5555
    5656    @Override
    5757    public String toString() {
    58         return "{" + variableName + "}";
     58        return '{' + variableName + '}';
    5959    }
    6060
    6161    public boolean isSpecial() {