Ignore:
Timestamp:
2011-08-08T00:39:06+02:00 (8 years ago)
Author:
stoecker
Message:

fix #6364 - patch by simon04 - can't remove tag with preset (hopefully don't break anything with this patch)

File:
1 edited

Legend:

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

    r3910 r4302  
    66
    77import java.util.ArrayList;
     8import java.util.Arrays;
    89import java.util.Collection;
    910import java.util.Collections;
     
    4546        this.objects = new LinkedList<OsmPrimitive>();
    4647        this.key = key;
    47         this.value = value;
    48         if (value == null) {
     48        this.value = (value == null || value.isEmpty()) ? null : value;
     49        if (this.value == null) {
    4950            for (OsmPrimitive osm : objects) {
    5051                if(osm.get(key) != null) {
     
    5556            for (OsmPrimitive osm : objects) {
    5657                String val = osm.get(key);
    57                 if (val == null || !value.equals(val)) {
     58                if (val == null || !this.value.equals(val)) {
    5859                    this.objects.add(osm);
    5960                }
     
    6364
    6465    public ChangePropertyCommand(OsmPrimitive object, String key, String value) {
    65         this.objects = new LinkedList<OsmPrimitive>();
    66         this.key = key;
    67         this.value = value;
    68         String val = object.get(key);
    69         if ((value == null && val != null)
    70                 || (value != null && (val == null || !value.equals(val)))) {
    71             this.objects.add(object);
    72         }
     66        this(Arrays.asList(object), key, value);
    7367    }
    7468
Note: See TracChangeset for help on using the changeset viewer.