Skip to content

Commit

Permalink
Merge pull request #178 from HSLdevcom/fix-npe
Browse files Browse the repository at this point in the history
Add check for null
  • Loading branch information
vesameskanen authored Sep 18, 2017
2 parents f5e0d5a + 152b5a1 commit 8e12f21
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void setMetadata() {
MDC.put("router", router.id);
MDC.put("time", Long.toString(System.currentTimeMillis() - time));
MDC.put("query", query);
MDC.put("arguments", variables.toString());
MDC.put("arguments", variables!=null ? variables.toString() : "");
if(headers!=null) {
MDC.put("userAgent", headers.getFirst(HttpHeaders.USER_AGENT));
MDC.put("referer", headers.getFirst("referer"));
Expand All @@ -96,7 +96,9 @@ public void onEnd(ExecutionResult result) {
if(result.getErrors().size() > 0) {
StringBuilder errors = new StringBuilder();
for(GraphQLError e: result.getErrors()){
errors.append(e.getMessage()).append("\n");
if(e != null) {
errors.append(e.getLocations()).append(e.getErrorType()).append(e.getMessage()).append("\n");
}
}
MDC.put("errors", errors.toString());
}
Expand Down

0 comments on commit 8e12f21

Please sign in to comment.