Better logging in JSON parse errors in ServerInventoryView

This commit is contained in:
Charles Allen 2014-11-12 16:52:15 -08:00
parent 10b7ca9fa9
commit a8103fb02d
1 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,7 @@ package io.druid.client;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.MapMaker;
@ -36,6 +37,8 @@ import io.druid.timeline.DataSegment;
import org.apache.curator.framework.CuratorFramework;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
@ -111,6 +114,8 @@ public abstract class ServerInventoryView<InventoryType> implements ServerView,
return jsonMapper.readValue(bytes, typeReference);
}
catch (IOException e) {
CharBuffer charBuffer = Charsets.UTF_8.decode(ByteBuffer.wrap(bytes));
log.error(e, "Could not parse json: %s", charBuffer.toString());
throw Throwables.propagate(e);
}
}