Changeset 5767 in josm for trunk/src/org
- Timestamp:
- 2013-03-09T09:45:55+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r5623 r5767 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 import java.util.HashMap; 8 9 import java.util.LinkedList; 9 10 import java.util.List; 10 import java.util.HashMap;11 11 import java.util.Map; 12 12 import java.util.Map.Entry; … … 73 73 @Override 74 74 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { 75 boolean changed = false;76 for (Entry<String, String> e : keys.entrySet()) {75 Map<String, String> newKeys = new HashMap<String, String>(keys); 76 for (Entry<String, String> e : keys.entrySet()) { 77 77 String v = e.getValue().trim(); 78 78 String k = e.getKey().trim(); 79 79 if(!e.getKey().equals(k)) { 80 changed = true;81 80 boolean drop = k.isEmpty() || v.isEmpty(); 82 81 if(drop || !keys.containsKey(k)) { 83 keys.remove(e.getKey());82 newKeys.remove(e.getKey()); 84 83 if(!drop) 85 keys.put(k, v);84 newKeys.put(k, v); 86 85 } 87 86 } else if(!e.getValue().equals(v)) { 88 87 if(v.isEmpty()) 89 keys.remove(k);88 newKeys.remove(k); 90 89 else 91 keys.put(k, v); 92 changed = true; 90 newKeys.put(k, v); 93 91 } 92 } 93 boolean changed = !keys.equals(newKeys); 94 if (changed) { 95 keys.clear(); 96 keys.putAll(newKeys); 94 97 } 95 98 return changed; … … 180 183 Collection<Command> cmds = new LinkedList<Command>(); 181 184 182 boolean needsChange = false;183 185 for (OsmPrimitive osm : objectsToUpload) { 184 186 Map<String, String> keys = osm.getKeys();
Note:
See TracChangeset
for help on using the changeset viewer.