From d844093953dcc252ef97718aec69ec122850a96f Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 5 Jul 2012 23:47:03 +0200 Subject: [PATCH] only set the decoder type if set in the settings --- .../common/compress/lzf/LZFCompressor.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java b/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java index 7cd3cce5216..13e52b5f5d5 100644 --- a/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java +++ b/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java @@ -56,15 +56,17 @@ public class LZFCompressor implements Compressor { @Override public void configure(Settings settings) { - String decoderType = settings.get("compress.lzf.decoder", "optimal"); - if ("optimal".equalsIgnoreCase(decoderType)) { - this.decoder = ChunkDecoderFactory.optimalInstance(); - Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); - } else if ("safe".equalsIgnoreCase(decoderType)) { - this.decoder = ChunkDecoderFactory.safeInstance(); - Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); - } else { - Loggers.getLogger(LZFCompressor.class).warn("decoder type not recognized [{}], still using [{}]", decoderType, this.decoder.getClass().getSimpleName()); + String decoderType = settings.get("compress.lzf.decoder", null); + if (decoderType != null) { + if ("optimal".equalsIgnoreCase(decoderType)) { + this.decoder = ChunkDecoderFactory.optimalInstance(); + Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); + } else if ("safe".equalsIgnoreCase(decoderType)) { + this.decoder = ChunkDecoderFactory.safeInstance(); + Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); + } else { + Loggers.getLogger(LZFCompressor.class).warn("decoder type not recognized [{}], still using [{}]", decoderType, this.decoder.getClass().getSimpleName()); + } } }