Ticket #2312: string_intern.patch
| File string_intern.patch, 1.3 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/io/OsmReader.java
141 139 */ 142 140 private OsmPrimitive current; 143 141 private String generator; 142 private Map<String, String> keys = new HashMap<String, String>(); 144 143 // int n = 0; 145 144 146 145 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { … … 256 255 257 256 } else if (qName.equals("tag")) { 258 257 // tagsN++; 259 current.put(atts.getValue("k"), atts.getValue("v")); 258 String key = atts.getValue("k"); 259 String internedKey = keys.get(key); 260 if (internedKey == null) { 261 internedKey = key; 262 keys.put(key, key); 263 } 264 current.put(internedKey, atts.getValue("v")); 260 265 } 261 266 } catch (NumberFormatException x) { 262 267 x.printStackTrace(); // SAXException does not chain correctly
