Changeset 9969 in josm


Ignore:
Timestamp:
2016-03-12T19:32:42+01:00 (4 years ago)
Author:
Don-vip
Message:

sonar - Avoid appending characters as strings in StringBuffer.append + add unit test

Location:
trunk
Files:
1 added
4 edited

Legend:

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

    r9649 r9969  
    234234        for (java.util.Map.Entry<String, String> e : entrySet()) {
    235235            if (!first) {
    236                 stringBuilder.append(",");
     236                stringBuilder.append(',');
    237237            }
    238238            stringBuilder.append(e.getKey());
    239             stringBuilder.append("=");
     239            stringBuilder.append('=');
    240240            stringBuilder.append(e.getValue());
    241241            first = false;
    242242        }
    243         stringBuilder.append("]");
     243        stringBuilder.append(']');
    244244        return stringBuilder.toString();
    245245    }
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferable.java

    r9891 r9969  
    7878        final StringBuilder sb = new StringBuilder();
    7979        for (OsmPrimitive primitive : primitives) {
    80             sb.append(primitive.getType());
    81             sb.append(" ").append(primitive.getUniqueId());
    82             sb.append(" # ").append(primitive.getDisplayName(DefaultNameFormatter.getInstance()));
    83             sb.append("\n");
     80            sb.append(primitive.getType())
     81              .append(' ').append(primitive.getUniqueId())
     82              .append(" # ").append(primitive.getDisplayName(DefaultNameFormatter.getInstance()))
     83              .append('\n');
    8484        }
    8585        return sb.toString().replace("\u200E", "").replace("\u200F", "");
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferable.java

    r9891 r9969  
    7878        final StringBuilder sb = new StringBuilder();
    7979        for (RelationMember member : members) {
    80             sb.append(member.getType());
    81             sb.append(" ").append(member.getUniqueId());
    82             sb.append(" ").append(member.getRole());
    83             sb.append(" # ").append(member.getMember().getDisplayName(DefaultNameFormatter.getInstance()));
    84             sb.append("\n");
     80            sb.append(member.getType())
     81              .append(' ').append(member.getUniqueId())
     82              .append(' ').append(member.getRole())
     83              .append(" # ").append(member.getMember().getDisplayName(DefaultNameFormatter.getInstance()))
     84              .append('\n');
    8585        }
    8686        return sb.toString().replace("\u200E", "").replace("\u200F", "");
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r9940 r9969  
    14011401            String token = new StringBuilder(t).append(val).toString();
    14021402            if (consideredTokens.add(token)) {
    1403                 s.append(sep).append('(').append(t).append(SearchCompiler.buildSearchStringForTag(key, val)).append(")");
     1403                s.append(sep).append('(').append(t).append(SearchCompiler.buildSearchStringForTag(key, val)).append(')');
    14041404                sep = " OR ";
    14051405            }
Note: See TracChangeset for help on using the changeset viewer.