[osmosis-dev] Bzip2-issues

Brett Henderson brett at bretth.com
Mon Dec 14 08:22:09 GMT 2009


Hi Marcus,

I've checked a fix into svn.  Let me know if you see any more problems.

Brett

On Mon, Dec 14, 2009 at 4:52 PM, Brett Henderson <brett at bretth.com> wrote:

> It looks like the commons-compress library changes how it handles the file
> prefix.  The old libraries didn't use a prefix so I had hacks in a class
> called CompressionActivator like the following to make it compatible with
> command line bzip2.
>
> // Command line BZip2 adds "BZ" to the start of the file which
> // we must strip out.
> if (sourceStream.read() != 'B' || sourceStream.read() != 'Z') {
>     throw new OsmosisRuntimeException(
>         "The source stream must start with the characters BZ if it is to be
> read as a BZip2 stream."
>     );
> }
>
> These should be able to be removed now but I'll do some tests to make sure.
>
> Brett
>
>
> On Mon, Dec 14, 2009 at 12:17 AM, Marcus Wolschon <Marcus at wolschon.biz>wrote:
>
>> org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to
>> instantiate a BZip2 compression stream.
>>        at
>> org.openstreetmap.osmosis.core.xml.common.CompressionActivator.createCompressionInputStream(CompressionActivator.java:110)
>>        at
>> org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java:102)
>>        at
>> org.openstreetmap.osm.io.FileLoader.parseOsm(FileLoader.java:127)
>>        at
>> org.openstreetmap.travelingsalesman.actions.LoadMapFileActionListener.loadMapFile(LoadMapFileActionListener.java:1233)
>>        at
>> org.openstreetmap.travelingsalesman.actions.LoadMapFileActionListener$1.run(LoadMapFileActionListener.java:1010)
>> Caused by: java.io.IOException: Stream is not BZip2 formatted:
>> expected 'B' as first byte but got 'h'
>>        at
>> org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.checkMagicChar(BZip2CompressorInputStream.java:238)
>>        at
>> org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.init(BZip2CompressorInputStream.java:218)
>>        at org.apache.commo...)
>>
>>
>>
>> The file clearly starts with "B" and 7zip can decompress it as bzip2.
>> This is Osmosis 0.32.1 with the supplied commons-compress-1.0.jar .
>>
>> I wanted to release a new version of Traveling Salesman today but this
>> issue is blocking it.
>>
>> Marcus
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20091214/74bf1dce/attachment.html>


More information about the osmosis-dev mailing list