COMPRESS-392 make test for Brotli check for the library itself
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/c4ad0b75 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/c4ad0b75 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/c4ad0b75 Branch: refs/heads/master Commit: c4ad0b75c1f814d5ec5dd600183fb303f7241c33 Parents: ac73d23 Author: Stefan Bodewig <[email protected]> Authored: Thu May 4 08:46:49 2017 +0200 Committer: Stefan Bodewig <[email protected]> Committed: Thu May 4 08:46:49 2017 +0200 ---------------------------------------------------------------------- .../apache/commons/compress/compressors/brotli/BrotliUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c4ad0b75/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliUtils.java b/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliUtils.java index e73a895..251d98d 100644 --- a/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliUtils.java +++ b/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliUtils.java @@ -59,8 +59,9 @@ public class BrotliUtils { private static boolean internalIsBrotliCompressionAvailable() { try { - return BrotliCompressorInputStream.matches(null, 0); - } catch (final NoClassDefFoundError error) { + Class.forName("org.brotli.dec.BrotliInputStream"); + return true; + } catch (NoClassDefFoundError | Exception error) { return false; } }
