Opened 9 years ago

Last modified 6 years ago

#3510 assigned defect

Problem with omitmetadata=true in PBF Binary Task and ObjectStore

Reported by: jbr Owned by: jbr
Priority: major Milestone:
Component: osmosis Version:
Keywords: Cc:


Application of the parameter omitmetadata=true in the write-pbf task sets the 'version' attribute of an processed entity to -1. When trying to write such an entity to an ObjectStore (e.g. SimpleObjectStore) the version attribute is casted from an integer type to a char in method org.openstreetmap.osmosis.core.util.IntAsChar.intToChar(). A negative number obviously cannot be casted to a char and so an OsmosisRuntimeException is thrown.

I could set the version attribute to a valid value prior to storing it in an ObjectStore. However, that's only possible if the entity is not readonly. Otherwise I have to clone the entity, which is not very memory efficient in an Osmosis pipe with much parallelization (e.g. --tee 20).

The easiest and I guess most reasonable fix to this problem would be to write a '0' instead of '-1' to the version attribute in the --write-pbf task when omitmetadata is enabled.

Change History (2)

comment:1 Changed 6 years ago by bretth

I don't believe the casting to char occurs any more. Most of these storage optimisations were removed due to the issues they caused. I can only find a single use of IntToChar? and it's used when storing a tag count (entities shouldn't have more than 65536 tags ... surely).

Please confirm and close the ticket if you're happy with the resolution.

Last edited 6 years ago by bretth (previous) (diff)

comment:2 Changed 6 years ago by bretth

Owner: changed from bretth to jbr
Status: newassigned
Note: See TracTickets for help on using tickets.