Merge pull request #854 from metamx/serverInventoryViewJson

Better logging in JSON parse errors in ServerInventoryView
This commit is contained in:
Fangjin Yang 2014-11-13 11:56:59 -07:00
commit 9d661d6d36
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);
}
}