Blob Blame History Raw
From bab91e014f73296a8ac9a3aef2aaa324a85e9b96 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 12 Feb 2018 10:59:55 +0100
Subject: [PATCH 2/2] Remove ZSTD compressor

---
 .../compress/compressors/CompressorStreamFactory.java      | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
index ab178a9..3817704 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@@ -54,9 +54,6 @@ import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
 import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
 import org.apache.commons.compress.compressors.xz.XZUtils;
 import org.apache.commons.compress.compressors.z.ZCompressorInputStream;
-import org.apache.commons.compress.compressors.zstandard.ZstdCompressorInputStream;
-import org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream;
-import org.apache.commons.compress.compressors.zstandard.ZstdUtils;
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.compress.utils.ServiceLoaderIterator;
@@ -516,10 +513,6 @@ public class CompressorStreamFactory implements CompressorStreamProvider {
             return LZ4_FRAMED;
         }
 
-        if (ZstdUtils.matches(signature, signatureLength)) {
-            return ZSTANDARD;
-        }
-
         throw new CompressorException("No Compressor found for the stream signature.");
     }
     /**
@@ -595,10 +588,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider {
             }
 
             if (ZSTANDARD.equalsIgnoreCase(name)) {
-                if (!ZstdUtils.isZstdCompressionAvailable()) {
-                    throw new CompressorException("Zstandard compression is not available." + YOU_NEED_ZSTD_JNI);
-                }
-                return new ZstdCompressorInputStream(in);
+                throw new CompressorException("Zstandard compression is not available in this build.");
             }
 
             if (LZMA.equalsIgnoreCase(name)) {
@@ -714,7 +704,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider {
             }
 
             if (ZSTANDARD.equalsIgnoreCase(name)) {
-                return new ZstdCompressorOutputStream(out);
+                throw new CompressorException("Zstandard compression is not available in this build.");
             }
         } catch (final IOException e) {
             throw new CompressorException("Could not create CompressorOutputStream", e);
-- 
2.14.3