andymc12 commented on a change in pull request #620: CXF-7996: TCK: Resolves 
FormParam-related failures
URL: https://github.com/apache/cxf/pull/620#discussion_r365845990
 
 

 ##########
 File path: 
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
 ##########
 @@ -1878,4 +1891,16 @@ public static String logMessageHandlerProblem(String 
name, Class<?> cls, MediaTy
         return errorMessage;
     }
 
+    // copy the input stream so that it is not inadvertently closed
+    private static InputStream copyAndGetEntityStream(Message m) {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+            IOUtils.copy(m.getContent(InputStream.class), baos);
+        } catch (IOException e) {
+            throw ExceptionUtils.toInternalServerErrorException(e, null);
+        }
+        final byte[] copiedBytes = baos.toByteArray();
+        m.setContent(InputStream.class, new ByteArrayInputStream(copiedBytes));
 
 Review comment:
   I see Dan already merged it (thanks Dan!), but just to followup, the change 
had no ill effects in our automated testing - the normal functional tests and 
TCK all passed.

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


With regards,
Apache Git Services

Reply via email to