only set the decoder type if set in the settings

This commit is contained in:
Shay Banon 2012-07-05 23:47:03 +02:00
parent 2328776ec5
commit d844093953
1 changed files with 11 additions and 9 deletions

View File

@ -56,15 +56,17 @@ public class LZFCompressor implements Compressor {
@Override @Override
public void configure(Settings settings) { public void configure(Settings settings) {
String decoderType = settings.get("compress.lzf.decoder", "optimal"); String decoderType = settings.get("compress.lzf.decoder", null);
if ("optimal".equalsIgnoreCase(decoderType)) { if (decoderType != null) {
this.decoder = ChunkDecoderFactory.optimalInstance(); if ("optimal".equalsIgnoreCase(decoderType)) {
Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); this.decoder = ChunkDecoderFactory.optimalInstance();
} else if ("safe".equalsIgnoreCase(decoderType)) { Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName());
this.decoder = ChunkDecoderFactory.safeInstance(); } else if ("safe".equalsIgnoreCase(decoderType)) {
Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); this.decoder = ChunkDecoderFactory.safeInstance();
} else { Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName());
Loggers.getLogger(LZFCompressor.class).warn("decoder type not recognized [{}], still using [{}]", decoderType, this.decoder.getClass().getSimpleName()); } else {
Loggers.getLogger(LZFCompressor.class).warn("decoder type not recognized [{}], still using [{}]", decoderType, this.decoder.getClass().getSimpleName());
}
} }
} }