Changeset 2382 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2009-11-02T09:40:17+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2377 r2382 169 169 private String generator; 170 170 171 protected void fixLegacyVersion(Attributes atts) throws SAXException {172 if (ds.version.equals("0.6") && atts.getValue("version") == null) {173 throwException(174 tr("Mandatory attribute ''version'' missing for object with id {0}.", current.id)175 );176 } else if (ds.version.equals("0.5") && atts.getValue("version") == null) {177 // legacy mode. 0.5 data might not have version attribute. Init with178 // default value 1179 //180 current.version = 1;181 }182 }183 171 184 172 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { … … 227 215 current.latlon = new LatLon(getDouble(atts, "lat"), getDouble(atts, "lon")); 228 216 readCommon(atts, current); 229 fixLegacyVersion(atts);230 217 Node n = current.createNode(); 231 218 externalIdMap.put("n"+current.id, n); … … 233 220 current = new OsmPrimitiveData(); 234 221 readCommon(atts, current); 235 fixLegacyVersion(atts);236 222 Way w = current.createWay(); 237 223 externalIdMap.put("w"+current.id, w); … … 262 248 current = new OsmPrimitiveData(); 263 249 readCommon(atts, current); 264 fixLegacyVersion(atts);265 250 Relation r = current.createRelation(); 266 251 externalIdMap.put("r"+current.id, r ); … … 387 372 if (current.id > 0 && ds.version != null && ds.version.equals("0.6")) { 388 373 throwException(tr("Missing attribute ''version'' on OSM primitive with ID {0}.", Long.toString(current.id))); 374 } else if (current.id > 0 && ds.version != null && ds.version.equals("0.5")) { 375 // default version in 0.5 files for existing primitives 376 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 1, "0.5")); 377 current.version= 1; 378 } else if (current.id <= 0 && ds.version != null && ds.version.equals("0.5")) { 379 // default version in 0.5 files for new primitives 380 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 0, "0.5")); 381 current.version= 0; 389 382 } 390 383 }
Note:
See TracChangeset
for help on using the changeset viewer.