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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.