Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to read XML files that lack lat or lon values for some nodes #7

Open
sebkur opened this issue Jul 26, 2022 · 0 comments
Open

Comments

@sebkur
Copy link
Member

sebkur commented Jul 26, 2022

When converting a PBF history file to XML using osmium, the XML will contain nodes that don't have any lon or lat attributes. Attempting to parse such XML files:

Exception in thread "main" java.lang.RuntimeException: error while processing input
        at de.topobyte.osm4j.xml.dynsax.OsmXmlIterator.hasNext(OsmXmlIterator.java:138)
        at de.topobyte.osm4j.utils.executables.OsmCount.run(OsmCount.java:59)
        at de.topobyte.osm4j.utils.executables.OsmCount.main(OsmCount.java:46)
Caused by: de.topobyte.osm4j.core.access.OsmInputException: error while parsing xml data
        at de.topobyte.osm4j.xml.dynsax.OsmXmlReader.read(OsmXmlReader.java:90)
        at de.topobyte.osm4j.xml.dynsax.OsmXmlIterator$1.run(OsmXmlIterator.java:94)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
        at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1838)
        at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
        at java.base/java.lang.Double.parseDouble(Double.java:543)
        at de.topobyte.osm4j.xml.dynsax.OsmSaxHandler.emit(OsmSaxHandler.java:283)
        at de.topobyte.xml.dynsax.DynamicSaxHandler.endElement(DynamicSaxHandler.java:127)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:184)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1377)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
        at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:197)
        at de.topobyte.osm4j.xml.dynsax.OsmXmlReader.read(OsmXmlReader.java:88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant