eric6iese commented on code in PR #2467:
URL: https://github.com/apache/cxf/pull/2467#discussion_r2151296567


##########
rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java:
##########
@@ -844,6 +844,9 @@ public void close() throws IOException {
                     } catch (IOException e) {
                         logStackTrace(e);
                     }
+                    if (wrappedStream == pout){

Review Comment:
   The reason I put the check in there was to ensure that I do not clear a 
reference which might still be in use. But you are right, clearing the 
wrappedOutputStream after closing it should be safe and is much simpler. I did 
the same to the cachedOutputStream, since it could be holding a reference to 
the PipedOutputStream as well.
   
   The only negative side effect these changes could have is that they trade an 
IOException (closed stream) for a NullpointerException if any of these streams 
is deferenced after they were closed. To avoid this, instead of nulling them i 
could also set a closed `OutputStream.nullOutputStream()` to both fields.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cxf.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to