Merge pull request #305 from metamx/npe-deprecated-fix

Remove deprecated jackson calls and fix NPE
This commit is contained in:
fjy 2013-11-25 12:39:24 -08:00
commit 23133f3b5b
2 changed files with 6 additions and 4 deletions

View File

@ -49,7 +49,7 @@ public class JacksonModule implements Module
public ObjectMapper smileMapper() public ObjectMapper smileMapper()
{ {
ObjectMapper retVal = new DefaultObjectMapper(new SmileFactory()); ObjectMapper retVal = new DefaultObjectMapper(new SmileFactory());
retVal.getJsonFactory().setCodec(retVal); retVal.getFactory().setCodec(retVal);
return retVal; return retVal;
} }
} }

View File

@ -89,7 +89,7 @@ public class DirectDruidClient<T> implements QueryRunner<T>
this.httpClient = httpClient; this.httpClient = httpClient;
this.host = host; this.host = host;
this.isSmile = this.objectMapper.getJsonFactory() instanceof SmileFactory; this.isSmile = this.objectMapper.getFactory() instanceof SmileFactory;
this.openConnections = new AtomicInteger(); this.openConnections = new AtomicInteger();
} }
@ -269,7 +269,7 @@ public class DirectDruidClient<T> implements QueryRunner<T>
{ {
if (jp == null) { if (jp == null) {
try { try {
jp = objectMapper.getJsonFactory().createJsonParser(future.get()); jp = objectMapper.getFactory().createParser(future.get());
if (jp.nextToken() != JsonToken.START_ARRAY) { if (jp.nextToken() != JsonToken.START_ARRAY) {
throw new IAE("Next token wasn't a START_ARRAY, was[%s]", jp.getCurrentToken()); throw new IAE("Next token wasn't a START_ARRAY, was[%s]", jp.getCurrentToken());
} else { } else {
@ -292,7 +292,9 @@ public class DirectDruidClient<T> implements QueryRunner<T>
@Override @Override
public void close() throws IOException public void close() throws IOException
{ {
if(jp != null) {
jp.close(); jp.close();
} }
} }
}
} }