From 384aa0bb43ca9a0c66382036e0c6734056d611cf Mon Sep 17 00:00:00 2001 From: pavolzibrita Date: Thu, 1 Sep 2011 12:33:43 +0300 Subject: [PATCH] Fix possible NumberFormatException --- .../net/osmand/data/preparation/IndexAddressCreator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java index 0c2a658d85..29b57f684f 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java @@ -275,7 +275,7 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ } } } - } else if (isBoundary(e) && hasGreaterCityAdminLevel(Integer.parseInt(cityAdminLevel),e)) { + } else if (isBoundary(e) && hasGreaterCityAdminLevel(cityAdminLevel,e)) { //Any lower admin_level boundary is attached to the nearest city Boundary boundary = extractBoundary(e, ctx); if (boundary != null && boundary.getCenterPoint() != null) { @@ -312,10 +312,10 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ return cityAdminLevel.equals(e.getTag(OSMTagKey.ADMIN_LEVEL)); } - private boolean hasGreaterCityAdminLevel(int admin_level, Entity e) + private boolean hasGreaterCityAdminLevel(String admin_level, Entity e) { try { - return admin_level < Integer.parseInt(e.getTag(OSMTagKey.ADMIN_LEVEL)); + return Integer.parseInt(admin_level) < Integer.parseInt(e.getTag(OSMTagKey.ADMIN_LEVEL)); } catch (NumberFormatException ex) { return false; }