Ignore:
Timestamp:
2012-07-17T09:34:34+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7867, see #7505, see #7847 - Handle deleted nodes without coordinates in history

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java

    r5266 r5346  
    4444    private ChangesetDataSet data;
    4545
     46    // FIXME: this class has many similarities with OsmHistoryReader.Parser and should be merged
    4647    private class Parser extends DefaultHandler {
    4748
     
    103104        }
    104105
    105         protected Double getMandatoryAttributeDouble(Attributes attr, String name) throws SAXException{
     106        protected Double getAttributeDouble(Attributes attr, String name) throws SAXException{
    106107            String v = attr.getValue(name);
    107108            if (v == null) {
    108                 throwException(tr("Missing mandatory attribute ''{0}''.", name));
     109                return null;
    109110            }
    110111            double d = 0.0;
     
    112113                d = Double.parseDouble(v);
    113114            } catch(NumberFormatException e) {
    114                 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type double. Got ''{1}''.", name, v));
     115                throwException(tr("Illegal value for attribute ''{0}'' of type double. Got ''{1}''.", name, v));
    115116            }
    116117            return d;
     
    160161            HistoryOsmPrimitive primitive = null;
    161162            if (type.equals(OsmPrimitiveType.NODE)) {
    162                 double lat = getMandatoryAttributeDouble(atts, "lat");
    163                 double lon = getMandatoryAttributeDouble(atts, "lon");
     163                Double lat = getAttributeDouble(atts, "lat");
     164                Double lon = getAttributeDouble(atts, "lon");
     165                LatLon coor = (lat != null && lon != null) ? new LatLon(lat,lon) : null;
    164166                primitive = new HistoryNode(
    165                         id,version,visible,user,changesetId,timestamp, new LatLon(lat,lon)
     167                        id,version,visible,user,changesetId,timestamp,coor
    166168                );
    167169
Note: See TracChangeset for help on using the changeset viewer.