You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Andreas Schaefer (Jira)" <ji...@apache.org> on 2022/07/15 21:22:00 UTC

[jira] [Updated] (SLING-11458) Regress - "Writer has already been closed" exception in GraphQLServlet

     [ https://issues.apache.org/jira/browse/SLING-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Schaefer updated SLING-11458:
-------------------------------------
    Description: 
The GraphQLServlet shouldn't call {{response.getWriter().flush()}} as the {{JsonWriter}} used by the {{JsonSerializer}} implements {{Closeable}} and as such [closes the Writer|https://github.com/jdereg/json-io/blob/cf849f15460decf10a8a320390de11965bb5996b/src/main/java/com/cedarsoftware/util/io/JsonWriter.java#L2413].

This causes a "Writer has already been closed" Exception when {{flush()}} is called.

This was fixed in commit d27f4bb7 but then this commit: 11c7e389 did undo the fix as now the JsonWriter is closed when existing the try-catch block.

I will undo it and prevent the premature closure as this is causing issues like when the call to this servlet is made through a dispatcher.

  was:
The GraphQLServlet shouldn't call {{response.getWriter().flush()}} as the {{JsonWriter}} used by the {{JsonSerializer}} implements {{Closeable}} and as such [closes the Writer|https://github.com/jdereg/json-io/blob/cf849f15460decf10a8a320390de11965bb5996b/src/main/java/com/cedarsoftware/util/io/JsonWriter.java#L2413].

This causes a "Writer has already been closed" Exception when {{flush()}} is called.


> Regress - "Writer has already been closed" exception in GraphQLServlet
> ----------------------------------------------------------------------
>
>                 Key: SLING-11458
>                 URL: https://issues.apache.org/jira/browse/SLING-11458
>             Project: Sling
>          Issue Type: Bug
>          Components: GraphQL
>    Affects Versions: GraphQL Core 0.0.4
>            Reporter: Evgeny Tugarev
>            Assignee: Andreas Schaefer
>            Priority: Major
>             Fix For: GraphQL Core 0.0.6
>
>
> The GraphQLServlet shouldn't call {{response.getWriter().flush()}} as the {{JsonWriter}} used by the {{JsonSerializer}} implements {{Closeable}} and as such [closes the Writer|https://github.com/jdereg/json-io/blob/cf849f15460decf10a8a320390de11965bb5996b/src/main/java/com/cedarsoftware/util/io/JsonWriter.java#L2413].
> This causes a "Writer has already been closed" Exception when {{flush()}} is called.
> This was fixed in commit d27f4bb7 but then this commit: 11c7e389 did undo the fix as now the JsonWriter is closed when existing the try-catch block.
> I will undo it and prevent the premature closure as this is causing issues like when the call to this servlet is made through a dispatcher.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)