Title: Uncompressing file with bz2 fails with ArrayIndexOutOfBoundsException
Type: crash Severity: normal
Components: Library Versions: Jython 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: akoenig, fwierzbicki, indra, zyasoft
Priority: Keywords:

Created on 2013-04-12.14:55:02 by akoenig, last changed 2014-07-01.04:04:40 by zyasoft.

msg7991 (view) Author: Andreas Koenig (akoenig) Date: 2013-04-12.14:55:01
I have some files that contain a pickle, that was compressed with bz2, and then base64 encoded. These files were generated under linux using python.

When I open these programs with my program with python 2.7, I can open them without a problem. The coding is something like that:

while len(l):
zip = ''.join(arr)

However, if I try to use jython to execute the pyhton program I get the following exception:

Traceback (most recent call last):
  File "c:\Test\src\", line 115, in <module>
  File "c:\Test\src\", line 110, in main
    data = traceloader.load_trace("c:/temp/Performance.tpt")
  File "c:\Test\src\", line 94, in load_trace

If I call the same program from a java program I get the same exception,
but with more details, and the problem seems to be the bz2 decompressor

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 12198
	at org.python.modules.bz2.PyBZ2Decompressor.BZ2Decompressor_decompress(
	at org.python.modules.bz2.PyBZ2Decompressor$BZ2Decompressor_decompress_exposer.__call__(Unknown Source)
	at org.python.core.PyObject.__call__(
	at org.python.core.PyObject.__call__(
	at PerfTrace$py.load_trace$23(__pyclasspath__/
	at PerfTrace$py.call_function(__pyclasspath__/
	at org.python.core.PyFunction.__call__(
	at org.python.core.PyMethod.instancemethod___call__(
	at org.python.core.PyMethod.__call__(
	at org.python.core.PyMethod.__call__(
	at org.python.core.PyMethod.__call__(
	at org.python.core.PyObject._jcallexc(
	at org.python.core.PyObject._jcall(
	at org.python.proxies.PerfTrace$TraceLoader$0.load_trace(Unknown Source)
	at test.Test.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 com.intellij.rt.execution.application.AppMain.main(

Are there any known incompatabilities between the bz2 implementations of pyhton vs. jython or known limitations? 

msg7997 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-04-19.23:14:13
Hi Andreas,

The bz2 implementation is brand new and currently causes some test failures in You have likely found a bug in the new code. Thanks for reporting!
msg8231 (view) Author: Indra Talip (indra) Date: 2014-01-16.10:31:20
A possible fix as a pull request here -
msg8481 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.21:34:26
Probably fixed in beta 3; could akoenig please retry since we don't have the data files you were using?
msg8557 (view) Author: Jim Baker (zyasoft) Date: 2014-05-22.02:26:42
Also this should be pending, given that our tests now pass
msg8575 (view) Author: Indra Talip (indra) Date: 2014-05-25.10:01:05
I don't beleive that the changes in pullrequest have been merged so I don't think this has been fixed.
msg8578 (view) Author: Jim Baker (zyasoft) Date: 2014-05-27.16:41:20
Moving back to open, need to take a look at Indra's PR
msg8579 (view) Author: Jim Baker (zyasoft) Date: 2014-05-27.16:41:33
Target beta 4
msg8782 (view) Author: Jim Baker (zyasoft) Date: 2014-06-22.06:04:25
Fixed as of
Date User Action Args
2014-07-01 04:04:40zyasoftsetstatus: pending -> closed
2014-06-22 06:04:25zyasoftsetstatus: open -> pending
resolution: remind -> fixed
messages: + msg8782
2014-05-27 16:41:33zyasoftsetmessages: + msg8579
2014-05-27 16:41:21zyasoftsetstatus: pending -> open
messages: + msg8578
2014-05-25 10:01:06indrasetmessages: + msg8575
2014-05-22 02:26:42zyasoftsetstatus: open -> pending
messages: + msg8557
2014-05-21 21:34:26zyasoftsetresolution: remind
messages: + msg8481
nosy: + zyasoft
2014-01-16 10:31:20indrasetnosy: + indra
messages: + msg8231
2013-04-19 23:14:14fwierzbickisetnosy: + fwierzbicki
messages: + msg7997
2013-04-12 14:55:02akoenigcreate