You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Eduardo Issao Ito <zi...@summa-tech.com> on 2004/10/29 23:10:11 UTC

BUG: MessageElement should implement NodeList

It seems I found a bug in Axis-1_2RC1:

The class org.apache.axis.message.MessageElement does not implement the
interface org.w3c.dom.NodeList.

So, the method getElementsByTagName gives a ClassCastException:

    public NodeList getElementsByTagName(String tagName) {
        //use this MessageElement class for Nodelist store
        MessageElement nodelist = new MessageElement();


java.lang.ClassCastException
	at
org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1813)
	at
org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1818)


Any comments?


=====
<Eduardo Issao Ito/>
<Summa Technologies/>

Re: BUG: MessageElement should implement NodeList

Posted by Eduardo Issao Ito <zi...@summa-tech.com>.
Well, you are rigth it implements NodeList, I've missed it...
But still a bug.

The workaround is to use getElementsByTagNameNS()...

 --- Dan Ciarniello <dc...@cityxpress.com> escreveu: 
> Eduardo Issao Ito wrote:
> 
> >It seems I found a bug in Axis-1_2RC1:
> >
> >The class org.apache.axis.message.MessageElement does not implement
> the
> >interface org.w3c.dom.NodeList.
> >
> >So, the method getElementsByTagName gives a ClassCastException:
> >
> >    public NodeList getElementsByTagName(String tagName) {
> >        //use this MessageElement class for Nodelist store
> >        MessageElement nodelist = new MessageElement();
> >
> >
> >java.lang.ClassCastException
> >	at
>
>org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1813)
> >	at
>
>org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1818)
> >
> >
> >Any comments?
> >
> >
> >=====
> ><Eduardo Issao Ito/>
> ><Summa Technologies/>
> >  
> >
> The source code for 1.2RC1 defines MessageElement as
> 
> public class MessageElement extends NodeImpl implements SOAPElement,
>         Serializable,
>         org.w3c.dom.NodeList,  // ADD Nodelist Interfaces for SAAJ
> 1.2
>         Cloneable
> 
> so it does implement NodeList.  However, line 1813 of 
> MessageElement.java is:
> 
> nodelist.addChild((MessageElement)children.get(i));
> 
> which is where your stack trace says the exception occurred.  This 
> implies that whatever children.get(i) should be returning an object
> that 
> is or extends a MessageElement but is not. 
> 
> It still looks like a bug.
> 
> Dan.
> 
> > begin:vcard
> fn:Dan Ciarniello
> n:Ciarniello;Dan
> org:CityXpress Corp
> adr;dom:;;200 - 1727 West Broadway;Vancouver;BC;V6J 4W5
> email;internet:dciarniello@cityxpress.com
> title:Software Developer
> tel;work:604-638-3800 ext. 322
> x-mozilla-html:TRUE
> url:http://www.cityxpress.com
> version:2.1
> end:vcard
> 
>  

=====
<Eduardo Issao Ito/>
<Summa Technologies/>

Re: BUG: MessageElement should implement NodeList

Posted by Dan Ciarniello <dc...@cityxpress.com>.
Eduardo Issao Ito wrote:

>It seems I found a bug in Axis-1_2RC1:
>
>The class org.apache.axis.message.MessageElement does not implement the
>interface org.w3c.dom.NodeList.
>
>So, the method getElementsByTagName gives a ClassCastException:
>
>    public NodeList getElementsByTagName(String tagName) {
>        //use this MessageElement class for Nodelist store
>        MessageElement nodelist = new MessageElement();
>
>
>java.lang.ClassCastException
>	at
>org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1813)
>	at
>org.apache.axis.message.MessageElement.getElementsByTagName(MessageElement.java:1818)
>
>
>Any comments?
>
>
>=====
><Eduardo Issao Ito/>
><Summa Technologies/>
>  
>
The source code for 1.2RC1 defines MessageElement as

public class MessageElement extends NodeImpl implements SOAPElement,
        Serializable,
        org.w3c.dom.NodeList,  // ADD Nodelist Interfaces for SAAJ 1.2
        Cloneable

so it does implement NodeList.  However, line 1813 of 
MessageElement.java is:

nodelist.addChild((MessageElement)children.get(i));

which is where your stack trace says the exception occurred.  This 
implies that whatever children.get(i) should be returning an object that 
is or extends a MessageElement but is not. 

It still looks like a bug.

Dan.