Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » NullpointerException in XSDSchemaImpl
NullpointerException in XSDSchemaImpl [message #583549] Wed, 25 February 2004 13:53
Eclipse User
Originally posted by: cipher8000.yahoo.com

I am using oracle xml parser with eclipse xsd. I get nullpointer exception
at line 1904 in XSDSchemaImpl.java

04/02/24 18:34:24 >>>>>>>>>> reconcileAttributes
oracle.xml.parser.v2.XMLElement@191f022
04/02/24 18:34:24 java.lang.NullPointerException
04/02/24 18:34:24 at
org.eclipse.xsd.impl.XSDSchemaImpl.reconcileAttributes(XSDSc hemaImpl.java:19
04)
04/02/24 18:34:24 at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.reconcile(XSDC oncreteComponent
Impl.java:951)

Problem:
I looked at the source, it throws exception in the "for" loop
attributes.getLength().
Because attributes is null in this case.
line 1903: NamedNodeMap attributes = currentElement.getAttributes();
line 1904: for (int i = 0, size = attributes.getLength(); i < size; ++i)

Solution:
Need to do null check for "attributes". After introducing the if condition
the problem goes away.

NamedNodeMap attributes = currentElement.getAttributes();
if (attributes != null) // checking whether attributes is null
{
for (int i = 0, size = attributes.getLength(); i < size; ++i)
}


thanks,
-muruga
Previous Topic:ClassCastException in XSDSchemaImpl
Next Topic:NullpointerException in XSDSchemaImpl
Goto Forum:
  


Current Time: Wed Apr 23 02:50:17 EDT 2014

Powered by FUDForum. Page generated in 0.14789 seconds