You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/10/31 17:56:44 UTC
DO NOT REPLY [Bug 14140] New: -
getNamespacePrefixes of MessageElement throws a NullPointerException if no namespaces have been declared.
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=14140>.
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=14140
getNamespacePrefixes of MessageElement throws a NullPointerException if no namespaces have been declared.
Summary: getNamespacePrefixes of MessageElement throws a
NullPointerException if no namespaces have been
declared.
Product: Axis
Version: 1.0
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization/Deserialization
AssignedTo: axis-dev@xml.apache.org
ReportedBy: chrisw@wolfram.com
When getNamespacePrefixes() is called on a MessageElement and there are no
namespaces registered, a NullPointerException is thrown. This method should
probably return an empty Iterator or null.
Example....
### GetNamespacePrefixesTest.java ###
import org.apache.axis.message.MessageElement;
import java.util.Iterator;
public class GetNamespacePrefixesTest
{
public GetNamespacePrefixesTest()
{
}
public static void main(String[] args)
{
try
{
MessageElement me =
new MessageElement("http://www.wolfram.com","Test");
Iterator it = me.getNamespacePrefixes();
while(it.hasNext())
{
String prefix = (String)it.next();
System.out.println(prefix + ":" + me.getNamespaceURI(prefix));
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Result ...
java.lang.NullPointerException
at org.apache.axis.message.MessageElement.getNamespacePrefixes
(MessageElement.java:1021)
at GetNamespacePrefixesTest.main(GetNamespacePrefixesTest.java:16)