Ignore:
Timestamp:
2018-05-24T23:05:08+02:00 (6 years ago)
Author:
Don-vip
Message:

SonarQube - fix minor issues

Location:
trunk/src/org/openstreetmap/josm/io
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r13824 r13827  
    466466                }
    467467                if (tagEquals(QN_LAYER, reader.getName())) {
    468 
    469468                    parseLayer(reader, ret);
    470469                }
    471                 if (tagEquals(QN_EX_GEOGRAPHIC_BBOX, reader.getName())) {
    472                     if (ret.getBounds() == null) {
    473                         Bounds bbox = parseExGeographic(reader);
    474                         ret.setBounds(bbox);
    475                     }
    476 
     470                if (tagEquals(QN_EX_GEOGRAPHIC_BBOX, reader.getName()) && ret.getBounds() == null) {
     471                    ret.setBounds(parseExGeographic(reader));
    477472                }
    478473                if (tagEquals(QN_BOUNDINGBOX, reader.getName())) {
     
    484479                    }
    485480                    if (ret.getBounds() == null && conv != null) {
    486                         Bounds bbox = parseBoundingBox(reader, conv);
    487                         ret.setBounds(bbox);
     481                        ret.setBounds(parseBoundingBox(reader, conv));
    488482                    }
    489483                }
    490                 if (tagEquals(QN_LATLONBOUNDINGBOX, reader.getName()) && belowWMS130()) {
    491                     if (ret.getBounds() == null) {
    492                         Bounds bbox = parseBoundingBox(reader, null);
    493                         ret.setBounds(bbox);
    494                     }
     484                if (tagEquals(QN_LATLONBOUNDINGBOX, reader.getName()) && belowWMS130() && ret.getBounds() == null) {
     485                    ret.setBounds(parseBoundingBox(reader, null));
    495486                }
    496487            }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r12846 r13827  
    9494    protected void validateRequest() throws RequestHandlerBadRequestException {
    9595        allCoordinates.clear();
    96         for (String coordinatesString : (args != null ? args.get("way") : "").split(";\\s*")) {
     96        for (String coordinatesString : splitArg("way", SPLITTER_SEMIC)) {
    9797            String[] coordinates = coordinatesString.split(",\\s*", 2);
    9898            if (coordinates.length < 2) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r12636 r13827  
    9898    protected void validateRequest() throws RequestHandlerBadRequestException {
    9999        ps.clear();
    100         for (String i : (args != null ? args.get("objects") : "").split(",\\s*")) {
     100        for (String i : splitArg("objects", SPLITTER_COMMA)) {
    101101            if (!i.isEmpty()) {
    102102                try {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r13245 r13827  
    1414import java.util.Map;
    1515import java.util.Set;
     16import java.util.regex.Pattern;
    1617
    1718import javax.swing.JLabel;
     
    3637    public static final String loadInNewLayerKey = "remotecontrol.new-layer";
    3738    public static final boolean loadInNewLayerDefault = false;
     39
     40    protected static final Pattern SPLITTER_COMMA = Pattern.compile(",\\s*");
     41    protected static final Pattern SPLITTER_SEMIC = Pattern.compile(";\\s*");
    3842
    3943    /** past confirmations */
     
    215219    protected void parseArgs() throws URISyntaxException {
    216220        this.args = getRequestParameter(new URI(this.request));
     221    }
     222
     223    protected final String[] splitArg(String arg, Pattern splitter) {
     224        return splitter.split(args != null ? args.get(arg) : "");
    217225    }
    218226
Note: See TracChangeset for help on using the changeset viewer.