Changeset 2333 in josm for trunk/src


Ignore:
Timestamp:
2009-10-27T19:03:58+01:00 (14 years ago)
Author:
Gubaer
Message:

fixed #3753: Merging the ends of two node ways produces corrupt way

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r2323 r2333  
    197197            }
    198198        }
    199         cmds.add(new DeleteCommand(waysToDelete));
     199        if (!waysToDelete.isEmpty()) {
     200            cmds.add(new DeleteCommand(waysToDelete));
     201        }
    200202        return cmds;
    201203    }
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r2323 r2333  
    5151     * Constructor. Deletes a collection of primitives in the current edit layer.
    5252     *
    53      * @param data the primitives to delete
    54      */
    55     public DeleteCommand(Collection<? extends OsmPrimitive> data) {
    56         if (data == null) {
    57             data = Collections.emptyList();
    58         }
     53     * @param data the primitives to delete. Must neither be null nor empty.
     54     * @throws IllegalArgumentException thrown if data is null or empty
     55     */
     56    public DeleteCommand(Collection<? extends OsmPrimitive> data) throws IllegalArgumentException {
     57        if (data == null)
     58            throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be empty"));
     59        if (data.isEmpty())
     60            throw new IllegalArgumentException(tr("At least one object to delete requird, got empty collection"));           
    5961        this.toDelete = data;
    6062    }
     
    9395     *
    9496     * @param layer the layer context for deleting these primitives. Must not be null.
    95      * @param data the primitives to delete
     97     * @param data the primitives to delete. Must neither be null nor empty.
    9698     * @throws IllegalArgumentException thrown if layer is null
     99     * @throws IllegalArgumentException thrown if data is null or empty
    97100     */
    98101    public DeleteCommand(OsmDataLayer layer, Collection<? extends OsmPrimitive> data) throws IllegalArgumentException{
    99102        super(layer);
    100         if (data == null) {
    101             data = Collections.emptyList();
    102         }
     103        if (data == null)
     104            throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be empty"));
     105        if (data.isEmpty())
     106            throw new IllegalArgumentException(tr("At least one object to delete requird, got empty collection"));           
    103107        this.toDelete = data;
    104108    }
Note: See TracChangeset for help on using the changeset viewer.