Kasia Trapszo wrote:
> When I try to unmarshall a SOAPElement, I get a null pointer exception,
> (stack trace follows). If I convert that element to string then
> unmarshall the string, it works perfectly fine. Has anyone encountered
> this before?
Interesting. The relevant code is:
> /**
> * Recursively visit ancestors and build up {_at_link NamespaceSupport} oject.
> */
> private void buildNamespaceSupport(NamespaceSupport nss, Node node) {
> if(!(node instanceof Element))
> return;
>
> buildNamespaceSupport( nss, node.getParentNode() );
>
> nss.pushContext();
> NamedNodeMap atts = node.getAttributes();
> for( int i=0; i<atts.getLength(); i++ ) {
> Attr a = (Attr)atts.item(i);
> if( "xmlns".equals(a.getPrefix()) ) {
> nss.declarePrefix( a.getLocalName(), a.getValue() );
> continue;
> }
> if( "xmlns".equals(a.getName()) ) {
> nss.declarePrefix( "", a.getValue() );
> continue;
> }
> }
> }
... and therefore I think the only possibility is either a bug in SAAJ,
or it might be a DOM object implementing multiple DOM interfaces (it
must be implementing an Element but not behaving as one, as it returns
null from the getAttributes method.
I changed
> if(!(node instanceof Element))
to:
> if(node.getNodeType()!=Node.ELEMENT_NODE)
so try tonight's nightly build.
If you can attach a debugger to this point and tell us which class is
"node", that would be very helpful.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com