You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2020/01/09 00:36:27 UTC
[GitHub] [cxf] reta commented on a change in pull request #620: CXF-7996:
TCK: Resolves FormParam-related failures
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_r364511829
##########
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 am wondering if we have to close the source (origin) `InputStream` here, since we replace it (dangling?) with the copy , what do you think @andymc12 ?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services