Closing an CBZip2OutputStream when no data has been written fails with an
java.lang.ArithmeticException: / by zero
------------------------------------------------------------------------------------------------------------------
Key: SANDBOX-195
URL: https://issues.apache.org/jira/browse/SANDBOX-195
Project: Commons Sandbox
Issue Type: Bug
Components: Compress
Reporter: Stefan Liebig
Priority: Critical
The following test case reproduces the error:
public class CBZip2OutputStreamTest extends TestCase {
/**
* @throws IOException
*/
public void testEmtpyOutput() throws IOException {
CBZip2OutputStream outputStream = new CBZip2OutputStream( new
ByteArrayOutputStream() );
outputStream.close();
}
}
fails with:
java.lang.ArithmeticException: / by zero
at
org.apache.tools.bzip2.CBZip2OutputStream.mainSort(CBZip2OutputStream.java:1174)
at
org.apache.tools.bzip2.CBZip2OutputStream.doReversibleTransformation(CBZip2OutputStream.java:1386)
at
org.apache.tools.bzip2.CBZip2OutputStream.endBlock(CBZip2OutputStream.java:476)
at
org.apache.tools.bzip2.CBZip2OutputStream.close(CBZip2OutputStream.java:427)
at
CBZip2OutputStreamTest.testEmtpyOutput(CBZip2OutputStreamTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]