[OSM-dev] osmosis not handling empty command line values

Brett Henderson brett at bretth.com
Tue Jun 7 12:36:34 UTC 2016

On Mon, 6 Jun 2016 at 09:33 Stadin, Benjamin <
Benjamin.Stadin at heidelberg-mobil.com> wrote:

> Hi,
> I¹m following the import example from [1] with a small extract:
> osmosis --read-pbf ka.pbf \
>   --write-apidb host="localhost" database="openstreetmap" \
>   user="openstreetmap" password="" validateSchemaVersion="no"

> But this throws an error:
> SEVERE: Execution aborted.
> org.openstreetmap.osmosis.core.OsmosisRuntimeException: Argument 7 doesn't
> contain a value after the '=' (ie. name=value).
>         at
> org.openstreetmap.osmosis.core.cli.CommandLineParser.parseTask(CommandLineP
> arser.java:281)
> The 7th argument is the password argument. When I remove that argument,
> osmosis doesn¹t complain but fails to connect to the db.

What you've tried looks correct to me.  If you don't specify a password
parameter, the default value is an empty password.

What error are you getting when you leave out the password?

> The osmosis version I use is a prebuilt v0.45 from here:
> http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.tgz
> I wasn¹t able yet to compile it from sources (I¹ve Ubuntu 16.04 and Oracle
> Java 8 - according to the compile errors I guess Java 7 would be better to
> build the package).

It is safe to build and run on Java 8.  It is not safe to build on Java 8
and run on Java 7.  The warning occur because gradle is configured to
produce Java 7 compatible class files which can be problematic if you're
using a Java 8 JDK (you may link against incompatible APIs).

> I didn¹t look into the code, but it seems the "" is not treated as an
> empty string but eliminated in the course.

The command line validation is perhaps too strict, but passwords are about
the only command line option I can think of where an empty value makes

In your case, leaving the option out entirely *should* work.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20160607/8ac9b85b/attachment.html>

More information about the dev mailing list