Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/io/AbstractParser.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/AbstractParser.java
r8390 r8510 47 47 try { 48 48 l = Long.parseLong(v); 49 } catch(NumberFormatException e) { 49 } catch (NumberFormatException e) { 50 50 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type long. Got ''{1}''.", name, v), e); 51 51 } … … 63 63 try { 64 64 l = Long.valueOf(v); 65 } catch(NumberFormatException e) { 65 } catch (NumberFormatException e) { 66 66 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type long. Got ''{1}''.", name, v), e); 67 67 } … … 80 80 try { 81 81 d = Double.parseDouble(v); 82 } catch(NumberFormatException e) { 82 } catch (NumberFormatException e) { 83 83 throwException(tr("Illegal value for attribute ''{0}'' of type double. Got ''{1}''.", name, v), e); 84 84 } … … 106 106 107 107 protected final HistoryOsmPrimitive createPrimitive(Attributes atts, OsmPrimitiveType type) throws SAXException { 108 long id = getMandatoryAttributeLong(atts,"id"); 109 long version = getMandatoryAttributeLong(atts,"version"); 110 long changesetId = getMandatoryAttributeLong(atts,"changeset"); 111 boolean visible= getMandatoryAttributeBoolean(atts, "visible"); 108 long id = getMandatoryAttributeLong(atts, "id"); 109 long version = getMandatoryAttributeLong(atts, "version"); 110 long changesetId = getMandatoryAttributeLong(atts, "changeset"); 111 boolean visible = getMandatoryAttributeBoolean(atts, "visible"); 112 112 113 113 Long uid = getAttributeLong(atts, "uid"); … … 130 130 Double lat = getAttributeDouble(atts, "lat"); 131 131 Double lon = getAttributeDouble(atts, "lon"); 132 LatLon coor = (lat != null && lon != null) ? new LatLon(lat,lon) : null; 133 primitive = new HistoryNode( 134 id,version,visible,user,changesetId,timestamp,coor 135 ); 132 LatLon coor = (lat != null && lon != null) ? new LatLon(lat, lon) : null; 133 primitive = new HistoryNode(id, version, visible, user, changesetId, timestamp, coor); 136 134 137 135 } else if (type.equals(OsmPrimitiveType.WAY)) { 138 primitive = new HistoryWay( 139 id,version,visible,user,changesetId,timestamp 140 ); 136 primitive = new HistoryWay(id, version, visible, user, changesetId, timestamp); 141 137 } else if (type.equals(OsmPrimitiveType.RELATION)) { 142 primitive = new HistoryRelation( 143 id,version,visible,user,changesetId,timestamp 144 ); 138 primitive = new HistoryRelation(id, version, visible, user, changesetId, timestamp); 145 139 } 146 140 return primitive; … … 162 156 String key = getMandatoryAttributeString(atts, "k"); 163 157 String value = getMandatoryAttributeString(atts, "v"); 164 currentPrimitive.put(key,value); 158 currentPrimitive.put(key, value); 165 159 } 166 160 167 161 protected final void handleNodeReference(Attributes atts) throws SAXException { 168 162 long ref = getMandatoryAttributeLong(atts, "ref"); 169 ((HistoryWay)currentPrimitive).addNode(ref); 163 ((HistoryWay) currentPrimitive).addNode(ref); 170 164 } 171 165 … … 176 170 try { 177 171 type = OsmPrimitiveType.fromApiTypeName(v); 178 } catch(IllegalArgumentException e) { 172 } catch (IllegalArgumentException e) { 179 173 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type OsmPrimitiveType. Got ''{1}''.", "type", v), e); 180 174 } 181 175 String role = getMandatoryAttributeString(atts, "role"); 182 RelationMemberData member = new RelationMemberData(role, type,ref); 183 ((HistoryRelation)currentPrimitive).addMember(member); 176 RelationMemberData member = new RelationMemberData(role, type, ref); 177 ((HistoryRelation) currentPrimitive).addMember(member); 184 178 } 185 179
Note:
See TracChangeset
for help on using the changeset viewer.
