carterkozak commented on code in PR #372:
URL: 
https://github.com/apache/httpcomponents-client/pull/372#discussion_r895924680


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java:
##########
@@ -94,9 +94,7 @@ public InputStream getContent() throws IOException {
     @Override
     public void writeTo(final OutputStream outStream) throws IOException {
         try {
-            if (outStream != null) {
-                super.writeTo(outStream);
-            }
+            super.writeTo(outStream != null ? outStream : 
NullOutputStream.INSTANCE);

Review Comment:
   The simpler alternative here is to always delegate to the wrapped entity via 
`super.writeTo(outStream)`. The abstract implementation will throw a NPE on a 
null outStream value, which is reasonable, however it would be a behavior 
change. I'm happy to commit either approach, but opted for the least invasive 
for users initially.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to