Ignore:
Timestamp:
2016-05-15T14:48:06+02:00 (5 years ago)
Author:
Don-vip
Message:

findbugs - SF_SWITCH_NO_DEFAULT + various sonar fixes

Location:
trunk/src/org/openstreetmap/josm/command
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangeCommand.java

    r9371 r10216  
    7676    @Override
    7777    public String getDescriptionText() {
    78         String msg = "";
     78        String msg;
    7979        switch(OsmPrimitiveType.from(osm)) {
    8080        case NODE: msg = marktr("Change node {0}"); break;
    8181        case WAY: msg = marktr("Change way {0}"); break;
    8282        case RELATION: msg = marktr("Change relation {0}"); break;
     83        default: throw new AssertionError();
    8384        }
    8485        return tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance()));
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r9371 r10216  
    161161                case WAY: msg = marktr("Remove \"{0}\" for way ''{1}''"); break;
    162162                case RELATION: msg = marktr("Remove \"{0}\" for relation ''{1}''"); break;
     163                default: throw new AssertionError();
    163164                }
    164165                text = tr(msg, entry.getKey(), primitive.getDisplayName(DefaultNameFormatter.getInstance()));
     
    168169                case WAY: msg = marktr("Set {0}={1} for way ''{2}''"); break;
    169170                case RELATION: msg = marktr("Set {0}={1} for relation ''{2}''"); break;
     171                default: throw new AssertionError();
    170172                }
    171173                text = tr(msg, entry.getKey(), entry.getValue(), primitive.getDisplayName(DefaultNameFormatter.getInstance()));
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r10174 r10216  
    160160    }
    161161
    162     private Set<OsmPrimitiveType> getTypesToDelete() {
    163         Set<OsmPrimitiveType> typesToDelete = EnumSet.noneOf(OsmPrimitiveType.class);
     162    private EnumSet<OsmPrimitiveType> getTypesToDelete() {
     163        EnumSet<OsmPrimitiveType> typesToDelete = EnumSet.noneOf(OsmPrimitiveType.class);
    164164        for (OsmPrimitive osm : toDelete) {
    165165            typesToDelete.add(OsmPrimitiveType.from(osm));
     
    172172        if (toDelete.size() == 1) {
    173173            OsmPrimitive primitive = toDelete.iterator().next();
    174             String msg = "";
     174            String msg;
    175175            switch(OsmPrimitiveType.from(primitive)) {
    176176            case NODE: msg = marktr("Delete node {0}"); break;
    177177            case WAY: msg = marktr("Delete way {0}"); break;
    178178            case RELATION:msg = marktr("Delete relation {0}"); break;
     179            default: throw new AssertionError();
    179180            }
    180181
     
    182183        } else {
    183184            Set<OsmPrimitiveType> typesToDelete = getTypesToDelete();
    184             String msg = "";
     185            String msg;
    185186            if (typesToDelete.size() > 1) {
    186187                msg = trn("Delete {0} object", "Delete {0} objects", toDelete.size(), toDelete.size());
     
    191192                case WAY: msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size()); break;
    192193                case RELATION: msg = trn("Delete {0} relation", "Delete {0} relations", toDelete.size(), toDelete.size()); break;
     194                default: throw new AssertionError();
    193195                }
    194196            }
  • trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java

    r9371 r10216  
    1717/**
    1818 * Represents the resolution of a conflict between the modified flag of two {@link OsmPrimitive}s.
    19  *
    20  *
     19 * @since 2624
    2120 */
    2221public class ModifiedConflictResolveCommand extends ConflictResolveCommand {
     
    3534    @Override
    3635    public String getDescriptionText() {
    37         String msg = "";
     36        String msg;
    3837        switch(OsmPrimitiveType.from(conflict.getMy())) {
    3938        case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
    4039        case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
    4140        case RELATION: msg = marktr("Set the ''modified'' flag for relation {0}"); break;
     41        default: throw new AssertionError();
    4242        }
    4343        return tr(msg, conflict.getMy().getId());
  • trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java

    r9371 r10216  
    1717/**
    1818 * Represents the resolution of a version conflict between two {@link OsmPrimitive}s.
    19  *
    20  *
     19 * @since 1622
    2120 */
    2221public class VersionConflictResolveCommand extends ConflictResolveCommand {
     
    3534    @Override
    3635    public String getDescriptionText() {
    37         String msg = "";
     36        String msg;
    3837        switch(OsmPrimitiveType.from(conflict.getMy())) {
    3938        case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
    4039        case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
    4140        case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break;
     41        default: throw new AssertionError();
    4242        }
    4343        return tr(msg, conflict.getMy().getId());
Note: See TracChangeset for help on using the changeset viewer.