axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16977] New: - MessageElement.getNamespaceURI() results in a NullPointer if element has an href that does not successfuly resolve
Date Tue, 11 Feb 2003 22:08:42 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16977>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16977

MessageElement.getNamespaceURI() results in a NullPointer if element has an href that does
not successfuly resolve

           Summary: MessageElement.getNamespaceURI() results in a
                    NullPointer if element has an href that does not
                    successfuly resolve
           Product: Axis
           Version: current (nightly)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: tarass@grandcentral.com


When a message element has an href that fails to resolve, you can not lookup 
namespace URI by prefix, and you can not lookup prefixes by namespace.

Patch provided is for 1.0 build, but current nightly build still has the same 
problem.

Sample JUnit test:
    public void testMessageElementNullOngetNamespaceURI() throws Exception{
        String data="<anElement xmlns:ns1=\"aNamespace\" 
href=\"unknownProtocol://data\"/>";
        data="<SOAP-ENV:Envelope xmlns:SOAP-
ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>"+
             data+"</SOAP-ENV:Body></SOAP-ENV:Envelope>";
        MessageContext ctx=new MessageContext(new AxisClient());
        DeserializationContext dser = new DeserializationContextImpl(
                                           new org.xml.sax.InputSource(new 
StringReader(data)),
                                           ctx,
                                           Message.REQUEST);
        dser.parse();
		MessageElement elem=dser.getEnvelope().getBodyByName
("","anElement");
        assertEquals("aNamespace",elem.getNamespaceURI("ns1"));
        assertEquals("ns1",elem.getPrefix("aNamespace"));
    }

patch to the MessageElement.java:
RCS file: /home/cvspublic/xml-
axis/java/src/org/apache/axis/message/MessageElement.java,v
retrieving revision 1.128.4.1
diff -r1.128.4.1 MessageElement.java
315c315
<     
---
> 
448c448,450
<             return getRealElement().getPrefix(namespaceURI);
---
>             MessageElement realElement=getRealElement();
> 			if(realElement!=null)
> 				return realElement.getPrefix(namespaceURI);
470c472,474
<             return getRealElement().getNamespaceURI(prefix);
---
>             MessageElement realElement=getRealElement();
> 			if(realElement!=null)
> 				return realElement.getNamespaceURI(prefix);

Mime
View raw message