Changeset 28503 in osm for applications/editors


Ignore:
Timestamp:
2012-07-22T23:15:18+02:00 (12 years ago)
Author:
donvip
Message:

[josm_reverter] fix #josm7845 - reverter plugin broken

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reverter/src/reverter/corehacks/OsmChangesetContentParser.java

    r27393 r28503  
    8787            return l;
    8888        }
    89 
     89/*
    9090        protected long getAttributeLong(Attributes attr, String name, long defaultValue) throws SAXException{
    9191            String v = attr.getValue(name);
     
    9696                l = Long.parseLong(v);
    9797            } catch(NumberFormatException e) {
    98                 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type long. Got ''{1}''.", name, v));
     98                throwException(tr("Illegal value for attribute ''{0}'' of type long. Got ''{1}''.", name, v));
    9999            }
    100100            if (l < 0) {
    101                 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type long (>=0). Got ''{1}''.", name, v));
     101                throwException(tr("Illegal value for attribute ''{0}'' of type long (>=0). Got ''{1}''.", name, v));
    102102            }
    103103            return l;
    104104        }
    105 
    106         protected Double getMandatoryAttributeDouble(Attributes attr, String name) throws SAXException{
     105*/
     106        protected Double getAttributeDouble(Attributes attr, String name) throws SAXException{
    107107            String v = attr.getValue(name);
    108108            if (v == null) {
    109                 throwException(tr("Missing mandatory attribute ''{0}''.", name));
     109                return null;
    110110            }
    111111            double d = 0.0;
     
    113113                d = Double.parseDouble(v);
    114114            } catch(NumberFormatException e) {
    115                 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));
    116116            }
    117117            return d;
     
    125125            return v;
    126126        }
    127 
     127/*
    128128        protected String getAttributeString(Attributes attr, String name, String defaultValue) {
    129129            String v = attr.getValue(name);
     
    132132            return v;
    133133        }
    134 
     134*/
    135135        protected boolean getMandatoryAttributeBoolean(Attributes attr, String name) throws SAXException{
    136136            String v = attr.getValue(name);
     
    156156            // TODO: Update OsmChangesetContentParser from the core or update core OsmChangesetContentParser to make it usable with reverter
    157157            if (type.equals(OsmPrimitiveType.NODE)) {
    158                 double lat = getMandatoryAttributeDouble(atts, "lat");
    159                 double lon = getMandatoryAttributeDouble(atts, "lon");
     158                Double lat = getAttributeDouble(atts, "lat");
     159                Double lon = getAttributeDouble(atts, "lon");
     160                LatLon coor = (lat != null && lon != null) ? new LatLon(lat,lon) : null;
    160161                primitive = new HistoryNode(
    161                         id,version,visible,User.getAnonymous(),changesetId,timestamp, new LatLon(lat,lon)
     162                        id,version,visible,User.getAnonymous(),changesetId,timestamp, coor
    162163                );
    163164
Note: See TracChangeset for help on using the changeset viewer.