Changeset 11191 in josm


Ignore:
Timestamp:
2016-10-30T00:38:36+02:00 (3 years ago)
Author:
Don-vip
Message:

sonar - fix some recent warnings

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

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

    r11135 r11191  
    7575        private Supplier<Command> fixingCommand;
    7676
    77         private Builder(Test tester, Severity severity, int code) {
     77        Builder(Test tester, Severity severity, int code) {
    7878            this.tester = tester;
    7979            this.severity = severity;
     
    239239    }
    240240
    241     private TestError(Builder builder) {
     241    TestError(Builder builder) {
    242242        this.tester = builder.tester;
    243243        this.severity = builder.severity;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r11155 r11191  
    195195        @Override
    196196        boolean ignoreWaySegmentCombination(Way w1, Way w2) {
    197             return (w1 != w2); // should not happen
     197            return w1 != w2; // should not happen
    198198        }
    199199
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r11178 r11191  
    489489        if (testError.getCode() == REPEATED_MEMBER_SAME_ROLE) {
    490490            ArrayList<OsmPrimitive> primitives = new ArrayList<>(testError.getPrimitives());
    491             if (primitives.size() >= 2) {
    492                 if (primitives.get(0) instanceof Relation) {
    493                     Relation oldRel = (Relation) primitives.get(0);
    494                     Relation newRel = new Relation(oldRel);
    495                     List<OsmPrimitive> repeatedPrims = primitives.subList(1, primitives.size());
    496                     List<RelationMember> oldMembers = oldRel.getMembers();
    497 
    498                     List<RelationMember> newMembers = new ArrayList<>();
    499                     HashSet<OsmPrimitive> toRemove = new HashSet<>(repeatedPrims);
    500                     HashSet<OsmPrimitive> found = new HashSet<>(repeatedPrims.size());
    501                     for (RelationMember rm : oldMembers) {
    502                         if (toRemove.contains(rm.getMember())) {
    503                             if (!found.contains(rm.getMember())) {
    504                                 found.add(rm.getMember());
    505                                 newMembers.add(rm);
    506                             }
    507                         } else {
     491            if (primitives.size() >= 2 && primitives.get(0) instanceof Relation) {
     492                Relation oldRel = (Relation) primitives.get(0);
     493                Relation newRel = new Relation(oldRel);
     494                List<OsmPrimitive> repeatedPrims = primitives.subList(1, primitives.size());
     495                List<RelationMember> oldMembers = oldRel.getMembers();
     496
     497                List<RelationMember> newMembers = new ArrayList<>();
     498                HashSet<OsmPrimitive> toRemove = new HashSet<>(repeatedPrims);
     499                HashSet<OsmPrimitive> found = new HashSet<>(repeatedPrims.size());
     500                for (RelationMember rm : oldMembers) {
     501                    if (toRemove.contains(rm.getMember())) {
     502                        if (!found.contains(rm.getMember())) {
     503                            found.add(rm.getMember());
    508504                            newMembers.add(rm);
    509505                        }
     506                    } else {
     507                        newMembers.add(rm);
    510508                    }
    511                     newRel.setMembers(newMembers);
    512                     return new ChangeCommand(oldRel, newRel);
    513                 }
     509                }
     510                newRel.setMembers(newMembers);
     511                return new ChangeCommand(oldRel, newRel);
    514512            }
    515513        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java

    r11131 r11191  
    6767
    6868        p.getKeys().forEach((key, n) -> {
    69             if (key.startsWith("name:") && !"name:etymology:wikidata".equals(key)) {
    70                 if (n != null) {
    71                     names.add(n);
    72                 }
     69            if (n != null && key.startsWith("name:") && !"name:etymology:wikidata".equals(key)) {
     70                names.add(n);
    7371            }
    7472        });
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r11166 r11191  
    135135                geomObj.add("coordinates", multiPolygon);
    136136            } catch (MultipolygonBuilder.JoinedPolygonCreationException ex) {
    137                 Main.warn("GeoJSON: Failed to export multipolygon " + r.getUniqueId());
     137                Main.warn("GeoJSON: Failed to export multipolygon {0}", r.getUniqueId());
    138138                Main.warn(ex);
    139139            }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r11162 r11191  
    407407        Path templateFile = FileSystems.getDefault().getPath(javaLibPath, templateFileName);
    408408        if (!Files.isReadable(templateFile)) {
    409             Main.warn("extended font config - unable to find font config template file "+templateFile.toString());
     409            Main.warn("extended font config - unable to find font config template file {0}", templateFile.toString());
    410410            return;
    411411        }
Note: See TracChangeset for help on using the changeset viewer.