[
https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778475#action_12778475
]
aaron pieper commented on CXF-2542:
-----------------------------------
Daniel,
Thanks for your speedy response! As far as why this comes up for us "in the
real world". We need to look at an incoming message and determine which web
service it's calling. This logic takes place before we pass the message to CXF.
We've chosen to implement this with the following pseudocode:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
InputStream is = request.getInputStream();
InputStream newIs = AttachmentDeserializer.removeAttachmentHeaders();
String requestName = determineRequestName(newIs);
if (isAppleRequest(requestName)) {
redirectToAppleEndpoint();
} else {
redirectToBananaEndpoint();
}
}
This logic uses AttachmentDeserializer's logic for carving the attachments out
of messages. It's possible that if this logic were refactored into its own
class, which took an InputStream/ContentType combination instead of a message,
that we could use that class instead. That way we wouldn't need to impose any
artificial "null pointer padding" on AttachmentDeserializer itself. With the
current CXF implementation, we just create our own message from scratch, and
pass that message into AttachmentDeserializer.
> DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw
> NullPointerException
> -------------------------------------------------------------------------------------------------
>
> Key: CXF-2542
> URL: https://issues.apache.org/jira/browse/CXF-2542
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.2.4
> Reporter: aaron pieper
> Assignee: Daniel Kulp
> Attachments: CxfBug0.java, stack-trace.txt
>
>
> Parsing AttachmentDeserializer's attachments causes an NPE in
> MessageImpl.getContextualProperty sometimes. This can be fixed by adding a
> null check in MessageImpl's getContextualProperty method.
> This problem exists in 2.2.4, it did not exist in 2.2.2. It was caused by a
> change in DelegatingInputStream's close behavior.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.