From e2cc3ddebb4003f2c2a8945ed3679d14daf45e22 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 24 Jun 2017 14:32:54 +0300 Subject: [PATCH] Fixed version not being added to way/node --- OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java | 9 +++++++++ 1 file changed, 9 insertions(+) mode change 100644 => 100755 OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java diff --git a/OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java b/OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java old mode 100644 new mode 100755 index 2b6de17a75..af1b54eeb7 --- a/OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java +++ b/OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java @@ -205,8 +205,10 @@ public class OsmBaseStorage { if (ELEM_NODE.equals(name)) { currentParsedEntity = new Node(parseDouble(parser, ATTR_LAT, 0), parseDouble(parser, ATTR_LON, 0), parseId(parser, ATTR_ID, -1)); + currentParsedEntity.setVersion(parseVersion(parser)); } else if (ELEM_WAY.equals(name)) { currentParsedEntity = new Way(parseId(parser, ATTR_ID, -1)); + currentParsedEntity.setVersion(parseVersion(parser)); } else if (ELEM_RELATION.equals(name)) { currentParsedEntity = new Relation(parseId(parser, ATTR_ID, -1)); } else { @@ -256,6 +258,13 @@ public class OsmBaseStorage { } } + private int parseVersion(XmlPullParser parser) { + if (parser.getAttributeName(parser.getAttributeCount() - 1).equals(ATTR_VERSION)) { + return Integer.valueOf(parser.getAttributeValue(parser.getAttributeCount() - 1)); + } + return -1; + } + public void endElement(XmlPullParser parser, String name) { EntityType type = null; if (ELEM_NODE.equals(name)){