NPE in com.atlassian.braid.source.QueryExecutor.resultWithShortCircuitedData
Issue #21
new
in line 256:
result.getData().entrySet()
throws an NPE when the result is NULL, actually. you should use
Optional.ofNullable(result.getData()).orElse(Collections.emptyMap()).entrySet()
or something similar here, because this way Braid returns this NPE in the “errors”:
{
"data": null,
"errors": [
{
"message": "Exception while fetching data (/someInformation) : java.lang.NullPointerException",
"path": [
"someInformation"
],
"exception": {
"cause": {
"cause": null,
"stackTrace": [
{
"classLoaderName": "app",
"moduleName": null,
"moduleVersion": null,
"methodName": "resultWithShortCircuitedData",
"fileName": "QueryExecutor.java",
"lineNumber": 256,
"className": "com.atlassian.braid.source.QueryExecutor",
"nativeMethod": false
},
...
]
}
instead of the proper error from the result’s error field (result.getErrors()
, in line 260):
{
"data": null,
"errors": [
{
"message": "Cannot return null for non-nullable type: 'SomeInformationResponse' within parent 'Query' (/someInformation)",
"path": [
"someInformation"
],
"locations": null,
"errorType": "DataFetchingException",
"extensions": null
}
],
"dataPresent": true,
"extensions": null
}