westnordost / osmapi

Java client for the OSM API 0.6
GNU Lesser General Public License v3.0
97 stars 19 forks source link

Exception in thread "main" de.westnordost.osmapi.common.errors.OsmApiReadResponseException: de.westnordost.osmapi.common.errors.XmlParserException: Error parsing XML at END_TAG </relation>@3997:13 in java.io.InputStreamReader@4079d7b3 #11

Closed Eljah closed 7 years ago

Eljah commented 7 years ago

Hi!

Please take a look at my programm and the exception:

import de.westnordost.osmapi.OsmConnection; import de.westnordost.osmapi.map.MapDataDao; import de.westnordost.osmapi.map.data.*; import de.westnordost.osmapi.map.handler.MapDataHandler;

/**

Exception in thread "main" de.westnordost.osmapi.common.errors.OsmApiReadResponseException: de.westnordost.osmapi.common.errors.XmlParserException: Error parsing XML at END_TAG @3997:13 in java.io.InputStreamReader@4079d7b3 at de.westnordost.osmapi.OsmConnection.handleResponse(OsmConnection.java:322) А77 пер. Дуслык – Нефтебаза at de.westnordost.osmapi.OsmConnection.makeRequest(OsmConnection.java:191) at de.westnordost.osmapi.OsmConnection.makeRequest(OsmConnection.java:142) at de.westnordost.osmapi.map.MapDataDao.getMap(MapDataDao.java:194) at ConnectionTester.main(ConnectionTester.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: de.westnordost.osmapi.common.errors.XmlParserException: Error parsing XML at END_TAG @3997:13 in java.io.InputStreamReader@4079d7b3 at de.westnordost.osmapi.common.XmlParser.doParse(XmlParser.java:64) at de.westnordost.osmapi.map.MapDataParser.parse(MapDataParser.java:58) at de.westnordost.osmapi.map.MapDataParser.parse(MapDataParser.java:20) at de.westnordost.osmapi.OsmConnection.handleResponse(OsmConnection.java:314) ... 9 more Caused by: java.lang.NullPointerException at ConnectionTester$1.handle(ConnectionTester.java:38) at de.westnordost.osmapi.map.MapDataParser.onEndElement(MapDataParser.java:164) at de.westnordost.osmapi.common.XmlParser.doParse(XmlParser.java:49) ... 12 more

westnordost commented 7 years ago

So the source exception is at de.westnordost.osmapi.map.MapDataParser.onEndElement(MapDataParser.java:164)

handler is null. This should be the expection you get if you pass null for the handler in mapDataDao.getMap

Eljah commented 7 years ago

thanks a lot; I supposed null be never got