amarkevich commented on a change in pull request #748:
URL: https://github.com/apache/cxf/pull/748#discussion_r580143043



##########
File path: core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
##########
@@ -1660,22 +1667,38 @@ public static XMLStreamReader 
createXMLStreamReader(InputSource src) {
         String sysId = src.getSystemId() == null ? null : src.getSystemId();
         String pubId = src.getPublicId() == null ? null : src.getPublicId();
         if (src.getByteStream() != null) {
+            final InputStream is = src.getByteStream();
+
             if (src.getEncoding() == null) {
-                StreamSource ss = new StreamSource(src.getByteStream(), sysId);
+                final StreamSource ss = new StreamSource(is, sysId);
                 ss.setPublicId(pubId);
-                return createXMLStreamReader(ss);
+                
+                final XMLStreamReader xmlStreamReader = 
createXMLStreamReader(ss);
+                if (AUTO_CLOSE_INPUT_SOURCE) {
+                    return new AutoCloseableXMLStreamReader(xmlStreamReader, 
is);

Review comment:
       AutoCloseable wont close source stream because returning XMLStreamReader 
cant be defined inside try-with-resources block




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

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


Reply via email to