History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-578
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Olaf Boede
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

XFire Client connect failure caused by a NPE in W3CNamespaceContext

Created: 11/Aug/06 09:16 AM   Updated: 16/Aug/06 04:15 PM
Component/s: Core
Affects Version/s: 1.1.1, 1.2-RC
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments: 1. Java Source File W3CNamespaceContext.java (2 kb)

Environment: OC4J; Sun jdk1.4.2_10


 Description  « Hide
In some cases XFire client calls to other servers failed with a NPE.
Surprisingly that occured only in some configurations when calls where made from code that was deployed in an OC4J container.

Reason for the NPE:
W3CNamespaceContext.getPrefix(Element e, String uri) does not check if the result 'org.w3c.dom.Element.getAttributes()' is a null.
The next line uses the returned object and fails if it was null.

I added the null-check and the code works fine - even in OC4J
The patched class is attached to this report.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Olaf Boede - 16/Aug/06 05:26 AM
I forgot to report the following:

oc4j version number: oc4j10.1.3

oc4j uses an own jaxp implementation that returns 'null' on getAttributes() when there is no attribute.
That is ok, since the Element interface specification allows that behavior.

Xerces returns an empty nodemap in that situation, which is also allowed.

I have not scanned the rest of the xfire code for unchecked getAttributes() results.


Dan Diephouse - 16/Aug/06 03:25 PM
Well this is a simple enough fix. Thanks for the bug report!

Dan Diephouse - 16/Aug/06 04:15 PM
Alright, fixed this in SVN (actually found another place too). Thanks!