Changeset 28503 in osm for applications/editors/josm/plugins/reverter
- Timestamp:
- 2012-07-22T23:15:18+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/src/reverter/corehacks/OsmChangesetContentParser.java
r27393 r28503 87 87 return l; 88 88 } 89 89 /* 90 90 protected long getAttributeLong(Attributes attr, String name, long defaultValue) throws SAXException{ 91 91 String v = attr.getValue(name); … … 96 96 l = Long.parseLong(v); 97 97 } catch(NumberFormatException e) { 98 throwException(tr("Illegal value for mandatoryattribute ''{0}'' of type long. Got ''{1}''.", name, v));98 throwException(tr("Illegal value for attribute ''{0}'' of type long. Got ''{1}''.", name, v)); 99 99 } 100 100 if (l < 0) { 101 throwException(tr("Illegal value for mandatoryattribute ''{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)); 102 102 } 103 103 return l; 104 104 } 105 106 protected Double get MandatoryAttributeDouble(Attributes attr, String name) throws SAXException{105 */ 106 protected Double getAttributeDouble(Attributes attr, String name) throws SAXException{ 107 107 String v = attr.getValue(name); 108 108 if (v == null) { 109 throwException(tr("Missing mandatory attribute ''{0}''.", name));109 return null; 110 110 } 111 111 double d = 0.0; … … 113 113 d = Double.parseDouble(v); 114 114 } catch(NumberFormatException e) { 115 throwException(tr("Illegal value for mandatoryattribute ''{0}'' of type double. Got ''{1}''.", name, v));115 throwException(tr("Illegal value for attribute ''{0}'' of type double. Got ''{1}''.", name, v)); 116 116 } 117 117 return d; … … 125 125 return v; 126 126 } 127 127 /* 128 128 protected String getAttributeString(Attributes attr, String name, String defaultValue) { 129 129 String v = attr.getValue(name); … … 132 132 return v; 133 133 } 134 134 */ 135 135 protected boolean getMandatoryAttributeBoolean(Attributes attr, String name) throws SAXException{ 136 136 String v = attr.getValue(name); … … 156 156 // TODO: Update OsmChangesetContentParser from the core or update core OsmChangesetContentParser to make it usable with reverter 157 157 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; 160 161 primitive = new HistoryNode( 161 id,version,visible,User.getAnonymous(),changesetId,timestamp, new LatLon(lat,lon)162 id,version,visible,User.getAnonymous(),changesetId,timestamp, coor 162 163 ); 163 164
Note:
See TracChangeset
for help on using the changeset viewer.