Ignore:
Timestamp:
2013-11-05T01:53:15+01:00 (10 years ago)
Author:
Don-vip
Message:

Sonar/Findbugs - fix of recent violations

File:
1 edited

Legend:

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

    r6302 r6365  
    1818
    1919/**
    20  * Command that basically replaces one OSM primitive by another of the
    21  * same type.
     20 * Command that basically replaces one OSM primitive by another of the same type.
    2221 *
    23  * @author Imi
     22 * @since 93
    2423 */
    2524public class ChangeCommand extends Command {
     
    4544        CheckParameterUtil.ensureParameterNotNull(osm, "osm");
    4645        CheckParameterUtil.ensureParameterNotNull(newOsm, "newOsm");
    47         if (newOsm instanceof Way) {
     46        if (newOsm instanceof Way && ((Way)newOsm).getNodesCount() == 0) {
    4847            // Do not allow to create empty ways (see #7465)
    49             if (((Way)newOsm).getNodesCount() == 0) {
    50                 throw new IllegalArgumentException(tr("New way {0} has 0 nodes", newOsm));
    51             }
     48            throw new IllegalArgumentException(tr("New way {0} has 0 nodes", newOsm));
    5249        }
    5350    }
    5451
    55     @Override public boolean executeCommand() {
     52    @Override
     53    public boolean executeCommand() {
    5654        super.executeCommand();
    5755        osm.cloneFrom(newOsm);
     
    6058    }
    6159
    62     @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
     60    @Override
     61    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    6362        modified.add(osm);
    6463    }
Note: See TracChangeset for help on using the changeset viewer.