Jabran Asghar created SLING-9870:
------------------------------------

             Summary: NullPointerException, in case Locations are null in an 
GraphQL error response
                 Key: SLING-9870
                 URL: https://issues.apache.org/jira/browse/SLING-9870
             Project: Sling
          Issue Type: Bug
          Components: GraphQL
    Affects Versions: GraphQL Core 0.0.6
            Reporter: Jabran Asghar
             Fix For: GraphQL Core 0.0.8


*Problem*

In case GraphQLError does not contain any Location information, rather when the 
list of locations will be null [0], then a NullPointerException is thrown. This 
causes a non-meaningful response to be sent back to client.

For example, the following query will cause a NPE:
{{}}
{code:java}
{   article(_path: "/non-existent/path/to/an-article") 
    {     
        _path   
    } 
}{code}
 
*Proposed solution:*
Should be a null check for {{error.getLocations().}}
[0] 
https://github.com/apache/sling-org-apache-sling-graphql-core/blob/e3b09af9e5bd9550e2df87491fd924a886eba51e/src/main/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutor.java#L144



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to