Yes, by "non-namespaced" I mean something similar to your example. In
particular its an attribute I've added to an element in a SOAP envelope
using the following code;
javax.xml.soap.Name myAttribName =
soapFactory.createName("myattrib");
mySOAPElement.addAttribute(myAttribName, "a test");
Running the canonicalizer over the resulting soap envelope throws the null
pointer exception.
Does that imply that SOAPElement.addAttribute(Name name, String value) uses
DOM Level 1 calls?
The following, however, works:
javax.xml.soap.Name myAttribName =
soapFactory.createName("myattrib","myns","http://www.foo.com/myns");
mySOAPElement.addAttribute(myAttribName, "a test");
Steve
-----Original Message-----
From: Berin Lautenbach [mailto:[EMAIL PROTECTED]
Sent: Monday, 29 March 2004 11:15 p.m.
To: [EMAIL PROTECTED]
Subject: Re: Canonicalizer bug ?
Stephen,
When you say "non-namespaced" does that mean you have added via a DOM
level 1 call, or simply that the XML looks something like :
<myns:elt1 attributewithoutns="a test"/>
The latter should work. I haven't tried it myself, but my understanding
is the former is likely to fail (use L2 calls instead, with a null NS -
e.g. setAttributeNS).
Cheers,
Berin
Stephen Chell (DSL AK) wrote:
> I'm getting the following exception when I call
> XMLUtils.outputDOMc14nWithComments(doc, f) and the document contains an
> element with a non-namespaced attribute. (The element is namespaced.)
If
> I change the attribute so that it is namespaced, it works. Is this a
> known bug?
>
> Thanks
> Steve
>
> java.lang.NullPointerException
> at java.lang.String.compareTo(String.java:728)
> at
>
org.apache.xml.security.c14n.helper.NonNSAttrCompare.compare(NonNSAttrCompar
> e.java:125)
> at java.util.Arrays.mergeSort(Arrays.java:1278)
> at java.util.Arrays.sort(Arrays.java:1219)
> at
>
org.apache.xml.security.c14n.helper.C14nHelper.sortAttributes(C14nHelper.jav
> a:123)
> at
> org.apache.xml.security.c14n.implementations.Canonicalizer20010315.han
> dleAtt
> ributesSubtree(Canonicalizer20010315.java:307)
> at
>
org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeS
> ubTree(CanonicalizerBase.java:224)
> at
>
org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeS
> ubTree(CanonicalizerBase.java:238)
> at
>
org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeS
> ubTree(CanonicalizerBase.java:238)
> at
>
org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeS
> ubTree(CanonicalizerBase.java:176)
> at
>
org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonic
> alizeSubTree(CanonicalizerBase.java:129)
> at
>
org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Canonicalizer
> .java:266)
> at
>
org.apache.xml.security.utils.XMLUtils.outputDOMc14nWithComments(XMLUtils.ja
> va:576)
> at test.CreateSignature2.main(CreateSignature2.java:138)
> Exception in thread "main"
> Process exited with exit code 1.
>
>