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

GraphQLServlet: Don't wrap arbitrary Exceptions in IOExceptions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • GraphQL
    • None

    Description

      In both execute methods there is an IOException being thrown in https://github.com/apache/sling-org-apache-sling-graphql-core/blob/9989848de947bb4dc320b6b0f7cbcde810819728/src/main/java/org/apache/sling/graphql/core/servlet/GraphQLServlet.java#L323 and https://github.com/apache/sling-org-apache-sling-graphql-core/blob/9989848de947bb4dc320b6b0f7cbcde810819728/src/main/java/org/apache/sling/graphql/core/servlet/GraphQLServlet.java#L336 wrapping the underlying exception.

      That is unexpected as IOException doesn't change the response status (i.e. stays with default 200) and also doesn't leverage the Sling error handler for rendering a response. Instead in most cases a blank response will hit the client.

      IOException should only be thrown in case one cannot write to the underlying servlet response stream/writer. For all other cases other exception classes should be used!

      Attachments

        Activity

          People

            Unassigned Unassigned
            kwin Konrad Windszus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: