Ticket #7504: 7504.patch

File 7504.patch, 1.5 KB (added by xeen, 13 years ago)

Appears you are right and the additional modified work is superfluous. Suggested patch.

  • src/org/openstreetmap/josm/command/ChangePropertyCommand.java

     
    113113            super.executeCommand(); // save old
    114114
    115115            for (OsmPrimitive osm : objects) {
    116                 boolean modified = false;
    117 
    118                  // loop over all tags
     116                // loop over all tags
    119117                for (Map.Entry<String, String> tag : this.tags.entrySet()) {
    120118                    String oldVal = osm.get(tag.getKey());
    121119                    String newVal = tag.getValue();
    122120
    123121                    if (newVal == null || newVal.isEmpty()) {
    124                         if (oldVal != null) {
     122                        if (oldVal != null)
    125123                            osm.remove(tag.getKey());
    126                             modified = true;
    127                         }
    128124                    }
    129125                    else if (oldVal == null || !newVal.equals(oldVal))
    130126                        osm.put(tag.getKey(), newVal);
    131                         modified = true;
    132127                }
    133                 if (modified)
    134                     osm.setModified(true);
     128                // init() only keeps modified primitives. Therefore the modified
     129                // bit can be set without further checks.
     130                osm.setModified(true);
    135131            }
    136132            return true;
    137133        }