diff options
author | Jose <jose@zeroc.com> | 2017-06-16 10:11:36 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-06-16 10:11:36 +0200 |
commit | 901c3fff344809e5ca5bd03bbbe11dd1e61ef482 (patch) | |
tree | f194921de47253645452c3aad2f98312e8688bf7 /java | |
parent | ICE-8051 - Suppress deprecation warnings (diff) | |
download | ice-901c3fff344809e5ca5bd03bbbe11dd1e61ef482.tar.bz2 ice-901c3fff344809e5ca5bd03bbbe11dd1e61ef482.tar.xz ice-901c3fff344809e5ca5bd03bbbe11dd1e61ef482.zip |
Fix (ICE-8074) - cpp-java-compat bzip2 failure on amzn1
Diffstat (limited to 'java')
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java index bb1b0b41f85..3d60cc65702 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java @@ -43,17 +43,11 @@ public class BZip2 try { // - // Compress the data using the class org.apache.tools.bzip2.CBZip2OutputStream. + // Compress the data using the class org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream // Its constructor requires an OutputStream argument, therefore we pass the // compressed buffer in an OutputStream wrapper. // BufferedOutputStream bos = new BufferedOutputStream(compressed); - // - // For interoperability with the bzip2 C library, we insert the magic bytes - // 'B', 'Z' before invoking the Java implementation. - // - bos.write('B'); - bos.write('Z'); java.lang.Object[] args = new java.lang.Object[]{ bos, Integer.valueOf(compressionLevel) }; java.io.OutputStream os = (java.io.OutputStream)_bzOutputStreamCtor.newInstance(args); os.write(data, offset + headerSize, uncompressedLen); @@ -140,25 +134,13 @@ public class BZip2 try { // - // Uncompress the data using the class org.apache.tools.bzip2.CBZip2InputStream. + // Uncompress the data using the class org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream. // Its constructor requires an InputStream argument, therefore we pass the // compressed data in a ByteArrayInputStream. // java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(compressed, offset + headerSize + 4, compressedLen); - // - // For interoperability with the bzip2 C library, we insert the magic bytes - // 'B', 'Z' during compression and therefore must extract them before we - // invoke the Java implementation. - // - byte magicB = (byte)bais.read(); - byte magicZ = (byte)bais.read(); - if(magicB != (byte)'B' || magicZ != (byte)'Z') - { - com.zeroc.Ice.CompressionException e = new com.zeroc.Ice.CompressionException(); - e.reason = "bzip2 uncompression failure: invalid magic bytes"; - throw e; - } + java.lang.Object[] args = new java.lang.Object[]{ bais }; java.io.InputStream is = (java.io.InputStream)_bzInputStreamCtor.newInstance(args); r.b.position(headerSize); |