better workaround for snappy error output

instead of setting the err stream to null, set it to a null output print stream
This commit is contained in:
Shay Banon 2012-10-22 00:15:12 +02:00
parent faa7501715
commit c0e2eb5f5f
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.compress.snappy.xerial; package org.elasticsearch.common.compress.snappy.xerial;
import com.google.common.io.NullOutputStream;
import org.xerial.snappy.Snappy; import org.xerial.snappy.Snappy;
import java.io.PrintStream; 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... // when failing to load the snappy library, and we don't want it displayed...
PrintStream err = System.err; PrintStream err = System.err;
try { try {
System.setErr(null); System.setErr(new PrintStream(new NullOutputStream()));
byte[] tests = Snappy.compress("test"); byte[] tests = Snappy.compress("test");
Snappy.uncompressString(tests); Snappy.uncompressString(tests);
availableX = true; availableX = true;