Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-9870

NullPointerException, in case Locations are null in a GraphQL error response

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • GraphQL Core 0.0.6
    • GraphQL Core 0.0.8
    • GraphQL
    • None

    Description

      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:

      {   article(_path: "/non-existent/path/to/an-article") 
          {     
              _path   
          } 
      }

       
      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

      Attachments

        Issue Links

          Activity

            People

              bdelacretaz Bertrand Delacretaz
              jasghar Jabran Asghar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: