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

 ##########
 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:
   :+1: thanks a lot!

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