incubator-baremaps
incubator-baremaps copied to clipboard
NullPointerException on Update
I get an NullPointerException when I try to Update the data without any useful information. I used the extract of brandenburg for 2021-06-20 and tried to apply the shown update.
$ ./baremaps update --database 'jdbc:postgresql://localhost:5435/baremaps?&user=osm&password=osm'
[INFO ] 2021-06-20 15:47:32.455 [main] Update - 4 processors available.
[INFO ] 2021-06-20 15:47:32.954 [main] HttpBlobStore - Read http://download.geofabrik.de/europe/germany/brandenburg-updates/000/003/003.osc.gz
[INFO ] 2021-06-20 15:47:38.861 [main] HttpBlobStore - Read http://download.geofabrik.de/europe/germany/brandenburg-updates/000/003/003.state.txt
[INFO ] 2021-06-20 15:47:38.925 [main] UpdateTask - Importing changes and state in database
com.baremaps.stream.StreamException: java.lang.NullPointerException
at com.baremaps.osm.handler.ChangeHandler.accept(ChangeHandler.java:16)
at com.baremaps.osm.handler.ChangeHandler.accept(ChangeHandler.java:7)
at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:441)
at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
at com.baremaps.osm.xml.XmlChangeSpliterator.tryAdvance(XmlChangeSpliterator.java:111)
at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at com.baremaps.osm.UpdateTask.execute(UpdateTask.java:91)
at com.baremaps.cli.Update.call(Update.java:103)
at com.baremaps.cli.Update.call(Update.java:46)
at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
at picocli.CommandLine.access$1200(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
at picocli.CommandLine.execute(CommandLine.java:2058)
at com.baremaps.cli.Baremaps.main(Baremaps.java:54)
Caused by: java.lang.NullPointerException
at com.baremaps.osm.database.ChangeTiler$1.handle(ChangeTiler.java:68)
at com.baremaps.osm.domain.Node.accept(Node.java:54)
at com.baremaps.osm.database.ChangeTiler.handleLastVersion(ChangeTiler.java:64)
at com.baremaps.osm.database.ChangeTiler.handle(ChangeTiler.java:53)
at com.baremaps.osm.handler.ChangeHandler.accept(ChangeHandler.java:12)
... 23 more
Thanks a lot for reporting this issue. The update command is quite experimental and has not been extensively tested nor documented yet.
I have been able to download all the files required to reproduce the issue locally. It seems that, when dealing with extracts, the change sets can contain delete operation for entities (nodes, ways or relations) which are not present in the database. This causes a NullPointerException and I will try to come back with a fix.