From c0e2eb5f5fdf5f32d0f0cb74130d694405e638f4 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Mon, 22 Oct 2012 00:15:12 +0200 Subject: [PATCH] better workaround for snappy error output instead of setting the err stream to null, set it to a null output print stream --- .../common/compress/snappy/xerial/XerialSnappy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappy.java b/src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappy.java index e961a8dfed5..2282dd94647 100644 --- a/src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappy.java +++ b/src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappy.java @@ -19,6 +19,7 @@ package org.elasticsearch.common.compress.snappy.xerial; +import com.google.common.io.NullOutputStream; import org.xerial.snappy.Snappy; import java.io.PrintStream; @@ -37,7 +38,7 @@ public class XerialSnappy { // when failing to load the snappy library, and we don't want it displayed... PrintStream err = System.err; try { - System.setErr(null); + System.setErr(new PrintStream(new NullOutputStream())); byte[] tests = Snappy.compress("test"); Snappy.uncompressString(tests); availableX = true;