Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » NullpointerException in XSDSchemaImpl
NullpointerException in XSDSchemaImpl [message #583549] Wed, 25 February 2004 18:53
Eclipse UserFriend
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: Fri Apr 26 22:47:11 GMT 2024

Powered by FUDForum. Page generated in 0.02585 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top