Changeset 7700 in josm for trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
- Timestamp:
- 2014-11-03T13:30:12+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r7299 r7700 76 76 throwException(tr("Missing mandatory attribute ''{0}''.", "id")); 77 77 } 78 int id = 0; 79 try { 80 id = Integer.parseInt(value); 81 } catch(NumberFormatException e) { 82 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "id", value)); 83 } 84 if (id <= 0) { 85 throwException(tr("Illegal numeric value for attribute ''{0}''. Got ''{1}''.", "id", id)); 86 } 87 current.setId(id); 78 current.setId(parseNumericAttribute(value, 1)); 88 79 89 80 // -- user … … 156 147 current.setMax(new LatLon(maxLon, maxLat)); 157 148 } 149 150 // -- comments_count 151 String commentsCount = atts.getValue("comments_count"); 152 if (commentsCount != null) { 153 current.setCommentsCount(parseNumericAttribute(commentsCount, 0)); 154 } 155 } 156 157 private int parseNumericAttribute(String value, int minAllowed) throws XmlParsingException { 158 int att = 0; 159 try { 160 att = Integer.parseInt(value); 161 } catch(NumberFormatException e) { 162 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "id", value)); 163 } 164 if (att < minAllowed) { 165 throwException(tr("Illegal numeric value for attribute ''{0}''. Got ''{1}''.", "id", att)); 166 } 167 return att; 158 168 } 159 169 … … 164 174 if (atts == null) { 165 175 throwException(tr("Missing mandatory attribute ''{0}'' of XML element {1}.", "version", "osm")); 176 return; 166 177 } 167 178 String v = atts.getValue("version");
Note:
See TracChangeset
for help on using the changeset viewer.