You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "aaron pieper (JIRA)" <ji...@apache.org> on 2009/11/16 18:49:39 UTC

[jira] Created: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

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


[jira] Assigned: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-2542:
--------------------------------

    Assignee: Daniel Kulp

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


[jira] Updated: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "aaron pieper (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

aaron pieper updated CXF-2542:
------------------------------

    Attachment: stack-trace.txt
                CxfBug0.java

A small program demonstrating the bug, and its associated stack trace. The error does not occur in CXF 2.2.2.

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


[jira] Commented: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "aaron pieper (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778422#action_12778422 ] 

Daniel Kulp commented on CXF-2542:
----------------------------------


One more note: can you re-attach the CxfBug0.java thing with the "grant to apache" checkbox checked.   I can then use that code for a unit test.

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


[jira] Updated: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "aaron pieper (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

aaron pieper updated CXF-2542:
------------------------------

    Attachment: CxfBug0.java

A java program demonstrating the bug.

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


[jira] Updated: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "aaron pieper (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

aaron pieper updated CXF-2542:
------------------------------

    Attachment:     (was: CxfBug0.java)

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


[jira] Resolved: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2542.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.6
                   2.1.9


Added some NPE guards.

However, you can work around it with 2.2.4/2.2.5 by calling:
message.put("attachment-directory", "/tmp");
message.put("attachment-memory-threshold",  new Long(1024000l));

or similar.  Those are the properties it's trying to find.



> 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
>             Fix For: 2.1.9, 2.2.6
>
>         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.


[jira] Commented: (CXF-2542) DelegatingInputStream.close() causes MessageImpl.getContextualProperty throw NullPointerException

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778418#action_12778418 ] 

Daniel Kulp commented on CXF-2542:
----------------------------------


Is there a stack trace for when this occurs in a "real life" scenario.   In theory, when this is called as part of the  AttachmentDeserializer stuff, the Exchange would always be set in the message.    Thus, the null check wouldn't be needed.     

I have no problem adding the null checks, but I'm curious as to why it really is needed in a normal case.   :-)



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