Changeset 34661 in osm


Ignore:
Timestamp:
2018-09-15T14:58:07+02:00 (6 years ago)
Author:
donvip
Message:

spotbugs - SBSC_USE_STRINGBUFFER_CONCATENATION

Location:
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java

    r34608 r34661  
    6161    @Override
    6262    public String[] getPatterns() {
    63         String pattern = "";
     63        StringBuilder pattern = new StringBuilder();
    6464        for (String ext : NetworkReader.FILE_AND_ARCHIVE_READERS.keySet()) {
    65             if (!pattern.isEmpty()) {
    66                 pattern += "|";
     65            if (pattern.length() > 0) {
     66                pattern.append('|');
    6767            }
    68             pattern += "."+ext;
     68            pattern.append('.').append(ext);
    6969        }
    7070        return new String[]{".*(" + pattern + ")"};
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/SimpleDataSetHandler.java

    r34646 r34661  
    160160    }
    161161
    162     protected String getOverpassApiQueries(String bbox, String ... conditions) {
     162    protected String getOverpassApiQueries(String bbox, String... conditions) {
    163163        String[] mpconditions = new String[conditions.length+1];
    164164        mpconditions[0] = OverpassApi.hasKey("type", "multipolygon");
     
    177177    @Override
    178178    protected String getOverpassApiRequest(String bbox) {
    179         String result = "";
     179        StringBuilder result = new StringBuilder();
    180180        if (this.relevantUnion) {
    181181            for (Tag tag : this.relevantTags) {
    182                 result += getOverpassApiQueries(bbox, OverpassApi.hasKey(tag.getKey(), tag.getValue()));
     182                result.append(getOverpassApiQueries(bbox, OverpassApi.hasKey(tag.getKey(), tag.getValue())));
    183183            }
    184184            result = OverpassApi.union(result);
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OverpassApi.java

    r33245 r34661  
    4343    }
    4444
    45     public static final String union(String... queries) {
    46         String result = "<union>\n";
    47         for (String query : queries) {
     45    public static final StringBuilder union(CharSequence... queries) {
     46        StringBuilder result = new StringBuilder("<union>\n");
     47        for (CharSequence query : queries) {
    4848            if (query != null) {
    49                 result += query + "\n";
     49                result.append(query).append('\n');
    5050            }
    5151        }
    52         result += "</union>";
     52        result.append("</union>");
    5353        return result;
    5454    }
    5555
    56     public static final String query(String bbox, OaQueryType type, String... conditions) {
    57         String result = "<query type=\""+type+"\" >\n";
     56    public static final StringBuilder query(String bbox, OaQueryType type, CharSequence... conditions) {
     57        StringBuilder result = new StringBuilder("<query type=\"").append(type).append("\" >\n");
    5858        if (bbox != null) {
    59             result += "<bbox-query "+bbox+"/>\n";
     59            result.append("<bbox-query ").append(bbox).append("/>\n");
    6060        }
    61         for (String condition : conditions) {
     61        for (CharSequence condition : conditions) {
    6262            if (condition != null) {
    63                 result += condition + "\n";
     63                result.append(condition).append('\n');
    6464            }
    6565        }
    66         result += "</query>";
     66        result.append("</query>");
    6767        return result;
    6868    }
Note: See TracChangeset for help on using the changeset viewer.