Changeset 8178 in josm


Ignore:
Timestamp:
2015-04-09T19:55:39+02:00 (9 years ago)
Author:
stoecker
Message:

see #10329 - fix wrong upload fix and remove wrong old keys when new key has same value

File:
1 edited

Legend:

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

    r7937 r8178  
    8383                if(!e.getKey().equals(k)) {
    8484                    if(drop || !keys.containsKey(k)) {
    85                         newKeys.remove(e.getKey());
     85                        newKeys.put(e.getKey(), null);
    8686                        if(!drop)
    8787                            newKeys.put(k, v);
    8888                    }
    8989                } else if(!e.getValue().equals(v)) {
    90                     if(v.isEmpty())
    91                         newKeys.remove(k);
    92                     else
    93                         newKeys.put(k, v);
     90                    newKeys.put(k, v.isEmpty() ? null : v);
    9491                } else if (drop) {
    95                     newKeys.remove(e.getKey());
     92                    newKeys.put(e.getKey(), null);
    9693                }
    9794            }
     
    129126            if(keys.containsKey(oldKey) && !keys.containsKey(newKey)) {
    130127                keys.put(newKey, keys.get(oldKey));
    131                 keys.remove(oldKey);
     128                keys.put(oldKey, null);
     129                return true;
     130            } else if(keys.containsKey(oldKey) && keys.containsKey(newKey) && keys.get(oldKey).equals(keys.get(newKey))) {
     131                keys.put(oldKey, null);
    132132                return true;
    133133            }
     
    169169                keys.put(newKey, newValue);
    170170                if(!newKey.equals(oldKey))
    171                     keys.remove(oldKey);
     171                    keys.put(oldKey, null);
    172172                return true;
    173173            }
     
    189189
    190190        for (OsmPrimitive osm : objectsToUpload) {
    191             Map<String, String> keys = osm.getKeys();
     191            HashMap<String, String> keys = new HashMap<>(osm.getKeys());
    192192            if(!keys.isEmpty()) {
    193193                boolean modified = false;
     
    197197                }
    198198                if(modified)
    199                     cmds.add(new ChangePropertyCommand(Collections.singleton(osm), new HashMap<>(keys)));
     199                    cmds.add(new ChangePropertyCommand(Collections.singleton(osm), keys));
    200200            }
    201201        }
Note: See TracChangeset for help on using the changeset viewer.