reta commented on PR #3554:
URL: https://github.com/apache/cxf/pull/3554#issuecomment-6050188714

   Thanks @vp340, I think we opened the pandora box here  
   
   > I notice also that the this.close() method calls the super one in 
CachedOutputStream that calls postClose() that close the flowThroughStream.
   This will result in another IOException that will be add in 
ex.addSuppressed(suppressed); (see screen above)
   
   In my opinion, we have to close all the streams, so postClose() does the 
right thing here I believe. If it it fails - we preserve the original 
exception, and adding the suppressed one
   
   @ffang I think we would need a minor change, instead of passing to the 
closed stream:
   
   ```
   if (closed.get()) {
               // already closed and logged: pass through only, do not cache 
again
               getFlowThroughStream().write(b);
               return;
           }
   ```
   
   do 
   
   ```
           if (closed.get()) {
               throw new IOException("The channel has been closed already");
           }
   ```
   
   Why: all streams should be closed at this time, the write would very likely 
fail anyway, opened https://github.com/apache/cxf/pull/3555


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to