Opened 9 years ago

Closed 9 years ago

#3344 closed defect (fixed)

NullPointerException in read-xml on DB connection error

Reported by: Sarah Hoffmann Owned by: Sarah Hoffmann
Priority: minor Milestone:
Component: osmosis Version:
Keywords: Cc:


When using osmosis to read from an xml file into a DB and the DB connection fails for some reason, there is a NullPointerException? in the error handling code of both, the --read-xml and and the --fast-read-xml tasks. This inconveniently hides the true error.

Here the exception trace for the case where the supplied password for the DB was wrong using the latest osmosis version from svn:

me@here:osm$ osmosis --fast-read-xml planet-101117.osm.bz2 --wp database=osm  user=osm
Nov 21, 2010 11:29:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version SNAPSHOT-r24324
Nov 21, 2010 11:29:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Nov 21, 2010 11:29:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Nov 21, 2010 11:29:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Nov 21, 2010 11:29:23 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-fast-read-xml failed
        at org.openstreetmap.osmosis.pgsnapshot.v0_6.PostgreSqlCopyWriter.release(
Nov 21, 2010 11:29:23 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(  146)
        at org.openstreetmap.osmosis.core.Osmosis.main(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(
        at org.codehaus.classworlds.Launcher.main(

Change History (2)

comment:1 Changed 9 years ago by bretth

Owner: changed from bretth to Sarah Hoffmann
Status: newassigned

The problem was in the release method of the --write-pgsql task. An object was being used that hadn't been initialised yet due to the database connection failure. I've added a null check which fixes the issue.

comment:2 Changed 9 years ago by bretth

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.