Ignore:
Timestamp:
2016-05-30T01:17:28+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - Performance - Method passes constant String of length 1 to character overridden method + add unit tests/javadoc

Location:
trunk/src/org/openstreetmap/josm/data
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r10299 r10300  
    171171        while (true) {
    172172            String filename = String.format("%1$s_%2$tY%2$tm%2$td_%2$tH%2$tM%2$tS%2$tL%3$s",
    173                     layer.layerFileName, now, index == 0 ? "" : ("_" + index));
     173                    layer.layerFileName, now, index == 0 ? "" : ('_' + Integer.toString(index)));
    174174            File result = new File(autosaveDir, filename + '.' + Main.pref.get("autosave.extension", "osm"));
    175175            try {
  • trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java

    r9419 r10300  
    106106    @Override
    107107    public String toString() {
    108         return "ProjectionBounds["+minEast+","+minNorth+","+maxEast+","+maxNorth+']';
     108        return "ProjectionBounds["+minEast+','+minNorth+','+maxEast+','+maxNorth+']';
    109109    }
    110110
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r9407 r10300  
    191191            s += " SVN";
    192192        }
    193         String result = "JOSM/1.5 ("+ s+' '+LanguageInfo.getJOSMLocaleCode()+")";
     193        String result = "JOSM/1.5 ("+ s+' '+LanguageInfo.getJOSMLocaleCode()+')';
    194194        if (includeOsDetails && Main.platform != null) {
    195195            result += ' ' + Main.platform.getOSDescription();
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r10212 r10300  
    863863    public String getExtendedUrl() {
    864864        return imageryType.getTypeString() + (defaultMaxZoom != 0
    865             ? "["+(defaultMinZoom != 0 ? Integer.toString(defaultMinZoom) + ',' : "")+defaultMaxZoom+"]" : "") + ':' + url;
     865            ? ('['+(defaultMinZoom != 0 ? (Integer.toString(defaultMinZoom) + ',') : "")+defaultMaxZoom+"]") : "") + ':' + url;
    866866    }
    867867
  • trunk/src/org/openstreetmap/josm/data/notes/Note.java

    r10134 r10300  
    148148    @Override
    149149    public String toString() {
    150         return tr("Note") + " " + id + ": " + getFirstComment();
     150        return tr("Note") + ' ' + id + ": " + getFirstComment();
    151151    }
    152152}
  • trunk/src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java

    r9371 r10300  
    5757    @Override
    5858    public String toString() {
    59         return type + " " + id;
     59        return type.toString() + ' ' + id;
    6060    }
    6161
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r10298 r10300  
    18151815                case '\uFF0E': // fullwidth full stop
    18161816                case '\uFF61': // halfwidth ideographic full stop
    1817                     return ascii + "."; // restore the missing stop
     1817                    return ascii + '.'; // restore the missing stop
    18181818                default:
    18191819                    return ascii;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java

    r8680 r10300  
    104104            // <restriction-value> @ <condition>[;<restriction-value> @ <condition>]
    105105            final List<ConditionalValue> r = new ArrayList<>();
    106             final Pattern part = Pattern.compile("([^@\\p{Space}][^@]*?)"
    107                     + "\\s*@\\s*" + "(\\([^)\\p{Space}][^)]+?\\)|[^();\\p{Space}][^();]*?)\\s*");
    108             final Matcher m = Pattern.compile("(" + part + ")(;\\s*" + part + ")*").matcher(value);
     106            final String part = Pattern.compile("([^@\\p{Space}][^@]*?)"
     107                    + "\\s*@\\s*" + "(\\([^)\\p{Space}][^)]+?\\)|[^();\\p{Space}][^();]*?)\\s*").toString();
     108            final Matcher m = Pattern.compile('(' + part + ")(;\\s*" + part + ")*").matcher(value);
    109109            if (!m.matches()) {
    110110                throw new ConditionalParsingException(tr("Does not match pattern ''restriction value @ condition''"));
Note: See TracChangeset for help on using the changeset viewer.