Changeset 8846 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2015-10-10T01:40:42+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib - minor performance improvements:

  • Method passes constant String of length 1 to character overridden method
  • Method needlessly boxes a boolean constant
  • Method uses iterator().next() on a List to get the first item
  • Method converts String to boxed primitive using excessive boxing
  • Method converts String to primitive using excessive boxing
  • Method creates array using constants
  • Class defines List based fields but uses them like Sets
Location:
trunk/src/org/openstreetmap/josm
Files:
185 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r8763 r8846  
    136136            ImageryInfo ret = new ImageryInfo(info.getName(), url, "wms", info.getEulaAcceptanceRequired(), info.getCookies());
    137137            if (layersString.length() > 2) {
    138                 ret.setName(ret.getName() + " " + layersString.substring(0, layersString.length() - 2));
     138                ret.setName(ret.getName() + ' ' + layersString.substring(0, layersString.length() - 2));
    139139            }
    140140            ret.setServerProjections(supportedCrs);
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r8836 r8846  
    188188            }
    189189        }
    190         putValue("active", true);
     190        putValue("active", Boolean.TRUE);
    191191    }
    192192
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r8840 r8846  
    497497            if (predecessors.get(n) == null) return true;
    498498            if (predecessors.get(n).size() == 1) {
    499                 NodePair p1 = successors.get(n).iterator().next();
    500                 NodePair p2 = predecessors.get(n).iterator().next();
     499                NodePair p1 = successors.get(n).get(0);
     500                NodePair p2 = predecessors.get(n).get(0);
    501501                return p1.equals(p2.swap());
    502502            }
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoWebAction.java

    r8475 r8846  
    3030        if (infoObject instanceof OsmPrimitive) {
    3131            OsmPrimitive primitive = (OsmPrimitive) infoObject;
    32             return Main.getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId() + "/history";
     32            return Main.getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId() + "/history";
    3333        } else {
    3434            return null;
  • trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

    r8836 r8846  
    262262            try (Formatter us = new Formatter(Locale.US)) {
    263263                tOffset.setText(us.format(
    264                     "%1." + precision + "f; %1." + precision + "f",
     264                    "%1." + precision + "f; %1." + precision + 'f',
    265265                    layer.getDx(), layer.getDy()).toString());
    266266            }
  • trunk/src/org/openstreetmap/josm/actions/InfoWebAction.java

    r8510 r8846  
    3636        if (infoObject instanceof OsmPrimitive) {
    3737            OsmPrimitive primitive = (OsmPrimitive) infoObject;
    38             return Main.getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId();
     38            return Main.getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getId();
    3939        } else if (infoObject instanceof Note) {
    4040            Note note = (Note) infoObject;
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r8598 r8846  
    188188                if (s.wmsUrl.isEmpty()) {
    189189                    try {
    190                         addWMSLayer(s.name + " (" + text + ")", text);
     190                        addWMSLayer(s.name + " (" + text + ')', text);
    191191                        break outer;
    192192                    } catch (IllegalStateException ex) {
     
    200200                    String id = m.group(1);
    201201                    String newURL = s.wmsUrl.replaceAll("__s__", id);
    202                     String title = s.name + " (" + id + ")";
     202                    String title = s.name + " (" + id + ')';
    203203                    addWMSLayer(title, newURL);
    204204                    break outer;
     
    207207                if (s.idValidator.matcher(text).matches()) {
    208208                    String newURL = s.wmsUrl.replaceAll("__s__", text);
    209                     String title = s.name + " (" + text + ")";
     209                    String title = s.name + " (" + text + ')';
    210210                    addWMSLayer(title, newURL);
    211211                    break outer;
  • trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java

    r8510 r8846  
    305305            Main.main.undoRedo.add(
    306306                    new SequenceCommand(
    307                             title1 + " " + title2,
     307                            title1 + ' ' + title2,
    308308                            commands
    309309                    ));
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r8736 r8846  
    158158                // else it's a .class, add the classpath and mainClass
    159159                cmd.add("-cp");
    160                 cmd.add("\"" + System.getProperty("java.class.path") + "\"");
     160                cmd.add('"' + System.getProperty("java.class.path") + '"');
    161161                cmd.add(mainCommand[0]);
    162162            }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r8802 r8846  
    172172            String fn = file.getPath();
    173173            if (ff instanceof ExtensionFileFilter) {
    174                 fn += "." + ((ExtensionFileFilter) ff).getDefaultExtension();
     174                fn += '.' + ((ExtensionFileFilter) ff).getDefaultExtension();
    175175            } else if (extension != null) {
    176                 fn += "." + extension;
     176                fn += '.' + extension;
    177177            }
    178178            file = new File(fn);
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r8540 r8846  
    115115                    if (canceled) return;
    116116                    if (!layers.isEmpty()) {
    117                         Layer firstLayer = layers.iterator().next();
     117                        Layer firstLayer = layers.get(0);
    118118                        boolean noMap = Main.map == null;
    119119                        if (noMap) {
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r8513 r8846  
    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    }
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r8540 r8846  
    455455                                Way w = relationMembers.get(i_r - k).getWay();
    456456                                if ((w.lastNode() == way.firstNode()) || w.firstNode() == way.firstNode()) {
    457                                     backwards = false;
     457                                    backwards = Boolean.FALSE;
    458458                                } else if ((w.firstNode() == way.lastNode()) || w.lastNode() == way.lastNode()) {
    459                                     backwards = true;
     459                                    backwards = Boolean.TRUE;
    460460                                }
    461461                                break;
     
    464464                                Way w = relationMembers.get(i_r + k).getWay();
    465465                                if ((w.lastNode() == way.firstNode()) || w.firstNode() == way.firstNode()) {
    466                                     backwards = true;
     466                                    backwards = Boolean.TRUE;
    467467                                } else if ((w.firstNode() == way.lastNode()) || w.lastNode() == way.lastNode()) {
    468                                     backwards = false;
     468                                    backwards = Boolean.FALSE;
    469469                                }
    470470                                break;
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r8513 r8846  
    135135            errorTime = Notification.TIME_VERY_LONG;
    136136            errMsg =
    137                 tr("The current selection cannot be used for unglueing.")+"\n"+
    138                 "\n"+
    139                 tr("Select either:")+"\n"+
    140                 tr("* One tagged node, or")+"\n"+
    141                 tr("* One node that is used by more than one way, or")+"\n"+
    142                 tr("* One node that is used by more than one way and one of those ways, or")+"\n"+
    143                 tr("* One way that has one or more nodes that are used by more than one way, or")+"\n"+
    144                 tr("* One way and one or more of its nodes that are used by more than one way.")+"\n"+
    145                 "\n"+
     137                tr("The current selection cannot be used for unglueing.")+'\n'+
     138                '\n'+
     139                tr("Select either:")+'\n'+
     140                tr("* One tagged node, or")+'\n'+
     141                tr("* One node that is used by more than one way, or")+'\n'+
     142                tr("* One node that is used by more than one way and one of those ways, or")+'\n'+
     143                tr("* One way that has one or more nodes that are used by more than one way, or")+'\n'+
     144                tr("* One way and one or more of its nodes that are used by more than one way.")+'\n'+
     145                '\n'+
    146146                tr("Note: If a way is selected, this way will get fresh copies of the unglued\n"+
    147147                        "nodes and the new nodes will be selected. Otherwise, all ways will get their\n"+
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r8840 r8846  
    363363                // TODO: proper i18n after stabilization
    364364                Collection<String> items = new ArrayList<>();
    365                 items.add(tr("OSM Server URL:") + " " + url.getHost());
     365                items.add(tr("OSM Server URL:") + ' ' + url.getHost());
    366366                items.add(tr("Command")+": "+url.getPath());
    367367                if (url.getQuery() != null) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r8840 r8846  
    167167        @Override
    168168        public String toString() {
    169             return "ReferenceSegment[en=" + en + ", p1=" + p1 + ", p2=" + p2 + ", perp=" + perpendicular + "]";
     169            return "ReferenceSegment[en=" + en + ", p1=" + p1 + ", p2=" + p2 + ", perp=" + perpendicular + ']';
    170170        }
    171171    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r8840 r8846  
    960960            else if (mode == Mode.MOVE && (System.currentTimeMillis() - mouseDownTime >= initialMoveDelay)) {
    961961                final boolean canMerge = getCurrentDataSet() != null && !getCurrentDataSet().getSelectedNodes().isEmpty();
    962                 final String mergeHelp = canMerge ? " " + tr("Ctrl to merge with nearest node.") : "";
     962                final String mergeHelp = canMerge ? ' ' + tr("Ctrl to merge with nearest node.") : "";
    963963                return tr("Release the mouse button to stop moving.") + mergeHelp;
    964964            } else if (mode == Mode.ROTATE)
  • trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java

    r8674 r8846  
    3434        @Override
    3535        public String toString() {
    36             return "Range [start=" + start + ", end=" + end + "]";
     36            return "Range [start=" + start + ", end=" + end + ']';
    3737        }
    3838    }
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r8840 r8846  
    207207                        try {
    208208                            JTextComponent tf = (JTextComponent) hcb.getEditor().getEditorComponent();
    209                             tf.getDocument().insertString(tf.getCaretPosition(), " " + insertText, null);
     209                            tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null);
    210210                        } catch (BadLocationException ex) {
    211211                            throw new RuntimeException(ex.getMessage(), ex);
     
    628628            String all = allElements ? ", " +
    629629                            /*all elements*/ trc("search", "A") : "";
    630             return "\"" + text + "\" (" + cs + rx + css + all + ", " + mode + ")";
     630            return '"' + text + "\" (" + cs + rx + css + all + ", " + mode + ')';
    631631        }
    632632
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r8840 r8846  
    159159                    case "timestamp":
    160160                        // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""})
    161                         String rangeS = " " + tokenizer.readTextOrNumber() + " ";
     161                        String rangeS = ' ' + tokenizer.readTextOrNumber() + ' ';
    162162                        String[] rangeA = rangeS.split("/");
    163163                        if (rangeA.length == 1) {
     
    371371        @Override
    372372        public String toString() {
    373             return key + "?";
     373            return key + '?';
    374374        }
    375375    }
     
    607607        @Override
    608608        public String toString() {
    609             return key + "=" + value;
     609            return key + '=' + value;
    610610        }
    611611    }
     
    623623            Double v = null;
    624624            try {
    625                 v = Double.parseDouble(referenceValue);
     625                v = Double.valueOf(referenceValue);
    626626            } catch (NumberFormatException ignore) {
    627627            }
     
    10191019        @Override
    10201020        public String toString() {
    1021             return getString() + "=" + min + "-" + max;
     1021            return getString() + '=' + min + '-' + max;
    10221022        }
    10231023    }
     
    12441244        @Override
    12451245        public String toString() {
    1246             return "parent(" + match + ")";
     1246            return "parent(" + match + ')';
    12471247        }
    12481248    }
     
    12681268        @Override
    12691269        public String toString() {
    1270             return "child(" + match + ")";
     1270            return "child(" + match + ')';
    12711271        }
    12721272    }
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r8509 r8846  
    141141        String text;
    142142        if (objects.size() == 1 && tags.size() == 1) {
    143             OsmPrimitive primitive = objects.iterator().next();
     143            OsmPrimitive primitive = objects.get(0);
    144144            String msg = "";
    145145            Map.Entry<String, String> entry = tags.entrySet().iterator().next();
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java

    r8777 r8846  
    8585        if (objects.size() == 1) {
    8686            NameVisitor v = new NameVisitor();
    87             objects.iterator().next().accept(v);
    88             text += " "+tr(v.className)+" "+v.name;
     87            objects.get(0).accept(v);
     88            text += ' '+tr(v.className)+' '+v.name;
    8989        } else {
    90             text += " "+objects.size()+" "+trn("object", "objects", objects.size());
     90            text += ' '+objects.size()+' '+trn("object", "objects", objects.size());
    9191        }
    9292        return text;
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

    r8836 r8846  
    6969            this.a = a;
    7070            this.b = b;
    71             this.pattern = getPatternFor(a + "|" + b);
     71            this.pattern = getPatternFor(a + '|' + b);
    7272        }
    7373
  • trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java

    r8510 r8846  
    8484
    8585                final JLabel primitiveLabel = new JLabel(
    86                         primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ":",
     86                        primitive.getDisplayName(DefaultNameFormatter.getInstance()) + ':',
    8787                        ImageProvider.get(primitive.getDisplayType()),
    8888                        JLabel.LEFT
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r8512 r8846  
    156156        while (true) {
    157157            String filename = String.format("%1$s_%2$tY%2$tm%2$td_%2$tH%2$tM%2$tS%2$tL%3$s",
    158                     layer.layerFileName, now, index == 0 ? "" : "_" + index);
     158                    layer.layerFileName, now, index == 0 ? "" : '_' + index);
    159159            File result = new File(autosaveDir, filename+".osm");
    160160            try {
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r8510 r8846  
    262262    }
    263263
    264     @Override public String toString() {
    265         return "Bounds["+minLat+","+minLon+","+maxLat+","+maxLon+"]";
     264    @Override
     265    public String toString() {
     266        return "Bounds["+minLat+','+minLon+','+maxLat+','+maxLon+']';
    266267    }
    267268
    268269    public String toShortString(DecimalFormat format) {
    269         return
    270         format.format(minLat) + " "
     270        return format.format(minLat) + ' '
    271271        + format.format(minLon) + " / "
    272         + format.format(maxLat) + " "
     272        + format.format(maxLat) + ' '
    273273        + format.format(maxLon);
    274274    }
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r8840 r8846  
    466466
    467467                engine.eval("homeDir='"+normalizeDirName(Main.pref.getPreferencesDirectory().getAbsolutePath()) +"';");
    468                 engine.eval("josmVersion="+Version.getInstance().getVersion()+";");
     468                engine.eval("josmVersion="+Version.getInstance().getVersion()+';');
    469469                String className = CustomConfigurator.class.getName();
    470470                engine.eval("API.messageBox="+className+".messageBox");
     
    740740
    741741        private String normalizeDirName(String dir) {
    742             String s = dir.replace("\\", "/");
     742            String s = dir.replace('\\', '/');
    743743            if (s.endsWith("/")) s = s.substring(0, s.length()-1);
    744744            return s;
  • trunk/src/org/openstreetmap/josm/data/DataSource.java

    r7575 r8846  
    7171    @Override
    7272    public String toString() {
    73         return "DataSource [bounds=" + bounds + ", origin=" + origin + "]";
     73        return "DataSource [bounds=" + bounds + ", origin=" + origin + ']';
    7474    }
    7575
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r8840 r8846  
    9696 */
    9797public class Preferences {
     98
     99    private static final String[] OBSOLETE_PREF_KEYS = {
     100            "remote.control.host", // replaced by individual values for IPv4 and IPv6. To remove end of 2015
     101            "osm.notes.enableDownload", // was used prior to r8071 when notes was an hidden feature. To remove end of 2015
     102            "mappaint.style.migration.switchedToMapCSS", // was used prior to 8315 for MapCSS switch. To remove end of 2015
     103            "mappaint.style.migration.changedXmlName" // was used prior to 8315 for MapCSS switch. To remove end of 2015
     104    };
     105
    98106    /**
    99107     * Internal storage for the preference directory.
     
    789797    public synchronized boolean getBoolean(final String key, final String specName, final boolean def) {
    790798        boolean generic = getBoolean(key, def);
    791         String skey = key+"."+specName;
     799        String skey = key+'.'+specName;
    792800        Setting<?> prop = settingsMap.get(skey);
    793801        if (prop instanceof StringSetting)
     
    10771085
    10781086    public synchronized int getInteger(String key, String specName, int def) {
    1079         String v = get(key+"."+specName);
     1087        String v = get(key+'.'+specName);
    10801088        if (v.isEmpty())
    10811089            v = get(key, Integer.toString(def));
     
    13941402                if (fieldValue != null) {
    13951403                    if (f.getAnnotation(writeExplicitly.class) != null || !Objects.equals(fieldValue, defaultFieldValue)) {
    1396                         String key = f.getName().replace("_", "-");
     1404                        String key = f.getName().replace('_', '-');
    13971405                        if (fieldValue instanceof Map) {
    13981406                            hash.put(key, mapToJson((Map) fieldValue));
     
    14201428            Field f;
    14211429            try {
    1422                 f = klass.getDeclaredField(key_value.getKey().replace("-", "_"));
     1430                f = klass.getDeclaredField(key_value.getKey().replace('-', '_'));
    14231431            } catch (NoSuchFieldException ex) {
    14241432                continue;
     
    18371845        }
    18381846
    1839         String[] obsolete = {
    1840                 "remote.control.host", // replaced by individual values for IPv4 and IPv6. To remove end of 2015
    1841                 "osm.notes.enableDownload", // was used prior to r8071 when notes was an hidden feature. To remove end of 2015
    1842                 "mappaint.style.migration.switchedToMapCSS", // was used prior to 8315 for MapCSS switch. To remove end of 2015
    1843                 "mappaint.style.migration.changedXmlName" // was used prior to 8315 for MapCSS switch. To remove end of 2015
    1844         };
    1845         for (String key : obsolete) {
     1847        for (String key : OBSOLETE_PREF_KEYS) {
    18461848            if (settingsMap.containsKey(key)) {
    18471849                settingsMap.remove(key);
  • trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java

    r8384 r8846  
    6767    @Override
    6868    public String toString() {
    69         return "ProjectionBounds["+minEast+","+minNorth+","+maxEast+","+maxNorth+"]";
     69        return "ProjectionBounds["+minEast+","+minNorth+","+maxEast+","+maxNorth+']';
    7070    }
    7171
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r8558 r8846  
    238238            return formatText(area / areaCustomValue, areaCustomName, format);
    239239        else if (!lowerOnly && a >= (bValue*bValue) / (aValue*aValue))
    240             return formatText(area / (bValue * bValue), bName + "\u00b2", format);
     240            return formatText(area / (bValue * bValue), bName + '\u00b2', format);
    241241        else if (a < threshold)
    242             return "< " + formatText(threshold, aName + "\u00b2", format);
     242            return "< " + formatText(threshold, aName + '\u00b2', format);
    243243        else
    244             return formatText(a, aName + "\u00b2", format);
     244            return formatText(a, aName + '\u00b2', format);
    245245    }
    246246
    247247    private static String formatText(double v, String unit, NumberFormat format) {
    248248        if (format != null) {
    249             return format.format(v) + " " + unit;
     249            return format.format(v) + ' ' + unit;
    250250        }
    251251        return String.format(Locale.US, "%." + (v < 9.999999 ? 2 : 1) + "f %s", v, unit);
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r8510 r8846  
    226226        String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v);
    227227        if (buildName != null) {
    228             s += " " + buildName;
     228            s += ' ' + buildName;
    229229        }
    230230        if (isLocalBuild() && v != JOSM_UNKNOWN_VERSION) {
    231231            s += " SVN";
    232232        }
    233         String result = "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+")";
     233        String result = "JOSM/1.5 ("+ s+' '+LanguageInfo.getJOSMLocaleCode()+")";
    234234        if (includeOsDetails && Main.platform != null) {
    235             result += " " + Main.platform.getOSDescription();
     235            result += ' ' + Main.platform.getOSDescription();
    236236        }
    237237        return result;
  • trunk/src/org/openstreetmap/josm/data/conflict/Conflict.java

    r8510 r8846  
    127127    @Override
    128128    public String toString() {
    129         return "Conflict [my=" + my + ", their=" + their + "]";
     129        return "Conflict [my=" + my + ", their=" + their + ']';
    130130    }
    131131}
  • trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java

    r8357 r8846  
    6363    @Override
    6464    public String toString() {
    65         return "CachedLatLon[lat="+lat()+",lon="+lon()+"]";
     65        return "CachedLatLon[lat="+lat()+",lon="+lon()+']';
    6666    }
    6767}
  • trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java

    r8557 r8846  
    162162    }
    163163
    164     @Override public String toString() {
    165         return "EastNorth[e="+x+", n="+y+"]";
     164    @Override
     165    public String toString() {
     166        return "EastNorth[e="+x+", n="+y+']';
    166167    }
    167168
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r8540 r8846  
    151151        }
    152152
    153         return sDegrees + "\u00B0" + sMinutes + "\'" + sSeconds + "\"";
     153        return sDegrees + '\u00B0' + sMinutes + '\'' + sSeconds + '\"';
    154154    }
    155155
     
    173173        }
    174174
    175         return sDegrees + "\u00B0" + sMinutes + "\'";
     175        return sDegrees + '\u00B0' + sMinutes + '\'';
    176176    }
    177177
     
    325325        NumberFormat nf = NumberFormat.getInstance();
    326326        nf.setMaximumFractionDigits(5);
    327         return "lat=" + nf.format(lat()) + "\u00B0, lon=" + nf.format(lon()) + "\u00B0";
     327        return "lat=" + nf.format(lat()) + "\u00B0, lon=" + nf.format(lon()) + '\u00B0';
    328328    }
    329329
     
    370370    }
    371371
    372     @Override public String toString() {
    373         return "LatLon[lat="+lat()+",lon="+lon()+"]";
     372    @Override
     373    public String toString() {
     374        return "LatLon[lat="+lat()+",lon="+lon()+']';
    374375    }
    375376
  • trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java

    r8510 r8846  
    9595    @Override
    9696    public String toString() {
    97         return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " : "") + getCoor() + ", " + attr + ")";
     97        return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " : "") + getCoor() + ", " + attr + ')';
    9898    }
    9999
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r8840 r8846  
    300300                s += " id=" + id;
    301301            }
    302             s += "]";
     302            s += ']';
    303303            return s;
    304304        }
     
    861861    public String getExtendedUrl() {
    862862        return imageryType.getTypeString() + (defaultMaxZoom != 0
    863             ? "["+(defaultMinZoom != 0 ? defaultMinZoom+"," : "")+defaultMaxZoom+"]" : "") + ":" + url;
     863            ? "["+(defaultMinZoom != 0 ? defaultMinZoom+',' : "")+defaultMaxZoom+"]" : "") + ':' + url;
    864864    }
    865865
     
    875875        String res = name;
    876876        if (pixelPerDegree != 0) {
    877             res += " ("+pixelPerDegree+")";
     877            res += " ("+pixelPerDegree+')';
    878878        }
    879879        return res;
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r8510 r8846  
    4949        this.layerName = array.get(1);
    5050        this.name = array.get(2);
    51         this.dx = Double.valueOf(array.get(3));
    52         this.dy = Double.valueOf(array.get(4));
     51        this.dx = Double.parseDouble(array.get(3));
     52        this.dy = Double.parseDouble(array.get(4));
    5353        if (array.size() >= 7) {
    54             this.centerX = Double.valueOf(array.get(5));
    55             this.centerY = Double.valueOf(array.get(6));
     54            this.centerX = Double.parseDouble(array.get(5));
     55            this.centerY = Double.parseDouble(array.get(6));
    5656        }
    5757        if (projectionCode == null) {
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoader.java

    r8737 r8846  
    105105    @Override
    106106    public void clearCache(TileSource source) {
    107         this.cache.remove(source.getName() + ":");
     107        this.cache.remove(source.getName() + ':');
    108108    }
    109109
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r8815 r8846  
    9191                tsName = "";
    9292            }
    93             return tsName.replace(":", "_") + ":" + tileSource.getTileId(tile.getZoom(), tile.getXtile(), tile.getYtile());
     93            return tsName.replace(':', '_') + ':' + tileSource.getTileId(tile.getZoom(), tile.getXtile(), tile.getYtile());
    9494        }
    9595        return null;
  • trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java

    r8772 r8846  
    211211                break;
    212212            default:
    213                 replacement = "{" + matcher.group(1) + "}";
     213                replacement = '{' + matcher.group(1) + '}';
    214214            }
    215215            matcher.appendReplacement(url, replacement);
  • trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java

    r7828 r8846  
    3737        errorCount++;
    3838        if (errorCount <= MAX_ERRORS) {
    39             writer.println("[" + type + "] " + String.format(message, args));
     39            writer.println('[' + type + "] " + String.format(message, args));
    4040        }
    4141    }
     
    187187        if (Main.isDebugEnabled()) {
    188188            StackTraceElement item = Thread.currentThread().getStackTrace()[2];
    189             String operation = getClass().getSimpleName() + "." + item.getMethodName();
     189            String operation = getClass().getSimpleName() + '.' + item.getMethodName();
    190190            long elapsedTime = System.currentTimeMillis() - startTime;
    191191            Main.debug(tr("Test ''{0}'' completed in {1}",
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r8540 r8846  
    275275    public String toString() {
    276276        String coorDesc = isLatLonKnown() ? "lat="+lat+",lon="+lon : "";
    277         return "{Node id=" + getUniqueId() + " version=" + getVersion() + " " + getFlagsAsString() + " "  + coorDesc+"}";
     277        return "{Node id=" + getUniqueId() + " version=" + getVersion() + ' ' + getFlagsAsString() + ' '  + coorDesc+'}';
    278278    }
    279279
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r8510 r8846  
    7373                : null;
    7474        if (p == null) {
    75             throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + "'");
     75            throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + '\'');
    7676        }
    7777        for (final Map.Entry<String, String> i : TextTagParser.readTagsFromText(x[1]).entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r8836 r8846  
    8080        @Override
    8181        public String toString() {
    82             return super.toString() + "[" + level + "]: " + bbox();
     82            return super.toString() + '[' + level + "]: " + bbox();
    8383        }
    8484
     
    361361
    362362            if (!canRemove()) {
    363                 abort("attempt to remove non-empty child: " + this.content + " " + Arrays.toString(this.getChildren()));
     363                abort("attempt to remove non-empty child: " + this.content + ' ' + Arrays.toString(this.getChildren()));
    364364            }
    365365
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java

    r8510 r8846  
    3636    @Override
    3737    public String toString() {
    38         return (memberType != null ? memberType.getAPIName() : "undefined") + " " + memberId;
     38        return (memberType != null ? memberType.getAPIName() : "undefined") + ' ' + memberId;
    3939    }
    4040
  • trunk/src/org/openstreetmap/josm/data/osm/Tag.java

    r8419 r8846  
    112112            return new Tag(x[0], x[1]);
    113113        } else {
    114             throw new IllegalArgumentException("'" + s + "' does not contain '='");
     114            throw new IllegalArgumentException('\'' + s + "' does not contain '='");
    115115        }
    116116    }
     
    118118    @Override
    119119    public String toString() {
    120         return key + "=" + value;
     120        return key + '=' + value;
    121121    }
    122122
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r8512 r8846  
    331331    public String toString() {
    332332        String nodesDesc = isIncomplete() ? "(incomplete)" : "nodes=" + Arrays.toString(nodes);
    333         return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString()  + " " + nodesDesc + "}";
     333        return "{Way id=" + getUniqueId() + " version=" + getVersion()+ ' ' + getFlagsAsString() + ' ' + nodesDesc + '}';
    334334    }
    335335
  • trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java

    r8510 r8846  
    9494    @Override
    9595    public String toString() {
    96         return "WaySegment [way=" + way.getUniqueId() + ", lowerIndex=" + lowerIndex + "]";
     96        return "WaySegment [way=" + way.getUniqueId() + ", lowerIndex=" + lowerIndex + ']';
    9797    }
    9898}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r8540 r8846  
    238238        if (get(key) != null)
    239239            return get(key);
    240         key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
     240        key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry();
    241241        if (get(key) != null)
    242242            return get(key);
     
    278278                + (user != null ? "user=" + user + ", " : "") + "changesetId="
    279279                + changesetId
    280                 + "]";
     280                + ']';
    281281    }
    282282}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r8840 r8846  
    181181    @Override
    182182    public String toString() {
    183         return "BoundingXYVisitor["+bounds+"]";
     183        return "BoundingXYVisitor["+bounds+']';
    184184    }
    185185
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r8840 r8846  
    17291729                System.err.println("; phase 2 (draw): " + Utils.getDurationString(timeFinished - timePhase1) +
    17301730                    "; total: " + Utils.getDurationString(timeFinished - timeStart) +
    1731                     " (scale: " + circum + " zoom level: " + Selector.GeneralSelector.scale2level(circum) + ")");
     1731                    " (scale: " + circum + " zoom level: " + Selector.GeneralSelector.scale2level(circum) + ')');
    17321732            }
    17331733
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r8836 r8846  
    199199                    throw new ProjectionConfigurationException(tr("UTM projection (''+proj=utm'') requires ''+zone=...'' parameter."));
    200200                try {
    201                     zone = Integer.parseInt(zoneStr);
     201                    zone = Integer.valueOf(zoneStr);
    202202                } catch (NumberFormatException e) {
    203203                    zone = null;
  • trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java

    r8795 r8846  
    181181    @Override
    182182    public String toString() {
    183         return "Ellipsoid{a="+a+", b="+b+"}";
     183        return "Ellipsoid{a="+a+", b="+b+'}';
    184184    }
    185185
  • trunk/src/org/openstreetmap/josm/data/projection/datum/CentricDatum.java

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

    r8840 r8846  
    232232                type = "n";
    233233            }
    234             strings.add(type + "_" + o.getId());
     234            strings.add(type + '_' + o.getId());
    235235        }
    236236        for (String o : strings) {
     
    243243        String ignorestring = getIgnoreGroup();
    244244        if (descriptionEn != null) {
    245             ignorestring += "_" + descriptionEn;
     245            ignorestring += '_' + descriptionEn;
    246246        }
    247247        return ignorestring;
     
    381381    @Override
    382382    public String toString() {
    383         return "TestError [tester=" + tester + ", code=" + code + ", message=" + message + "]";
     383        return "TestError [tester=" + tester + ", code=" + code + ", message=" + message + ']';
    384384    }
    385385}
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r8777 r8846  
    9999    protected static final int DUPLICATE_NODE_WATERWAY = 17;
    100100
     101    private static final String[] TYPES = {
     102            "none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"};
     103
    101104    /** The map of potential duplicates.
    102105     *
     
    168171
    169172        Map<String, Boolean> typeMap = new HashMap<>();
    170         String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"};
    171173
    172174        // check whether we have multiple nodes at the same position with the same tag set
     
    175177            if (mm.get(tagSet).size() > 1) {
    176178
    177                 for (String type: types) {
    178                     typeMap.put(type, false);
     179                for (String type: TYPES) {
     180                    typeMap.put(type, Boolean.FALSE);
    179181                }
    180182
     
    190192                                for (String type: typeMap.keySet()) {
    191193                                    if (keys.containsKey(type)) {
    192                                         typeMap.put(type, true);
     194                                        typeMap.put(type, Boolean.TRUE);
    193195                                        typed = true;
    194196                                    }
    195197                                }
    196198                                if (!typed) {
    197                                     typeMap.put("none", true);
     199                                    typeMap.put("none", Boolean.TRUE);
    198200                                }
    199201                            }
    200202                        }
    201 
    202203                    }
    203204                }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java

    r8510 r8846  
    102102                    String ending = "";
    103103                    if (domain.contains("/")) {
    104                         int idx = domain.indexOf("/");
     104                        int idx = domain.indexOf('/');
    105105                        ending = domain.substring(idx, domain.length());
    106106                        domain = domain.substring(0, idx);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java

    r8382 r8846  
    4545    protected void checkNumberOfLanesByKey(final OsmPrimitive p, String lanesKey, String message) {
    4646        final Collection<String> keysForPattern = new ArrayList<>(Utils.filter(p.keySet(),
    47                 Predicates.stringContainsPattern(Pattern.compile(":" + lanesKey + "$"))));
     47                Predicates.stringContainsPattern(Pattern.compile(':' + lanesKey + '$'))));
    4848        keysForPattern.removeAll(Arrays.asList(BLACKLIST));
    4949        if (keysForPattern.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r8840 r8846  
    126126        @Override
    127127        public String toString() {
    128             return "GroupedMapCSSRule [selectors=" + selectors + ", declaration=" + declaration + "]";
     128            return "GroupedMapCSSRule [selectors=" + selectors + ", declaration=" + declaration + ']';
    129129        }
    130130    }
     
    301301                        check.alternatives.add(val);
    302302                    } else if ("assertMatch".equals(ai.key) && val != null) {
    303                         check.assertions.put(val, true);
     303                        check.assertions.put(val, Boolean.TRUE);
    304304                    } else if ("assertNoMatch".equals(ai.key) && val != null) {
    305                         check.assertions.put(val, false);
     305                        check.assertions.put(val, Boolean.FALSE);
    306306                    } else {
    307                         throw new IllegalDataException("Cannot add instruction " + ai.key + ": " + ai.val + "!");
     307                        throw new IllegalDataException("Cannot add instruction " + ai.key + ": " + ai.val + '!');
    308308                    }
    309309                }
     
    619619        @Override
    620620        public String toString() {
    621             return "MapCSSTagCheckerAndRule [rule=" + rule + "]";
     621            return "MapCSSTagCheckerAndRule [rule=" + rule + ']';
    622622        }
    623623    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r8510 r8846  
    240240        @Override
    241241        public String toString() {
    242             return "replaceAll(" + regExpr + ", " + replacement + ")";
     242            return "replaceAll(" + regExpr + ", " + replacement + ')';
    243243        }
    244244    }
     
    304304        @Override
    305305        public String toString() {
    306             return "synonyms(" + replacement + ", " + Arrays.toString(words) + ")";
     306            return "synonyms(" + replacement + ", " + Arrays.toString(words) + ')';
    307307        }
    308308    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r8840 r8846  
    241241                }
    242242            } catch (IOException e) {
    243                 errorSources += source + "\n";
     243                errorSources += source + '\n';
    244244            }
    245245        }
  • trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java

    r8378 r8846  
    6363            displayName = name;
    6464        } else {
    65             displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size);
     65            displayName = size + ' ' + trn(multipleClassname, multiplePluralClassname, size);
    6666            if (multipleName.length() > 0) {
    6767                if (multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH) {
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r8840 r8846  
    358358                relationName = Long.toString(relation.getId());
    359359            } else {
    360                 relationName = "\"" + relationName + "\"";
     360                relationName = '\"' + relationName + '\"';
    361361            }
    362362            result.append(" (").append(relationName).append(", ");
     
    443443        String admin_level = relation.get("admin_level");
    444444        if (admin_level != null) {
    445             name += "["+admin_level+"]";
     445            name += '['+admin_level+']';
    446446        }
    447447
     
    623623        /* note: length == 0 should no longer happen, but leave the bracket code
    624624           nevertheless, who knows what future brings */
    625         sb.append((sb.length() > 0) ? " ("+nodes+")" : nodes);
     625        sb.append((sb.length() > 0) ? " ("+nodes+')' : nodes);
    626626        decorateNameWithId(sb, way);
    627627        return sb.toString();
     
    664664            sb.append(Long.toString(relation.getId())).append(", ");
    665665        } else {
    666             sb.append("\"").append(nameTag).append("\", ");
     666            sb.append('\"').append(nameTag).append("\", ");
    667667        }
    668668
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r8840 r8846  
    177177            URL u = getClass().getResource(im);
    178178            if (u != null) {
    179                 m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u + "\""));
     179                m.appendReplacement(sb, Matcher.quoteReplacement("src=\"" + u + '\"'));
    180180            }
    181181        }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r8836 r8846  
    126126                "\tjava -jar josm.jar <options>...\n\n"+
    127127                tr("options")+":\n"+
    128                 "\t--help|-h                                 "+tr("Show this help")+"\n"+
    129                 "\t--geometry=widthxheight(+|-)x(+|-)y       "+tr("Standard unix geometry argument")+"\n"+
    130                 "\t[--download=]minlat,minlon,maxlat,maxlon  "+tr("Download the bounding box")+"\n"+
    131                 "\t[--download=]<URL>                        "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z)")+"\n"+
    132                 "\t[--download=]<filename>                   "+tr("Open a file (any file type that can be opened with File/Open)")+"\n"+
    133                 "\t--downloadgps=minlat,minlon,maxlat,maxlon "+tr("Download the bounding box as raw GPS")+"\n"+
    134                 "\t--downloadgps=<URL>                       "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS")+"\n"+
    135                 "\t--selection=<searchstring>                "+tr("Select with the given search")+"\n"+
    136                 "\t--[no-]maximize                           "+tr("Launch in maximized mode")+"\n"+
     128                "\t--help|-h                                 "+tr("Show this help")+'\n'+
     129                "\t--geometry=widthxheight(+|-)x(+|-)y       "+tr("Standard unix geometry argument")+'\n'+
     130                "\t[--download=]minlat,minlon,maxlat,maxlon  "+tr("Download the bounding box")+'\n'+
     131                "\t[--download=]<URL>                        "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z)")+'\n'+
     132                "\t[--download=]<filename>                   "+tr("Open a file (any file type that can be opened with File/Open)")+'\n'+
     133                "\t--downloadgps=minlat,minlon,maxlat,maxlon "+tr("Download the bounding box as raw GPS")+'\n'+
     134                "\t--downloadgps=<URL>                       "+tr("Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS")+'\n'+
     135                "\t--selection=<searchstring>                "+tr("Select with the given search")+'\n'+
     136                "\t--[no-]maximize                           "+tr("Launch in maximized mode")+'\n'+
    137137                "\t--reset-preferences                       "+tr("Reset the preferences to default")+"\n\n"+
    138138                "\t--load-preferences=<url-to-xml>           "+tr("Changes preferences according to the XML file")+"\n\n"+
     
    155155                        tr("examples")+":\n"+
    156156                        "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+
    157                         "\tjava -jar josm.jar "+OsmUrlToBounds.getURL(43.2, 11.1, 13)+"\n"+
     157                        "\tjava -jar josm.jar "+OsmUrlToBounds.getURL(43.2, 11.1, 13)+'\n'+
    158158                        "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+
    159159                        "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+
     
    161161                        "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+
    162162                        "\tjava -Xmx1024m -jar josm.jar\n\n"+
    163                         tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+"\n"+
    164                         tr("Make sure you load some data if you use --selection.")+"\n"
     163                        tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+'\n'+
     164                        tr("Make sure you load some data if you use --selection.")+'\n'
    165165                );
    166166    }
     
    212212
    213213        Option(boolean requiresArgument) {
    214             this.name = name().toLowerCase(Locale.ENGLISH).replace("_", "-");
     214            this.name = name().toLowerCase(Locale.ENGLISH).replace('_', '-');
    215215            this.requiresArg = requiresArgument;
    216216        }
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r8840 r8846  
    14381438     */
    14391439    public int getViewID() {
    1440         String x = center.east() + "_" + center.north() + "_" + scale + "_" +
    1441                 getWidth() + "_" + getHeight() + "_" + getProjection().toString();
     1440        String x = center.east() + '_' + center.north() + '_' + scale + '_' +
     1441                getWidth() + '_' + getHeight() + '_' + getProjection().toString();
    14421442        CRC32 id = new CRC32();
    14431443        id.update(x.getBytes(StandardCharsets.UTF_8));
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java

    r8840 r8846  
    4949    private static final int MAC_MOUSE_BUTTON3_MASK = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
    5050
     51    private static final String[] N = {
     52            ",", ".", "up", "right", "down", "left"};
     53    private static final int[] K = {
     54            KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT};
     55
    5156    // start and end point of selection rectangle
    5257    private Point iStartSelectionPoint;
     
    6570        iSlippyMapChooser.addMouseMotionListener(this);
    6671
    67         String[] n = {",", ".", "up", "right", "down", "left"};
    68         int[] k = {KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT};
    69 
    7072        if (contentPane != null) {
    71             for (int i = 0; i < n.length; ++i) {
     73            for (int i = 0; i < N.length; ++i) {
    7274                contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    73                         KeyStroke.getKeyStroke(k[i], KeyEvent.CTRL_DOWN_MASK), "MapMover.Zoomer." + n[i]);
     75                        KeyStroke.getKeyStroke(K[i], KeyEvent.CTRL_DOWN_MASK), "MapMover.Zoomer." + N[i]);
    7476            }
    7577        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r8836 r8846  
    216216                            conflicts.getRelationConflicts().size(),
    217217                            conflicts.getWayConflicts().size(),
    218                             conflicts.getNodeConflicts().size())+")");
     218                            conflicts.getNodeConflicts().size())+')');
    219219        } else {
    220220            setTitle(tr("Conflict"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

    r8612 r8846  
    131131    class DataText {
    132132        private static final String INDENT = "  ";
    133         private static final String NL = "\n";
     133        private static final char NL = '\n';
    134134
    135135        private StringBuilder s = new StringBuilder();
     
    364364                StyleList sl = elemstyles.get(osm, scale, nc);
    365365                for (ElemStyle s : sl) {
    366                     txtMappaint.append(" * ").append(s).append("\n");
     366                    txtMappaint.append(" * ").append(s).append('\n');
    367367                }
    368368                txtMappaint.append("\n\n");
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r8678 r8846  
    200200        }
    201201        this.latLonCoordinates = ll;
    202         tfLatLon.setText(ll.latToString(CoordinateFormat.getDefaultFormat()) + " " + ll.lonToString(CoordinateFormat.getDefaultFormat()));
     202        tfLatLon.setText(ll.latToString(CoordinateFormat.getDefaultFormat()) + ' ' + ll.lonToString(CoordinateFormat.getDefaultFormat()));
    203203        EastNorth en = Main.getProjection().latlon2eastNorth(ll);
    204204        tfEastNorth.setText(en.east()+" "+en.north());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r8836 r8846  
    655655                    String line;
    656656                    while ((line = reader.readLine()) != null) {
    657                         txtSource.append(line + "\n");
     657                        txtSource.append(line + '\n');
    658658                    }
    659659                } finally {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r8836 r8846  
    352352    }
    353353
    354 
    355354    /**
    356355     * Hides the dialog
     
    361360        windowMenuItem.setState(false);
    362361        setIsShowing(false);
    363         toggleAction.putValue("selected", false);
     362        toggleAction.putValue("selected", Boolean.FALSE);
    364363    }
    365364
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r8836 r8846  
    226226            if (infoObject instanceof User) {
    227227                User user = (User) infoObject;
    228                 return Main.getBaseUserUrl() + "/" + Utils.encodeUrl(user.getName()).replaceAll("\\+", "%20");
     228                return Main.getBaseUserUrl() + '/' + Utils.encodeUrl(user.getName()).replaceAll("\\+", "%20");
    229229            } else {
    230230                return null;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r8840 r8846  
    11681168                if (values.size() == 1) {
    11691169                    url = TAGINFO_URL_PROP.get() + "tags/" + key /* do not URL encode key, otherwise addr:street does not work */
    1170                             + "=" + Utils.encodeUrl(values.keySet().iterator().next());
     1170                            + '=' + Utils.encodeUrl(values.keySet().iterator().next());
    11711171                } else {
    11721172                    url = TAGINFO_URL_PROP.get() + "keys/" + key; /* do not URL encode key, otherwise addr:street does not work */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r8840 r8846  
    232232                new String[]{tr("Replace"), tr("Cancel")});
    233233        ed.setButtonIcons(new String[]{"purge", "cancel"});
    234         ed.setContent(action+"\n"+ tr("The new key is already used, overwrite values?"));
     234        ed.setContent(action+'\n'+ tr("The new key is already used, overwrite values?"));
    235235        ed.setCancelButton(2);
    236236        ed.toggleEnable(togglePref);
     
    651651                lines.add(code(sc.getKeyText()) + tr("to apply first suggestion"));
    652652            }
    653             lines.add(code(KeyEvent.getKeyModifiersText(KeyEvent.SHIFT_MASK)+"+"+KeyEvent.getKeyText(KeyEvent.VK_ENTER))
     653            lines.add(code(KeyEvent.getKeyModifiersText(KeyEvent.SHIFT_MASK)+'+'+KeyEvent.getKeyText(KeyEvent.VK_ENTER))
    654654                    +tr("to add without closing the dialog"));
    655655            sc = Shortcut.findShortcut(KeyEvent.VK_1, commandDownMask | KeyEvent.SHIFT_DOWN_MASK);
     
    750750                        + "<table><tr>"
    751751                        + "<td>" + count + ".</td>"
    752                         + "<td style='border:1px solid gray'>" + XmlWriter.encode(t.toString(), true) + "<" +
     752                        + "<td style='border:1px solid gray'>" + XmlWriter.encode(t.toString(), true) + '<' +
    753753                        "/td></tr></table></html>");
    754754                tagLabel.setFont(tagLabel.getFont().deriveFont(Font.PLAIN));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java

    r8836 r8846  
    9090        @Override
    9191        public String toString() {
    92             return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + "]";
     92            return "[Context: layer=" + layer.getName() + ",relation=" + relation.getId() + ']';
    9393        }
    9494    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionType.java

    r8840 r8846  
    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
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r8836 r8846  
    601601            if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
    602602                return;
    603             if (e.getURL() == null || e.getURL().toString().startsWith(url+"#")) {
     603            if (e.getURL() == null || e.getURL().toString().startsWith(url+'#')) {
    604604                // Probably hyperlink event on a an A-element with a href consisting of a fragment only, i.e. "#ALocalFragment".
    605605                String fragment = getUrlFragment(e);
  • trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java

    r8639 r8846  
    127127        if (ret == null)
    128128            return ret;
    129         ret = "/" + ret + Main.pref.get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading /
     129        ret = '/' + ret + Main.pref.get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading /
    130130        return ret.replaceAll("\\/+", "\\/"); // collapse sequences of //
    131131    }
     
    146146        if (prefix == null || topic == null || topic.trim().isEmpty() || "/".equals(topic.trim()))
    147147            return prefix;
    148         prefix += "/" + topic;
     148        prefix += '/' + topic;
    149149        return prefix.replaceAll("\\/+", "\\/"); // collapse sequences of //
    150150    }
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r8836 r8846  
    185185
    186186    protected static String getUserUrl(String username) {
    187         return Main.getBaseUserUrl() + "/" +  Utils.encodeUrl(username).replaceAll("\\+", "%20");
     187        return Main.getBaseUserUrl() + '/' +  Utils.encodeUrl(username).replaceAll("\\+", "%20");
    188188    }
    189189
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java

    r8836 r8846  
    203203            if (infoObject instanceof HistoryOsmPrimitive) {
    204204                HistoryOsmPrimitive hp = (HistoryOsmPrimitive) infoObject;
    205                 return hp.getUser() == null ? null : Main.getBaseUserUrl() + "/" + hp.getUser().getName();
     205                return hp.getUser() == null ? null : Main.getBaseUserUrl() + '/' + hp.getUser().getName();
    206206            } else {
    207207                return null;
  • trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java

    r8836 r8846  
    314314            lblHeading.setText(
    315315                    "<html>" + tr("Authenticating at the HTTP proxy ''{0}'' failed. Please enter a valid username and a valid password.",
    316                             Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST) + ":" +
     316                            Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST) + ':' +
    317317                            Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_PORT)) + "</html>");
    318318            lblWarning.setText("<html>" +
  • trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

    r8836 r8846  
    3333    private static final Color colorError = new Color(255, 197, 197);
    3434    private static final String separator = System.getProperty("file.separator");
    35     private static final String ellipsis = "…" + separator;
     35    private static final String ellipsis = '…' + separator;
    3636
    3737    private final JLabel lblLayerName = new JLabel();
  • trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

    r8760 r8846  
    9696            tags.put("created_by", agent);
    9797        } else if (!created_by.contains(agent)) {
    98             tags.put("created_by", created_by + ";" + agent);
     98            tags.put("created_by", created_by + ';' + agent);
    9999        }
    100100        pnlTagEditor.getModel().initFromTags(tags);
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r8840 r8846  
    319319        private String getSizeString(int size) {
    320320            StringBuilder ret = new StringBuilder();
    321             return ret.append(size).append("x").append(size).toString();
     321            return ret.append(size).append('x').append(size).toString();
    322322        }
    323323
     
    350350                        {"Tile url", url},
    351351                        {"Tile size", getSizeString(clickedTile.getTileSource().getTileSize()) },
    352                         {"Tile display size", new StringBuilder().append(displaySize.width).append("x").append(displaySize.height).toString()},
     352                        {"Tile display size", new StringBuilder().append(displaySize.width).append('x').append(displaySize.height).toString()},
    353353                };
    354354
    355355                for (String[] entry: content) {
    356                     panel.add(new JLabel(tr(entry[0]) + ":"), GBC.std());
     356                    panel.add(new JLabel(tr(entry[0]) + ':'), GBC.std());
    357357                    panel.add(GBC.glue(5, 0), GBC.std());
    358358                    panel.add(createTextField(entry[1]), GBC.eol().fill(GBC.HORIZONTAL));
     
    360360
    361361                for (Entry<String, String> e: clickedTile.getMetadata().entrySet()) {
    362                     panel.add(new JLabel(tr("Metadata ") + tr(e.getKey()) + ":"), GBC.std());
     362                    panel.add(new JLabel(tr("Metadata ") + tr(e.getKey()) + ':'), GBC.std());
    363363                    panel.add(GBC.glue(5, 0), GBC.std());
    364364                    String value = e.getValue();
     
    764764        boolean zia = currentZoomLevel < this.getMaxZoomLvl();
    765765        if (Main.isDebugEnabled()) {
    766             Main.debug("zoomIncreaseAllowed(): " + zia + " " + currentZoomLevel + " vs. " + this.getMaxZoomLvl());
     766            Main.debug("zoomIncreaseAllowed(): " + zia + ' ' + currentZoomLevel + " vs. " + this.getMaxZoomLvl());
    767767        }
    768768        return zia;
     
    10541054            for (String s: text.split(" ")) {
    10551055                if (g.getFontMetrics().stringWidth(line.toString() + s) > tileSource.getTileSize()) {
    1056                     ret.append(line).append("\n");
     1056                    ret.append(line).append('\n');
    10571057                    line.setLength(0);
    10581058                }
    1059                 line.append(s).append(" ");
     1059                line.append(s).append(' ');
    10601060            }
    10611061            ret.append(line);
     
    15281528    private Tile getTileForPixelpos(int px, int py) {
    15291529        if (Main.isDebugEnabled()) {
    1530             Main.debug("getTileForPixelpos("+px+", "+py+")");
     1530            Main.debug("getTileForPixelpos("+px+", "+py+')');
    15311531        }
    15321532        MapView mv = Main.map.mapView;
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r8818 r8846  
    100100            if (earliestDate.equals(latestDate)) {
    101101                DateFormat tf = DateUtils.getTimeFormat(DateFormat.SHORT);
    102                 ts += earliestDate + " ";
     102                ts += earliestDate + ' ';
    103103                ts += tf.format(bounds[0]) + " - " + tf.format(bounds[1]);
    104104            } else {
  • trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java

    r8840 r8846  
    152152            }
    153153            if (dx != 0 || dy != 0) {
    154                 panel.add(new JLabel(tr("Offset: ") + dx + ";" + dy), GBC.eol().insets(0, 5, 10, 0));
     154                panel.add(new JLabel(tr("Offset: ") + dx + ';' + dy), GBC.eol().insets(0, 5, 10, 0));
    155155            }
    156156        }
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r8509 r8846  
    180180    @Override
    181181    public String getToolTipText() {
    182         return noteData.getNotes().size() + " " + tr("Notes");
     182        return noteData.getNotes().size() + ' ' + tr("Notes");
    183183    }
    184184
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r8840 r8846  
    489489        String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes);
    490490        if (counter.deletedNodes > 0) {
    491             nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+")";
     491            nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+')';
    492492        }
    493493
    494494        String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways);
    495495        if (counter.deletedWays > 0) {
    496             wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+")";
     496            wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+')';
    497497        }
    498498
    499499        String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations);
    500500        if (counter.deletedRelations > 0) {
    501             relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+")";
     501            relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+')';
    502502        }
    503503
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r8840 r8846  
    300300                    JOptionPane.showMessageDialog(
    301301                            Main.parent,
    302                             tr("Could not read \"{0}\"", sel.getName())+"\n"+x.getMessage(),
     302                            tr("Could not read \"{0}\"", sel.getName())+'\n'+x.getMessage(),
    303303                            tr("Error"),
    304304                            JOptionPane.ERROR_MESSAGE
     
    394394            gc.gridx = 2;
    395395            gc.weightx = 0.2;
    396             panelTf.add(new JLabel(" ["+dateFormat.toLocalizedPattern()+"]"), gc);
     396            panelTf.add(new JLabel(" ["+dateFormat.toLocalizedPattern()+']'), gc);
    397397
    398398            gc.gridx = 0;
     
    511511                    if (date != null) {
    512512                        lbExifTime.setText(DateUtils.getDateTimeFormat(DateFormat.SHORT, DateFormat.MEDIUM).format(date));
    513                         tfGpsTime.setText(DateUtils.getDateFormat(DateFormat.SHORT).format(date)+" ");
     513                        tfGpsTime.setText(DateUtils.getDateFormat(DateFormat.SHORT).format(date)+' ');
    514514                        tfGpsTime.setEnabled(true);
    515515                    } else {
     
    928928                            : (int) Math.floor(tz/2) + ":30";
    929929                    if (sldTimezone.getValue() < 0) {
    930                         zone = "-" + zone;
     930                        zone = '-' + zone;
    931931                    }
    932932
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r8840 r8846  
    376376        return "<html>"
    377377                + trn("{0} image loaded.", "{0} images loaded.", n, n)
    378                 + " " + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", tagged, tagged)
     378                + ' ' + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", tagged, tagged)
    379379                + (newdata > 0 ? "<br>" + trn("{0} has updated GPS data.", "{0} have updated GPS data.", newdata, newdata) : "")
    380380                + "</html>";
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r8840 r8846  
    106106            }
    107107            if (names != null) {
    108                 names += ")";
     108                names += ')';
    109109            } else {
    110110                names = "";
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r8840 r8846  
    112112            String key = "draw.rawgps.layer.wpt.pattern";
    113113            if (layerName != null) {
    114                 key += "." + layerName;
     114                key += '.' + layerName;
    115115            }
    116116            TemplateEntryProperty result = CACHE.get(key);
     
    127127            String key = "draw.rawgps.layer.audiowpt.pattern";
    128128            if (layerName != null) {
    129                 key += "." + layerName;
     129                key += '.' + layerName;
    130130            }
    131131            TemplateEntryProperty result = CACHE.get(key);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r8840 r8846  
    219219    }
    220220
    221     @Override public String getToolTipText() {
    222         return data.size()+" "+trn("marker", "markers", data.size());
    223     }
    224 
    225     @Override public void mergeFrom(Layer from) {
     221    @Override
     222    public String getToolTipText() {
     223        return data.size()+' '+trn("marker", "markers", data.size());
     224    }
     225
     226    @Override
     227    public void mergeFrom(Layer from) {
    226228        MarkerLayer layer = (MarkerLayer) from;
    227229        data.addAll(layer.data);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java

    r8512 r8846  
    4343            new Notification(
    4444                    "<b>" + tr("There was an error while trying to display the URL for this marker") + "</b><br>" +
    45                                   tr("(URL was: ") + webUrl + ")" + "<br>" + error)
     45                                  tr("(URL was: ") + webUrl + ')' + "<br>" + error)
    4646                    .setIcon(JOptionPane.ERROR_MESSAGE)
    4747                    .setDuration(Notification.TIME_LONG)
  • trunk/src/org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java

    r8840 r8846  
    231231    @Override
    232232    public String toString() {
    233         return "BoxTextElemStyle{" + super.toString() + " " + text.toStringImpl()
     233        return "BoxTextElemStyle{" + super.toString() + ' ' + text.toStringImpl()
    234234                + " box=" + box + " hAlign=" + hAlign + " vAlign=" + vAlign + '}';
    235235    }
    236 
    237236}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java

    r8510 r8846  
    208208        StringBuilder res = new StringBuilder("Cascade{ ");
    209209        for (Entry<String, Object> entry : prop.entrySet()) {
    210             res.append(entry.getKey()+":");
     210            res.append(entry.getKey()+':');
    211211            Object val = entry.getValue();
    212212            if (val instanceof float[]) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r8582 r8846  
    132132            throw new AssertionError("Range violated: " + e.getMessage()
    133133                    + " (object: " + osm.getPrimitiveId() + ", current style: "+osm.mappaintStyle
    134                     + ", scale: " + scale + ", new stylelist: " + p.a + ", new range: " + p.b + ")", e);
     134                    + ", scale: " + scale + ", new stylelist: " + p.a + ", new range: " + p.b + ')', e);
    135135        }
    136136        osm.mappaintCacheIdx = cacheIdx;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategy.java

    r8726 r8846  
    6363        @Override
    6464        public String toString() {
    65             return "{"  + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + "}";
     65            return '{' + getClass().getSimpleName() + " defaultLabel=" + defaultLabel + '}';
    6666        }
    6767
     
    119119        @Override
    120120        public String toString() {
    121             return "{" + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + "}";
     121            return '{' + getClass().getSimpleName() + " defaultLabelTag=" + defaultLabelTag + '}';
    122122        }
    123123
     
    277277                        name = comp;
    278278                    } else {
    279                         name += " (" + comp + ")";
     279                        name += " (" + comp + ')';
    280280                    }
    281281                    break;
     
    293293        @Override
    294294        public String toString() {
    295             return "{" + getClass().getSimpleName() +"}";
     295            return "{" + getClass().getSimpleName() +'}';
    296296        }
    297297    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r8510 r8846  
    139139            if (widthTag != null) {
    140140                try {
    141                     realWidth = Float.valueOf(widthTag);
     141                    realWidth = Float.parseFloat(widthTag);
    142142                } catch (NumberFormatException nfe) {
    143143                    Main.warn(nfe);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java

    r8510 r8846  
    5656    @Override
    5757    public String toString() {
    58         return "LineTextElemStyle{" + super.toString() + "text=" + text + "}";
     58        return "LineTextElemStyle{" + super.toString() + "text=" + text + '}';
    5959    }
    6060}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MultiCascade.java

    r8377 r8846  
    4343                // be a modifier. Can be overridden in style definition.
    4444                if (!"default".equals(layer) && !"*".equals(layer)) {
    45                     c.put(MODIFIER, true);
     45                    c.put(MODIFIER, Boolean.TRUE);
    4646                }
    4747            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r8513 r8846  
    390390        s.append(super.toString());
    391391        if (mapImage != null) {
    392             s.append(" icon=[" + mapImage + "]");
     392            s.append(" icon=[" + mapImage + ']');
    393393        }
    394394        if (symbol != null) {
    395             s.append(" symbol=[" + symbol + "]");
     395            s.append(" symbol=[" + symbol + ']');
    396396        }
    397397        if (mapImageAngle != null) {
    398             s.append(" mapImageAngle=[" + mapImageAngle + "]");
     398            s.append(" mapImageAngle=[" + mapImageAngle + ']');
    399399        }
    400400        s.append('}');
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java

    r7864 r8846  
    2121    public Range(double lower, double upper) {
    2222        if (lower < 0 || lower >= upper)
    23             throw new IllegalArgumentException("Invalid range: "+lower+"-"+upper);
     23            throw new IllegalArgumentException("Invalid range: "+lower+'-'+upper);
    2424        this.lower = lower;
    2525        this.upper = upper;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java

    r8444 r8846  
    9191        return "RepeatImageStyle{" + super.toString() + "pattern=[" + pattern +
    9292                "], offset=" + offset + ", spacing=" + spacing +
    93                 ", phase=" + (-phase) + ", align=" + align + "}";
     93                ", phase=" + (-phase) + ", align=" + align + '}';
    9494    }
    9595}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r8836 r8846  
    271271        @Override
    272272        public String toString() {
    273             return "[" + k + "'" + op + "'" + v + "]";
     273            return '[' + k + '\'' + op + '\'' + v + ']';
    274274        }
    275275    }
     
    458458        @Override
    459459        public String toString() {
    460             return "[" + (negateResult ? "!" : "") + label + "]";
     460            return '[' + (negateResult ? "!" : "") + label + ']';
    461461        }
    462462    }
     
    479479        @Override
    480480        public String toString() {
    481             return (not ? "!" : "") + "." + id;
     481            return (not ? "!" : "") + '.' + id;
    482482        }
    483483    }
     
    629629        @Override
    630630        public String toString() {
    631             return (not ? "!" : "") + ":" + method.getName();
     631            return (not ? "!" : "") + ':' + method.getName();
    632632        }
    633633    }
     
    660660        @Override
    661661        public String toString() {
    662             return "[" + e + "]";
     662            return "[" + e + ']';
    663663        }
    664664    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java

    r8674 r8846  
    8888        public String toString() {
    8989            return key + ": " + (val instanceof float[] ? Arrays.toString((float[]) val) :
    90                 val instanceof String ? "String<"+val+">" : val) + ';';
     90                val instanceof String ? "String<"+val+'>' : val) + ';';
    9191        }
    9292    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/LiteralExpression.java

    r8376 r8846  
    2828            return Arrays.toString((float[]) literal);
    2929        }
    30         return "<" + literal + ">";
     30        return "<" + literal + '>';
    3131    }
    3232}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java

    r7879 r8846  
    7070        @Override
    7171        public String toString() {
    72             return "Declaration [instructions=" + instructions + ", idx=" + idx + "]";
     72            return "Declaration [instructions=" + instructions + ", idx=" + idx + ']';
    7373        }
    7474    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r8840 r8846  
    106106            try {
    107107                SUPPORTED_KEYS.add((String) f.get(null));
    108                 if (!f.getName().toLowerCase(Locale.ENGLISH).replace("_", "-").equals(f.get(null))) {
     108                if (!f.getName().toLowerCase(Locale.ENGLISH).replace('_', '-').equals(f.get(null))) {
    109109                    throw new RuntimeException(f.getName());
    110110                }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r8836 r8846  
    432432        @Override
    433433        public String toString() {
    434             return left + " " + (ChildOrParentSelectorType.PARENT.equals(type) ? "<" : ">") + link + " " + right;
     434            return left + " " + (ChildOrParentSelectorType.PARENT.equals(type) ? '<' : '>') + link + ' ' + right;
    435435        }
    436436    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java

    r8510 r8846  
    2222    public String getKey() {
    2323        if (value != null)
    24             return "n" + key + "=" + value;
     24            return 'n' + key + '=' + value;
    2525        else if (boolValue != null)
    26             return "b" + key  + "=" + OsmUtils.getNamedOsmBoolean(boolValue);
     26            return 'b' + key  + '=' + OsmUtils.getNamedOsmBoolean(boolValue);
    2727        else
    28             return "x" + key;
     28            return 'x' + key;
    2929    }
    3030
     
    3535    @Override
    3636    public String toString() {
    37       return "Rule["+key+","+(boolValue != null ? "b="+boolValue : "v="+value)+"]";
     37      return "Rule["+key+','+(boolValue != null ? "b="+boolValue : "v="+value)+']';
    3838    }
    3939
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r8510 r8846  
    162162            String val = primitive.get(key);
    163163            IconPrototype p;
    164             if ((p = icons.get("n" + key + "=" + val)) != null) {
     164            if ((p = icons.get('n' + key + '=' + val)) != null) {
    165165                icon = update(icon, p, scale, mc);
    166166            }
    167             if ((p = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) {
     167            if ((p = icons.get('b' + key + '=' + OsmUtils.getNamedOsmBoolean(val))) != null) {
    168168                icon = update(icon, p, scale, mc);
    169169            }
    170             if ((p = icons.get("x" + key)) != null) {
     170            if ((p = icons.get('x' + key)) != null) {
    171171                icon = update(icon, p, scale, mc);
    172172            }
     
    194194            LinePrototype styleLine;
    195195            LinemodPrototype styleLinemod;
    196             String idx = "n" + key + "=" + val;
     196            String idx = 'n' + key + '=' + val;
    197197            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    198198                p.area = update(p.area, styleArea, scale, mc);
     
    209209                }
    210210            }
    211             idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
     211            idx = 'b' + key + '=' + OsmUtils.getNamedOsmBoolean(val);
    212212            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    213213                p.area = update(p.area, styleArea, scale, mc);
     
    224224                }
    225225            }
    226             idx = "x" + key;
     226            idx = 'x' + key;
    227227            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
    228228                p.area = update(p.area, styleArea, scale, mc);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java

    r8510 r8846  
    5252        Color ret;
    5353        if (i < 0) {
    54             ret = Main.pref.getColor("mappaint."+style.getPrefName()+"."+colString, Color.red);
     54            ret = Main.pref.getColor("mappaint."+style.getPrefName()+'.'+colString, Color.red);
    5555        } else if (i == 0) {
    5656            ret = ColorHelper.html2color(colString);
    5757        } else {
    58             ret = Main.pref.getColor("mappaint."+style.getPrefName()+"."+colString.substring(0, i),
     58            ret = Main.pref.getColor("mappaint."+style.getPrefName()+'.'+colString.substring(0, i),
    5959                    ColorHelper.html2color(colString.substring(i)));
    6060        }
     
    7373
    7474    private void error(String message) {
    75         String warning = style.getDisplayString() + " (" + rule.cond.key + "=" + rule.cond.value + "): " + message;
     75        String warning = style.getDisplayString() + " (" + rule.cond.key + '=' + rule.cond.value + "): " + message;
    7676        Main.warn(warning);
    7777        style.logError(new Exception(warning));
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r8512 r8846  
    1616import java.util.LinkedList;
    1717import java.util.List;
     18import java.util.Set;
    1819
    1920import javax.swing.BorderFactory;
     
    7677        private final PluginPreference preference;
    7778        private final PluginDownloadTask task;
    78         private final List<PluginInformation> toDownload;
     79        private final Set<PluginInformation> toDownload;
    7980
    8081        private PluginDownloadAfterTask(PluginPreference preference, PluginDownloadTask task,
    81                 List<PluginInformation> toDownload) {
     82                Set<PluginInformation> toDownload) {
    8283            this.preference = preference;
    8384            this.task = task;
     
    413414        //
    414415        final PluginPreference preference = getPluginPreference();
    415         final List<PluginInformation> toDownload = preference.getPluginsScheduledForUpdateOrDownload();
     416        final Set<PluginInformation> toDownload = preference.getPluginsScheduledForUpdateOrDownload();
    416417        final PluginDownloadTask task;
    417418        if (toDownload != null && !toDownload.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r8836 r8846  
    151151            }
    152152        };
    153         tblActiveSources.putClientProperty("terminateEditOnFocusLost", true);
     153        tblActiveSources.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    154154        tblActiveSources.setSelectionModel(selectionModel);
    155155        tblActiveSources.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java

    r8510 r8846  
    8181            if (!sel.getName().endsWith(".xml")) sel = new File(sel.getAbsolutePath()+".xml");
    8282            if (!sel.getName().startsWith(schemaKey)) {
    83                 sel = new File(sel.getParentFile().getAbsolutePath()+"/"+schemaKey+"_"+sel.getName());
     83                sel = new File(sel.getParentFile().getAbsolutePath()+'/'+schemaKey+'_'+sel.getName());
    8484            }
    8585            return sel;
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

    r8510 r8846  
    119119            Color color = ColorHelper.html2color(html);
    120120            if (color == null) {
    121                 Main.warn("Unable to get color from '"+html+"' for color preference '"+value+"'");
     121                Main.warn("Unable to get color from '"+html+"' for color preference '"+value+'\'');
    122122            }
    123123            row.add(value);
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java

    r8568 r8846  
    8989    protected static String sanitize(String s, ImageryType type) {
    9090        String ret = s;
    91         String imageryType = type.getTypeString() + ":";
     91        String imageryType = type.getTypeString() + ':';
    9292        if (ret.startsWith(imageryType)) {
    9393            // remove ImageryType from URL
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r8840 r8846  
    2121import java.util.LinkedList;
    2222import java.util.List;
     23import java.util.Set;
    2324
    2425import javax.swing.AbstractAction;
     
    271272     * @return the list of plugins waiting for update or download
    272273     */
    273     public List<PluginInformation> getPluginsScheduledForUpdateOrDownload() {
     274    public Set<PluginInformation> getPluginsScheduledForUpdateOrDownload() {
    274275        return model != null ? model.getPluginsScheduledForUpdateOrDownload() : null;
    275276    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java

    r8510 r8846  
    165165
    166166    /**
    167      * Replies the list of plugin informations to display
     167     * Replies the list of plugin informations to display.
    168168     *
    169169     * @return the list of plugin informations to display
     
    173173    }
    174174
    175 
    176     /**
    177      * Replies the list of plugins waiting for update or download
    178      *
    179      * @return the list of plugins waiting for update or download
    180      */
    181     public List<PluginInformation> getPluginsScheduledForUpdateOrDownload() {
    182         List<PluginInformation> ret = new ArrayList<>();
     175    /**
     176     * Replies the set of plugins waiting for update or download.
     177     *
     178     * @return the set of plugins waiting for update or download
     179     */
     180    public Set<PluginInformation> getPluginsScheduledForUpdateOrDownload() {
     181        Set<PluginInformation> ret = new HashSet<>();
    183182        for (String plugin: pendingDownloads) {
    184183            PluginInformation pi = getPluginInformation(plugin);
  • trunk/src/org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java

    r8510 r8846  
    173173        String newTitle;
    174174        if (extraText != null) {
    175             newTitle = taskTitle + " " + extraText;
     175            newTitle = taskTitle + ' ' + extraText;
    176176        } else {
    177177            newTitle = taskTitle;
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskId.java

    r7937 r8846  
    77
    88    public ProgressTaskId(String component, String task) {
    9         this.id = component + "." + task;
     9        this.id = component + '.' + task;
    1010    }
    1111
     
    2929        ProgressTaskId other = (ProgressTaskId) obj;
    3030        return other.id.equals(id);
    31 
    3231    }
    33 
    3432}
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r8840 r8846  
    130130     */
    131131    public String getName() {
    132         return group != null ? group.getName() + "/" + getLocaleName() : getLocaleName();
     132        return group != null ? group.getName() + '/' + getLocaleName() : getLocaleName();
    133133    }
    134134
     
    137137     */
    138138    public String getRawName() {
    139         return group != null ? group.getRawName() + "/" + name : name;
     139        return group != null ? group.getRawName() + '/' + name : name;
    140140    }
    141141
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r8840 r8846  
    247247                locale_text = getLocaleText(text, text_context, null);
    248248            }
    249             p.add(new JLabel(locale_text+":"), GBC.std().insets(0, 0, 10, 0));
     249            p.add(new JLabel(locale_text+':'), GBC.std().insets(0, 0, 10, 0));
    250250            p.add(new JLabel(key), GBC.std().insets(0, 0, 10, 0));
    251251            p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0, 0, 10, 0));
     
    360360        @Override
    361361        public String toString() {
    362             return getClass().getSimpleName() + " [" + fieldsToString() + "]";
     362            return getClass().getSimpleName() + " [" + fieldsToString() + ']';
    363363        }
    364364    }
     
    583583            return "KeyedItem [key=" + key + ", text=" + text
    584584                    + ", text_context=" + text_context + ", match=" + match
    585                     + "]";
     585                    + ']';
    586586        }
    587587    }
     
    619619            return "Key [key=" + key + ", value=" + value + ", text=" + text
    620620                    + ", text_context=" + text_context + ", match=" + match
    621                     + "]";
     621                    + ']';
    622622        }
    623623    }
     
    646646            AutoCompletingTextField textField = new AutoCompletingTextField();
    647647            if (alternative_autocomplete_keys != null) {
    648                 initAutoCompletionField(textField, (key + "," + alternative_autocomplete_keys).split(","));
     648                initAutoCompletionField(textField, (key + ',' + alternative_autocomplete_keys).split(","));
    649649            } else {
    650650                initAutoCompletionField(textField, key);
     
    754754                value = pnl;
    755755            }
    756             p.add(new JLabel(locale_text+":"), GBC.std().insets(0, 0, 10, 0));
     756            p.add(new JLabel(locale_text+':'), GBC.std().insets(0, 0, 10, 0));
    757757            p.add(value, GBC.eol().fill(GBC.HORIZONTAL));
    758758            return true;
     
    861861            for (Check check : checks) {
    862862                if (Boolean.TRUE.equals(check.matches(tags))) {
    863                     return true;
     863                    return Boolean.TRUE;
    864864                }
    865865            }
     
    869869        @Override
    870870        public String toString() {
    871             return "CheckGroup [columns=" + columns + "]";
     871            return "CheckGroup [columns=" + columns + ']';
    872872        }
    873873    }
     
    981981                    + (check != null ? "check=" + check + ", " : "")
    982982                    + (initialState != null ? "initialState=" + initialState
    983                             + ", " : "") + "def=" + def + "]";
     983                            + ", " : "") + "def=" + def + ']';
    984984        }
    985985    }
  • trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java

    r8537 r8846  
    131131                    for (KeyPressReleaseListener q: keyListeners) {
    132132                        if (Main.isDebugEnabled()) {
    133                             Main.debug(q+" => doKeyPressed("+e+")");
     133                            Main.debug(q+" => doKeyPressed("+e+')');
    134134                        }
    135135                        q.doKeyPressed(e);
     
    144144                        for (KeyPressReleaseListener q: keyListeners) {
    145145                            if (Main.isDebugEnabled()) {
    146                                 Main.debug(q+" => doKeyReleased("+e+")");
     146                                Main.debug(q+" => doKeyReleased("+e+')');
    147147                            }
    148148                            q.doKeyReleased(e);
  • trunk/src/org/openstreetmap/josm/gui/widgets/HtmlPanel.java

    r6890 r8846  
    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}",
     
    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}");
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java

    r8377 r8846  
    9999        final Font f = UIManager.getFont("Label.font");
    100100        final StyleSheet ss = new StyleSheet();
    101         ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + "}");
     101        ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + '}');
    102102        ss.addRule("a {text-decoration: underline; color: blue}");
    103         ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + "}");
     103        ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + '}');
    104104        ss.addRule("ol {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: decimal}");
    105105        ss.addRule("ul {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: disc}");
    106106        if ("km".equals(LanguageInfo.getJOSMLocaleCode())) {
    107107            // Fix rendering problem for Khmer script
    108             ss.addRule("p {" + getFontRule(UIManager.getFont("Label.font")) + "}");
     108            ss.addRule("p {" + getFontRule(UIManager.getFont("Label.font")) + '}');
    109109        }
    110110        kit.setStyleSheet(ss);
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r8840 r8846  
    11581158            }
    11591159        } else {
    1160             throwParseException(st, "unrecognized attribute \"" + name + "\"");
     1160            throwParseException(st, "unrecognized attribute \"" + name + '\"');
    11611161        }
    11621162    }
     
    12131213                    parseSplit(st, split);
    12141214                } else {
    1215                     throwParseException(st, "unrecognized node type '" + nodeType + "'");
     1215                    throwParseException(st, "unrecognized node type '" + nodeType + '\'');
    12161216                }
    12171217            }
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r8788 r8846  
    4848        boolean done = false;
    4949        GpxData result = null;
    50         String url = "trackpoints?bbox="+b.getMinLon()+","+b.getMinLat()+","+b.getMaxLon()+","+b.getMaxLat()+"&page=";
     50        String url = "trackpoints?bbox="+b.getMinLon()+','+b.getMinLat()+','+b.getMaxLon()+','+b.getMaxLat()+"&page=";
    5151        for (int i = 0; !done; ++i) {
    5252            progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, (i + 1) * 5000));
     
    123123     */
    124124    protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2) {
    125         return "map?bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     125        return "map?bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    126126    }
    127127
     
    190190        CheckParameterUtil.ensureThat(noteLimit <= 10000, "Requested note limit is over API hard limit of 10000.");
    191191        CheckParameterUtil.ensureThat(daysClosed >= -1, "Requested note limit is less than -1.");
    192         String url = "notes?limit=" + noteLimit + "&closed=" + daysClosed + "&bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     192        String url = "notes?limit=" + noteLimit + "&closed=" + daysClosed + "&bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    193193        try {
    194194            InputStream is = getInputStream(url, progressMonitor.createSubTaskMonitor(1, false));
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r8840 r8846  
    289289            while (entries.hasMoreElements()) {
    290290                ZipEntry entry = entries.nextElement();
    291                 if (entry.getName().endsWith("." + extension)) {
     291                if (entry.getName().endsWith('.' + extension)) {
    292292                    /* choose any file with correct extension. When more than
    293293                        one file, prefer the one which matches namepart */
     
    415415            if (ifModifiedSince != null && con.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
    416416                if (Main.isDebugEnabled()) {
    417                     Main.debug("304 Not Modified ("+urlStr+")");
     417                    Main.debug("304 Not Modified ("+urlStr+')');
    418418                }
    419419                if (localFile == null)
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r8540 r8846  
    4545    private static final String GPL_WARNING = "<html><font color='red' size='-2'>"
    4646        + tr("Note: GPL is not compatible with the OSM license. Do not upload GPL licensed tracks.") + "</html>";
     47
     48    private static final String[] LICENSES = {
     49            "Creative Commons By-SA",
     50            "Open Database License (ODbL)",
     51            "public domain",
     52            "GNU Lesser Public License (LGPL)",
     53            "BSD License (MIT/X11)"};
     54
     55    private static final String[] URLS = {
     56            "https://creativecommons.org/licenses/by-sa/3.0",
     57            "http://opendatacommons.org/licenses/odbl/1.0",
     58            "public domain",
     59            "https://www.gnu.org/copyleft/lesser.html",
     60            "http://www.opensource.org/licenses/bsd-license.php"};
    4761
    4862    /**
     
    292306            @Override
    293307            public void actionPerformed(ActionEvent e) {
    294                 final String[] licenses = {
    295                         "Creative Commons By-SA",
    296                         "Open Database License (ODbL)",
    297                         "public domain",
    298                         "GNU Lesser Public License (LGPL)",
    299                         "BSD License (MIT/X11)"};
    300                 JList<String> l = new JList<>(licenses);
    301                 l.setVisibleRowCount(licenses.length);
     308                JList<String> l = new JList<>(LICENSES);
     309                l.setVisibleRowCount(LICENSES.length);
    302310                l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    303311                int answer = JOptionPane.showConfirmDialog(
     
    310318                if (answer != JOptionPane.OK_OPTION || l.getSelectedIndex() == -1)
    311319                    return;
    312                 final String[] urls = {
    313                         "https://creativecommons.org/licenses/by-sa/3.0",
    314                         "http://opendatacommons.org/licenses/odbl/1.0",
    315                         "public domain",
    316                         "https://www.gnu.org/copyleft/lesser.html",
    317                         "http://www.opensource.org/licenses/bsd-license.php"};
    318320                String license = "";
    319321                for (int i : l.getSelectedIndices()) {
     
    322324                        break;
    323325                    }
    324                     license += license.isEmpty() ? urls[i] : ", "+urls[i];
     326                    license += license.isEmpty() ? URLS[i] : ", "+URLS[i];
    325327                }
    326328                copyright.setText(license);
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r8840 r8846  
    178178                    break;
    179179                case "email":
    180                     data.put(META_AUTHOR_EMAIL, atts.getValue("id") + "@" + atts.getValue("domain"));
     180                    data.put(META_AUTHOR_EMAIL, atts.getValue("id") + '@' + atts.getValue("domain"));
    181181                }
    182182                break;
     
    549549                if (e instanceof SAXParseException) {
    550550                    SAXParseException spe = (SAXParseException) e;
    551                     message += " " + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber());
     551                    message += ' ' + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber());
    552552                }
    553553                Main.warn(message);
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r8461 r8846  
    135135                String[] tmp = data.getString(META_AUTHOR_EMAIL).split("@");
    136136                if (tmp.length == 2) {
    137                     inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+"\"");
     137                    inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+'\"');
    138138                }
    139139            }
     
    146146        if (attr.containsKey(META_COPYRIGHT_LICENSE)
    147147                || attr.containsKey(META_COPYRIGHT_YEAR)) {
    148             openAtt("copyright", "author=\""+ data.get(META_COPYRIGHT_AUTHOR) +"\"");
     148            openAtt("copyright", "author=\""+ data.get(META_COPYRIGHT_AUTHOR) +'\"');
    149149            if (attr.containsKey(META_COPYRIGHT_YEAR)) {
    150150                simpleTag("year", (String) data.get(META_COPYRIGHT_YEAR));
     
    171171        if (bounds != null) {
    172172            String b = "minlat=\"" + bounds.getMinLat() + "\" minlon=\"" + bounds.getMinLon() +
    173             "\" maxlat=\"" + bounds.getMaxLat() + "\" maxlon=\"" + bounds.getMaxLon() + "\"";
     173            "\" maxlat=\"" + bounds.getMaxLat() + "\" maxlon=\"" + bounds.getMaxLon() + '\"';
    174174            inline("bounds", b);
    175175        }
     
    222222
    223223    private void open(String tag) {
    224         out.print(indent + "<" + tag + ">");
     224        out.print(indent + '<' + tag + '>');
    225225        indent += "  ";
    226226    }
    227227
    228228    private void openAtt(String tag, String attributes) {
    229         out.println(indent + "<" + tag + " " + attributes + ">");
     229        out.println(indent + '<' + tag + ' ' + attributes + '>');
    230230        indent += "  ";
    231231    }
    232232
    233233    private void inline(String tag, String attributes) {
    234         out.println(indent + "<" + tag + " " + attributes + "/>");
     234        out.println(indent + '<' + tag + ' ' + attributes + "/>");
    235235    }
    236236
    237237    private void close(String tag) {
    238238        indent = indent.substring(2);
    239         out.print(indent + "</" + tag + ">");
     239        out.print(indent + "</" + tag + '>');
    240240    }
    241241
     
    253253            open(tag);
    254254            out.print(encode(content));
    255             out.println("</" + tag + ">");
     255            out.println("</" + tag + '>');
    256256            indent = indent.substring(2);
    257257        }
     
    263263    private void gpxLink(GpxLink link) {
    264264        if (link != null) {
    265             openAtt("link", "href=\"" + link.uri + "\"");
     265            openAtt("link", "href=\"" + link.uri + '\"');
    266266            simpleTag("text", link.text);
    267267            simpleTag("type", link.type);
     
    290290        if (pnt != null) {
    291291            LatLon c = pnt.getCoor();
    292             String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"";
     292            String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + '\"';
    293293            if (pnt.attr.isEmpty()) {
    294294                inline(type, coordAttr);
  • trunk/src/org/openstreetmap/josm/io/JpgImporter.java

    r8540 r8846  
    3636     */
    3737    public static final ExtensionFileFilter FILE_FILTER_WITH_FOLDERS = new ExtensionFileFilter(
    38             "jpg,jpeg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+")");
     38            "jpg,jpeg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+')');
    3939
    4040    /**
  • trunk/src/org/openstreetmap/josm/io/MessageNotifier.java

    r8840 r8846  
    7171                            panel.add(new JLabel(trn("You have {0} unread message.", "You have {0} unread messages.", unread, unread)),
    7272                                    GBC.eol());
    73                             panel.add(new UrlLabel(Main.getBaseUserUrl() + "/" + userInfo.getDisplayName() + "/inbox",
     73                            panel.add(new UrlLabel(Main.getBaseUserUrl() + '/' + userInfo.getDisplayName() + "/inbox",
    7474                                    tr("Click here to see your inbox.")), GBC.eol());
    7575                            panel.setOpaque(false);
     
    9797        } else if (!isRunning() && interval > 0 && isUserEnoughIdentified()) {
    9898            task = EXECUTOR.scheduleAtFixedRate(WORKER, 0, interval * 60, TimeUnit.SECONDS);
    99             Main.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+")");
     99            Main.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+')');
    100100        }
    101101    }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r8734 r8846  
    351351        // Run the fetchers
    352352        for (int i = 0; i < jobs.size() && !isCanceled(); i++) {
    353             progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + "/" + progressMonitor.getTicksCount());
     353            progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + '/' + progressMonitor.getTicksCount());
    354354            try {
    355355                FetchResult result = ecs.take().get();
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r8840 r8846  
    378378            initialize(monitor);
    379379            // normal mode (0.6 and up) returns new object version.
    380             ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true), monitor);
     380            ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+'/' + osm.getId(), toXml(osm, true), monitor);
    381381            osm.setOsmId(osm.getId(), Integer.parseInt(ret.trim()));
    382382            osm.setChangesetId(getChangeset().getId());
     
    623623            try {
    624624                url = new URL(new URL(getBaseUrl()), urlSuffix);
    625                 Main.info(requestMethod + " " + url + "... ");
     625                Main.info(requestMethod + ' ' + url + "... ");
    626626                Main.debug(requestBody);
    627627                // fix #5369, see http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive
  • trunk/src/org/openstreetmap/josm/io/OsmConnection.java

    r8840 r8846  
    9595            String username = response.getUsername() == null ? "" : response.getUsername();
    9696            String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword());
    97             token = username + ":" + password;
     97            token = username + ':' + password;
    9898            try {
    9999                ByteBuffer bytes = encoder.encode(CharBuffer.wrap(token));
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r8291 r8846  
    8686            // a truncated file.  That can destroy lots of work.
    8787            if (file.exists()) {
    88                 tmpFile = new File(file.getPath() + "~");
     88                tmpFile = new File(file.getPath() + '~');
    8989                Utils.copyFile(file, tmpFile);
    9090            }
  • trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java

    r8347 r8846  
    4040            if (locator == null)
    4141                return "";
    42             return "(" + locator.getLineNumber() + "," + locator.getColumnNumber() + ")";
     42            return "(" + locator.getLineNumber() + ',' + locator.getColumnNumber() + ')';
    4343        }
    4444
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r8836 r8846  
    562562            if (getLocation() == null)
    563563                return msg;
    564             msg += " " + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
     564            msg += ' ' + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
    565565            int offset = getLocation().getCharacterOffset();
    566566            if (offset > -1) {
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r8840 r8846  
    152152            try {
    153153                if (reason != null && !reason.isEmpty()) {
    154                     Main.info("GET " + url + " (" + reason + ")");
     154                    Main.info("GET " + url + " (" + reason + ')');
    155155                } else {
    156156                    Main.info("GET " + url);
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r8840 r8846  
    7171        long minutes_left = ms_left / MSECS_PER_MINUTE;
    7272        long seconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE;
    73         String time_left_str = Long.toString(minutes_left) + ":";
     73        String time_left_str = Long.toString(minutes_left) + ':';
    7474        if (seconds_left < 10) {
    75             time_left_str += "0";
     75            time_left_str += '0';
    7676        }
    7777        return time_left_str + Long.toString(seconds_left);
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r8565 r8846  
    185185            if (n.getCoor() != null) {
    186186                out.print(" lat='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lat())+
    187                           "' lon='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lon())+"'");
     187                          "' lon='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lon())+'\'');
    188188            }
    189189            addTags(n, "node", true);
     
    226226    public void visit(Changeset cs) {
    227227        out.print("  <changeset ");
    228         out.print(" id='"+cs.getId()+"'");
     228        out.print(" id='"+cs.getId()+'\'');
    229229        if (cs.getUser() != null) {
    230             out.print(" user='"+cs.getUser().getName() +"'");
    231             out.print(" uid='"+cs.getUser().getId() +"'");
     230            out.print(" user='"+cs.getUser().getName() +'\'');
     231            out.print(" uid='"+cs.getUser().getId() +'\'');
    232232        }
    233233        if (cs.getCreatedAt() != null) {
    234             out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +"'");
     234            out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +'\'');
    235235        }
    236236        if (cs.getClosedAt() != null) {
    237             out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +"'");
    238         }
    239         out.print(" open='"+ (cs.isOpen() ? "true" : "false") +"'");
     237            out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +'\'');
     238        }
     239        out.print(" open='"+ (cs.isOpen() ? "true" : "false") +'\'');
    240240        if (cs.getMin() != null) {
    241             out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
    242             out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
     241            out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
     242            out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
    243243        }
    244244        if (cs.getMax() != null) {
    245             out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
    246             out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
     245            out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
     246            out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
    247247        }
    248248        out.println(">");
     
    268268                        "' v='"+XmlWriter.encode(e.getValue())+ "' />");
    269269            }
    270             out.println("  </" + tagname + ">");
     270            out.println("  </" + tagname + '>');
    271271        } else if (tagOpen) {
    272272            out.println(" />");
    273273        } else {
    274             out.println("  </" + tagname + ">");
     274            out.println("  </" + tagname + '>');
    275275        }
    276276    }
     
    283283        out.print("  <"+tagname);
    284284        if (osm.getUniqueId() != 0) {
    285             out.print(" id='"+ osm.getUniqueId()+"'");
     285            out.print(" id='"+ osm.getUniqueId()+'\'');
    286286        } else
    287287            throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found"));
     
    295295                }
    296296                if (action != null) {
    297                     out.print(" action='"+action+"'");
     297                    out.print(" action='"+action+'\'');
    298298                }
    299299            }
    300300            if (!osm.isTimestampEmpty()) {
    301                 out.print(" timestamp='"+DateUtils.fromTimestamp(osm.getRawTimestamp())+"'");
     301                out.print(" timestamp='"+DateUtils.fromTimestamp(osm.getRawTimestamp())+'\'');
    302302            }
    303303            // user and visible added with 0.4 API
    304304            if (osm.getUser() != null) {
    305305                if (osm.getUser().isLocalUser()) {
    306                     out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'");
     306                    out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');
    307307                } else if (osm.getUser().isOsmUser()) {
    308308                    // uid added with 0.6
    309                     out.print(" uid='"+ osm.getUser().getId()+"'");
    310                     out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'");
     309                    out.print(" uid='"+ osm.getUser().getId()+'\'');
     310                    out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');
    311311                }
    312312            }
    313             out.print(" visible='"+osm.isVisible()+"'");
     313            out.print(" visible='"+osm.isVisible()+'\'');
    314314        }
    315315        if (osm.getVersion() != 0) {
    316             out.print(" version='"+osm.getVersion()+"'");
     316            out.print(" version='"+osm.getVersion()+'\'');
    317317        }
    318318        if (this.changeset != null && this.changeset.getId() != 0) {
    319             out.print(" changeset='"+this.changeset.getId()+"'");
     319            out.print(" changeset='"+this.changeset.getId()+'\'');
    320320        } else if (osm.getChangesetId() > 0 && !osm.isNew()) {
    321             out.print(" changeset='"+osm.getChangesetId()+"'");
     321            out.print(" changeset='"+osm.getChangesetId()+'\'');
    322322        }
    323323    }
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r8788 r8846  
    5050            String realQuery = completeOverpassQuery(overpassQuery);
    5151            return "interpreter?data=" + Utils.encodeUrl(realQuery)
    52                     + "&bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     52                    + "&bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    5353        }
    5454    }
    5555
    5656    private String completeOverpassQuery(String query) {
    57         int firstColon = query.indexOf(";");
     57        int firstColon = query.indexOf(';');
    5858        if (firstColon == -1) {
    5959            return "[bbox];" + query;
  • trunk/src/org/openstreetmap/josm/io/auth/DefaultAuthenticator.java

    r8510 r8846  
    5555            if (response == null || response.isCanceled())
    5656                return null;
    57             credentialsTried.put(getRequestorType(), true);
     57            credentialsTried.put(getRequestorType(), Boolean.TRUE);
    5858            return new PasswordAuthentication(response.getUsername(), response.getPassword());
    5959        } catch (CredentialsAgentException e) {
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r8510 r8846  
    149149                    try {
    150150                        bounds = new ImageryBounds(
    151                                 atts.getValue("min-lat") + "," +
    152                                         atts.getValue("min-lon") + "," +
    153                                         atts.getValue("max-lat") + "," +
     151                                atts.getValue("min-lat") + ',' +
     152                                        atts.getValue("min-lon") + ',' +
     153                                        atts.getValue("max-lat") + ',' +
    154154                                        atts.getValue("max-lon"), ",");
    155155                    } catch (IllegalArgumentException e) {
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r8650 r8846  
    121121                final String getCapabilitiesQuery = "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities";
    122122                if (getCapabilitiesUrl.getQuery() == null) {
    123                     getCapabilitiesUrl = new URL(serviceUrlStr + "?" + getCapabilitiesQuery);
     123                    getCapabilitiesUrl = new URL(serviceUrlStr + '?' + getCapabilitiesQuery);
    124124                } else if (!getCapabilitiesUrl.getQuery().isEmpty() && !getCapabilitiesUrl.getQuery().endsWith("&")) {
    125                     getCapabilitiesUrl = new URL(serviceUrlStr + "&" + getCapabilitiesQuery);
     125                    getCapabilitiesUrl = new URL(serviceUrlStr + '&' + getCapabilitiesQuery);
    126126                } else {
    127127                    getCapabilitiesUrl = new URL(serviceUrlStr + getCapabilitiesQuery);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r8510 r8846  
    109109            command = command.substring(1);
    110110        }
    111         String commandWithSlash = "/" + command;
     111        String commandWithSlash = '/' + command;
    112112        if (handlers.get(commandWithSlash) != null) {
    113113            Main.info("RemoteControl: ignoring duplicate command " + command
     
    116116            if (!silent) {
    117117                Main.info("RemoteControl: adding command \"" +
    118                     command + "\" (handled by " + handler.getSimpleName() + ")");
     118                    command + "\" (handled by " + handler.getSimpleName() + ')');
    119119            }
    120120            handlers.put(commandWithSlash, handler);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r8510 r8846  
    8181
    8282        // Parse the arguments
    83         Main.info("Adding node at (" + lat + ", " + lon + ")");
     83        Main.info("Adding node at (" + lat + ", " + lon + ')');
    8484
    8585        // Create a new node
     
    118118            lon = Double.parseDouble(args.get("lon"));
    119119        } catch (NumberFormatException e) {
    120             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     120            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    121121        }
    122122        if (!Main.main.hasEditLayer()) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r8540 r8846  
    106106                allCoordinates.add(new LatLon(lat, lon));
    107107            } catch (NumberFormatException e) {
    108                 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     108                throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    109109            }
    110110        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/FeaturesHandler.java

    r8510 r8846  
    3333                   buf.append(", ");
    3434               }
    35                String info = RequestProcessor.getHandlerInfoAsJSON("/"+s);
     35               String info = RequestProcessor.getHandlerInfoAsJSON('/'+s);
    3636               if (info != null) {
    3737                   buf.append(info);
     
    4848        contentType = "application/json";
    4949        if (args.containsKey("jsonp")) {
    50             content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ")";
     50            content = args.get("jsonp") + " && " + args.get("jsonp") + '(' + content + ')';
    5151        }
    5252    }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r8811 r8846  
    274274            maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right")));
    275275        } catch (NumberFormatException e) {
    276             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     276            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    277277        }
    278278
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r8510 r8846  
    224224            if (value == null || value.isEmpty()) {
    225225                error = true;
    226                 Main.warn("'" + myCommand + "' remote control request must have '" + key + "' parameter");
     226                Main.warn('\'' + myCommand + "' remote control request must have '" + key + "' parameter");
    227227                missingKeys.add(key);
    228228            }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java

    r8444 r8846  
    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    }
  • trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java

    r8540 r8846  
    106106        List<SessionReader.LayerDependency> deps = support.getLayerDependencies();
    107107        if (!deps.isEmpty()) {
    108             Layer layer = deps.iterator().next().getLayer();
     108            Layer layer = deps.get(0).getLayer();
    109109            if (layer instanceof GpxLayer) {
    110110                gpxLayer = (GpxLayer) layer;
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r8803 r8846  
    4949            AbstractTileSourceLayer tsLayer = (AbstractTileSourceLayer) layer;
    5050            if (attributes.containsKey("automatic-downloading")) {
    51                 tsLayer.autoLoad = Boolean.valueOf(attributes.get("automatic-downloading"));
     51                tsLayer.autoLoad = Boolean.parseBoolean(attributes.get("automatic-downloading"));
    5252            }
    5353
    5454            if (attributes.containsKey("automatically-change-resolution")) {
    55                 tsLayer.autoZoom = Boolean.valueOf(attributes.get("automatically-change-resolution"));
     55                tsLayer.autoZoom = Boolean.parseBoolean(attributes.get("automatically-change-resolution"));
    5656            }
    5757
    5858            if (attributes.containsKey("show-errors")) {
    59                 tsLayer.showErrors = Boolean.valueOf(attributes.get("show-errors"));
     59                tsLayer.showErrors = Boolean.parseBoolean(attributes.get("show-errors"));
    6060            }
    6161        }
  • trunk/src/org/openstreetmap/josm/io/session/MarkerSessionImporter.java

    r8509 r8846  
    4949                List<SessionReader.LayerDependency> deps = support.getLayerDependencies();
    5050                if (!deps.isEmpty()) {
    51                     Layer layer = deps.iterator().next().getLayer();
     51                    Layer layer = deps.get(0).getLayer();
    5252                    if (layer instanceof GpxLayer) {
    5353                        gpxLayer = (GpxLayer) layer;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r8840 r8846  
    13901390            pl.remove(pi.name);
    13911391            pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion.isEmpty()
    1392                     ? pi.localversion : "unknown") + ")");
     1392                    ? pi.localversion : "unknown") + ')');
    13931393        }
    13941394        Collections.sort(pl);
  • trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java

    r8510 r8846  
    7070                    while (line.length() > 70) {
    7171                        manifest.append(line.substring(0, 70)).append('\n');
    72                         line = " " + line.substring(70);
     72                        line = ' ' + line.substring(70);
    7373                    }
    7474                    manifest.append(line).append('\n');
  • trunk/src/org/openstreetmap/josm/tools/ColorHelper.java

    r8510 r8846  
    6363        if (col == null)
    6464            return null;
    65         String code = "#"+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());
     65        String code = '#'+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());
    6666        if (withAlpha) {
    6767            int alpha = col.getAlpha();
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r8836 r8846  
    267267        if (header != null) {
    268268            if (body != null && !header.equals(body)) {
    269                 msg = header + " (" + body + ")";
     269                msg = header + " (" + body + ')';
    270270            } else {
    271271                msg = header;
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r8840 r8846  
    309309        }
    310310        if (strings != null) {
    311             String trans = strings.get(ctx == null ? text : "_:"+ctx+"\n"+text);
     311            String trans = strings.get(ctx == null ? text : "_:"+ctx+'\n'+text);
    312312            if (trans != null)
    313313                return trans;
     
    315315        if (pstrings != null) {
    316316            i = pluralEval(1);
    317             String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+"\n"+text);
     317            String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+'\n'+text);
    318318            if (trans != null && trans.length > i)
    319319                return trans[i];
     
    339339        if (pstrings != null) {
    340340            i = pluralEval(num);
    341             String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+"\n"+text);
     341            String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+'\n'+text);
    342342            if (trans != null && trans.length > i)
    343343                return trans[i];
     
    353353
    354354    private static URL getTranslationFile(String lang) {
    355         return Main.class.getResource("/data/"+lang.replace("@", "-")+".lang");
     355        return Main.class.getResource("/data/"+lang.replace('@', '-')+".lang");
    356356    }
    357357
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r8840 r8846  
    720720                subdir = "";
    721721            } else if (!subdir.isEmpty() && !subdir.endsWith("/")) {
    722                 subdir += "/";
     722                subdir += '/';
    723723            }
    724724            String[] extensions;
     
    742742                    /* cache separately */
    743743                    if (dirs != null && !dirs.isEmpty()) {
    744                         cacheName = "id:" + id + ":" + fullName;
     744                        cacheName = "id:" + id + ':' + fullName;
    745745                        if (archive != null) {
    746                             cacheName += ":" + archive.getName();
     746                            cacheName += ':' + archive.getName();
    747747                        }
    748748                    }
     
    838838                    bytes = Utils.decodeUrl(data).getBytes(StandardCharsets.UTF_8);
    839839                } catch (IllegalArgumentException ex) {
    840                     Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")");
     840                    Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ')');
    841841                    return null;
    842842                }
     
    898898            } else {
    899899                final String fn_md5 = Utils.md5Hex(fn);
    900                 url = b + fn_md5.substring(0, 1) + "/" + fn_md5.substring(0, 2) + "/" + fn;
     900                url = b + fn_md5.substring(0, 1) + '/' + fn_md5.substring(0, 2) + "/" + fn;
    901901            }
    902902            result = getIfAvailableHttp(url, type);
     
    922922                inArchiveDir = "";
    923923            } else if (!inArchiveDir.isEmpty()) {
    924                 inArchiveDir += "/";
     924                inArchiveDir += '/';
    925925            }
    926926            String entryName = inArchiveDir + fullName;
     
    11421142        }
    11431143        if (GraphicsEnvironment.isHeadless()) {
    1144             Main.warn("Cursors are not available in headless mode. Returning null for '"+name+"'");
     1144            Main.warn("Cursors are not available in headless mode. Returning null for '"+name+'\'');
    11451145            return null;
    11461146        }
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r8510 r8846  
    5454        } else if (code.matches(".+@.+")) {
    5555          return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1, 2)
    56           + "-" + code.substring(3, 4).toUpperCase(Locale.ENGLISH) + code.substring(4) + ":";
    57         }
    58         return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1) + ":";
     56          + '-' + code.substring(3, 4).toUpperCase(Locale.ENGLISH) + code.substring(4) + ':';
     57        }
     58        return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1) + ':';
    5959    }
    6060
     
    156156     */
    157157    public static Locale getLocale(String localeName) {
    158         int country = localeName.indexOf("_");
    159         int variant = localeName.indexOf("@");
     158        int country = localeName.indexOf('_');
     159        int variant = localeName.indexOf('@');
    160160        if (variant < 0 && country >= 0)
    161             variant = localeName.indexOf("_", country+1);
     161            variant = localeName.indexOf('_', country+1);
    162162        Locale l;
    163163        if (variant > 0 && country > 0) {
     
    198198    public static String getLanguageCodeXML() {
    199199        String code = getJOSMLocaleCode();
    200         code = code.replace("@", "-");
    201         return code+".";
     200        code = code.replace('@', '-');
     201        return code+'.';
    202202    }
    203203
     
    210210    public static String getLanguageCodeManifest() {
    211211        String code = getJOSMLocaleCode();
    212         code = code.replace("@", "-");
    213         return code+"_";
     212        code = code.replace('@', '-');
     213        return code+'_';
    214214    }
    215215
     
    239239        if (v != null && !v.isEmpty()) {
    240240            if (c != null)
    241                 list.add(lang+"_"+c+"@"+v);
    242             list.add(lang+"@"+v);
     241                list.add(lang+'_'+c+'@'+v);
     242            list.add(lang+'@'+v);
    243243        }
    244244        if (c != null)
    245             list.add(lang+"_"+c);
     245            list.add(lang+'_'+c);
    246246        list.add(lang);
    247247        return list;
  • trunk/src/org/openstreetmap/josm/tools/MultiMap.java

    r8510 r8846  
    232232        List<String> entries = new ArrayList<>(map.size());
    233233        for (Entry<A, Set<B>> entry : map.entrySet()) {
    234             entries.add(entry.getKey() + "->{" + Utils.join(",", entry.getValue()) + "}");
    235         }
    236         return "(" + Utils.join(",", entries) + ")";
     234            entries.add(entry.getKey() + "->{" + Utils.join(",", entry.getValue()) + '}');
     235        }
     236        return '(' + Utils.join(",", entries) + ')';
    237237    }
    238238}
  • trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java

    r8510 r8846  
    209209
    210210    private String formatMenuText(KeyStroke keyStroke, String index, String description) {
    211         String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + "+"
    212                 + KeyEvent.getKeyText(keyStroke.getKeyCode()) + "," + index;
     211        String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + '+'
     212                + KeyEvent.getKeyText(keyStroke.getKeyCode()) + ',' + index;
    213213
    214214        return "<html><i>" + shortcutText + "</i>&nbsp;&nbsp;&nbsp;&nbsp;" + description;
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r8510 r8846  
    118118        if (map.containsKey(key))
    119119            return Double.parseDouble(map.get(key));
    120         return Double.parseDouble(map.get("m"+key));
     120        return Double.parseDouble(map.get('m'+key));
    121121    }
    122122
     
    296296        double lon = Math.round(dlon * decimals);
    297297        lon /= decimals;
    298         return Main.getOSMWebsite() + "/#map="+zoom+"/"+lat+"/"+lon;
     298        return Main.getOSMWebsite() + "/#map="+zoom+'/'+lat+'/'+lon;
    299299    }
    300300}
  • trunk/src/org/openstreetmap/josm/tools/Pair.java

    r8510 r8846  
    6464    @Override
    6565    public String toString() {
    66         return "<"+a+","+b+">";
     66        return "<"+a+','+b+'>';
    6767    }
    6868
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r8510 r8846  
    295295        result += name;
    296296        if (sc != null && !sc.getKeyText().isEmpty()) {
    297             result += " ";
     297            result += ' ';
    298298            if (canHtml) {
    299299                result += "<font size='-2'>";
    300300            }
    301             result += "("+sc.getKeyText()+")";
     301            result += '('+sc.getKeyText()+')';
    302302            if (canHtml) {
    303303                result += "</font>";
     
    323323    @Override
    324324    public String getOSDescription() {
    325         return System.getProperty("os.name") + " " + System.getProperty("os.version");
     325        return System.getProperty("os.name") + ' ' + System.getProperty("os.version");
    326326    }
    327327
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r8540 r8846  
    153153        result += name;
    154154        if (sc != null && !sc.getKeyText().isEmpty()) {
    155             result += " ";
     155            result += ' ';
    156156            result += "<font size='-2'>";
    157             result += "("+sc.getKeyText()+")";
     157            result += '('+sc.getKeyText()+')';
    158158            result += "</font>";
    159159        }
     
    210210                    String version = Utils.execOutput(Arrays.asList(args));
    211211                    if (version != null && !version.contains("not installed")) {
    212                         return packageName + ":" + version;
     212                        return packageName + ':' + version;
    213213                    }
    214214                }
     
    336336        @Override public String toString() {
    337337            return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField +
    338                     ", idField=" + idField + ", releaseField=" + releaseField + "]";
     338                    ", idField=" + idField + ", releaseField=" + releaseField + ']';
    339339        }
    340340
     
    372372                        // If no description has been found, try to rebuild it with "id" + "release" (i.e. "name" + "version")
    373373                        if (result == null && id != null && release != null) {
    374                             result = id + " " + release;
     374                            result = id + ' ' + release;
    375375                        }
    376376                    } catch (IOException e) {
     
    533533                        Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
    534534                    }
    535                     w.append(key + "=" + value + "\n");
     535                    w.append(key + '=' + value + '\n');
    536536                }
    537537                w.append('\n');
     
    540540                        continue;
    541541                    }
    542                     String key = "filename." + entry.name.replace(" ", "_");
     542                    String key = "filename." + entry.name.replace(' ', '_');
    543543                    String value = entry.file;
    544544                    String prevValue = props.getProperty(key);
     
    546546                        Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
    547547                    }
    548                     w.append(key + "=" + value + "\n");
     548                    w.append(key + '=' + value + '\n');
    549549                }
    550550                w.append('\n');
    551551                String fallback = props.getProperty("sequence.fallback");
    552552                if (fallback != null) {
    553                     w.append("sequence.fallback=" + fallback + "," + Utils.join(",", allCharSubsets) + "\n");
     553                    w.append("sequence.fallback=" + fallback + ',' + Utils.join(",", allCharSubsets) + '\n');
    554554                } else {
    555                     w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + "\n");
     555                    w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + '\n');
    556556                }
    557557            }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r8510 r8846  
    187187    @Override
    188188    public String getOSDescription() {
    189         return Utils.strip(System.getProperty("os.name")) + " " +
     189        return Utils.strip(System.getProperty("os.name")) + ' ' +
    190190                ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit";
    191191    }
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r8840 r8846  
    240240        String modifText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers());
    241241        if ("".equals(modifText)) return KeyEvent.getKeyText(keyStroke.getKeyCode());
    242         return modifText + "+" + KeyEvent.getKeyText(keyStroke.getKeyCode());
     242        return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode());
    243243    }
    244244
  • trunk/src/org/openstreetmap/josm/tools/TextTagParser.java

    r8840 r8846  
    258258            String value = entry.getValue();
    259259            if (key.length() > MAX_KEY_LENGTH) {
    260                 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+"="+value, "tags.paste.keytoolong");
     260                r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+'='+value, "tags.paste.keytoolong");
    261261                if (r == 2 || r == 3) return false; if (r == 4) return true;
    262262            }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8795 r8846  
    12081208            final List<String> lines = Arrays.asList(s.split("\\n"));
    12091209            if (lines.size() > maxLines) {
    1210                 return join("\n", lines.subList(0, maxLines - 1)) + "\n" + "...";
     1210                return join("\n", lines.subList(0, maxLines - 1)) + "\n...";
    12111211            } else {
    12121212                return s;
     
    13411341            String old = System.setProperty(key, value);
    13421342            if (!key.toLowerCase(Locale.ENGLISH).contains("password")) {
    1343                 Main.debug("System property '" + key + "' set to '" + value + "'. Old value was '" + old + "'");
     1343                Main.debug("System property '" + key + "' set to '" + value + "'. Old value was '" + old + '\'');
    13441344            } else {
    13451345                Main.debug("System property '" + key + "' changed.");
     
    13971397        String name = filename.toLowerCase(Locale.ENGLISH);
    13981398        for (String ext : extensions) {
    1399             if (name.endsWith("." + ext.toLowerCase(Locale.ENGLISH)))
     1399            if (name.endsWith('.' + ext.toLowerCase(Locale.ENGLISH)))
    14001400                return true;
    14011401        }
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r8510 r8846  
    144144                b += line.replaceAll("<img ", "<img border=\"0\" ")
    145145                         .replaceAll("<span class=\"icon\">.</span>", "")
    146                          .replaceAll("href=\"/", "href=\"" + baseurl + "/")
     146                         .replaceAll("href=\"/", "href=\"" + baseurl + '/')
    147147                         .replaceAll(" />", ">")
    148                          + "\n";
     148                         + '\n';
    149149            } else if (transl && line.contains("</div>")) {
    150150                transl = false;
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r8510 r8846  
    474474    @Override
    475475    public String toString() {
    476         return "WindowGeometry{topLeft="+topLeft+",extent="+extent+"}";
     476        return "WindowGeometry{topLeft="+topLeft+",extent="+extent+'}';
    477477    }
    478478}
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r8840 r8846  
    133133            if ("class".equals(fieldName) || "default".equals(fieldName) || "throw".equals(fieldName) ||
    134134                    "new".equals(fieldName) || "null".equals(fieldName)) {
    135                 fieldName += "_";
     135                fieldName += '_';
    136136            }
    137137            try {
  • trunk/src/org/openstreetmap/josm/tools/XmlParsingException.java

    r8375 r8846  
    6161            msg = getClass().getName();
    6262        }
    63         return msg + " " + tr("(at line {0}, column {1})", lineNumber, columnNumber);
     63        return msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber);
    6464    }
    6565
  • trunk/src/org/openstreetmap/josm/tools/template_engine/SearchExpressionCondition.java

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

    r8510 r8846  
    33
    44import java.util.Arrays;
    5 import java.util.List;
     5import java.util.HashSet;
     6import java.util.Set;
    67
    78public class Tokenizer {
     
    3637        @Override
    3738        public String toString() {
    38             return type + (text != null ? " " + text : "");
     39            return type + (text != null ? ' ' + text : "");
    3940        }
    4041    }
     
    4243    public enum TokenType { CONDITION_START, VARIABLE_START, CONTEXT_SWITCH_START, END, PIPE, APOSTROPHE, TEXT, EOF }
    4344
    44     private final List<Character> specialCharaters = Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'});
     45    private final Set<Character> specialCharaters = new HashSet<>(Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'}));
    4546
    4647    private final String template;
  • trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java

    r8404 r8846  
    5656    @Override
    5757    public String toString() {
    58         return "{" + variableName + "}";
     58        return '{' + variableName + '}';
    5959    }
    6060
Note: See TracChangeset for help on using the changeset viewer.