Fix NPE in QueryResource on bad query

This commit is contained in:
Charles Allen 2014-12-22 12:59:47 -08:00
parent 63df70cbe2
commit 4338af0e3f
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,6 @@ public class QueryResource
{
final long start = System.currentTimeMillis();
Query query = null;
byte[] requestQuery = null;
String queryId = null;
final String reqContentType = req.getContentType();
@ -267,9 +266,10 @@ public class QueryResource
).build();
}
catch (Exception e) {
// Input stream has already been consumed by the json object mapper if query == null
final String queryString =
query == null
? (isSmile ? "smile_unknown" : new String(requestQuery, Charsets.UTF_8))
? "unparsable query"
: query.toString();
log.warn(e, "Exception occurred on request [%s]", queryString);