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 #37485] Wed, 25 February 2004 18:53 Go to next message
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
Re: NullpointerException in XSDSchemaImpl [message #37522 is a reply to message #37485] Wed, 25 February 2004 19:13 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------13221BC20A38D9A9A41441F6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Muruga,

The Javadoc seems quite clear that I should not expect to get a null for the
attributes of an element:

http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()

One should be able to use a NamedNodeMap to populate the attributes of an
element that initially has no attributes; with this null returning behavior
that's not possible. I think you should take this issue up with the DOM
implementation.


Muruga Chinnananchi wrote:

> 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

--------------13221BC20A38D9A9A41441F6
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Muruga,
<p>The Javadoc seems quite clear that I should not expect to get a null
for the attributes of an element:
<blockquote><a href=" http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l"> http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l</a>&nbsp;
<a href=" http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()"> http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()</a></blockquote>
One should be able to use a NamedNodeMap to populate the attributes of
an element that initially has no attributes; with this null returning behavior
that's not possible.&nbsp; I think you should take this issue up with the
DOM implementation.
<br>&nbsp;
<p>Muruga Chinnananchi wrote:
<blockquote TYPE=CITE>I am using oracle xml parser with eclipse xsd. I
get nullpointer exception
<br>at line 1904 in XSDSchemaImpl.java
<p>04/02/24 18:34:24 >>>>>>>>>> reconcileAttributes
<br>oracle.xml.parser.v2.XMLElement@191f022
<br>04/02/24 18:34:24 java.lang.NullPointerException
<br>04/02/24 18:34:24&nbsp; at
<br> org.eclipse.xsd.impl.XSDSchemaImpl.reconcileAttributes(XSDSc hemaImpl.java:19
<br>04)
<br>04/02/24 18:34:24&nbsp; at
<br> org.eclipse.xsd.impl.XSDConcreteComponentImpl.reconcile(XSDC oncreteComponent
<br>Impl.java:951)
<p>Problem:
<br>I looked at the source, it throws exception in the "for" loop
<br>attributes.getLength().
<br>Because attributes is null in this case.
<br>line 1903: NamedNodeMap attributes = currentElement.getAttributes();
<br>line 1904: for (int i = 0, size = attributes.getLength(); i &lt; size;
++i)
<p>Solution:
<br>Need to do null check for "attributes". After introducing the if condition
<br>the problem goes away.
<p>NamedNodeMap attributes = currentElement.getAttributes();
<br>if (attributes != null) // checking whether attributes is null
<br>{
<br>&nbsp;&nbsp;&nbsp; for (int i = 0, size = attributes.getLength(); i
&lt; size; ++i)
<br>}
<p>thanks,
<br>-muruga</blockquote>
</html>

--------------13221BC20A38D9A9A41441F6--
Re: NullpointerException in XSDSchemaImpl [message #583563 is a reply to message #37485] Wed, 25 February 2004 19:13 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
--------------13221BC20A38D9A9A41441F6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Muruga,

The Javadoc seems quite clear that I should not expect to get a null for the
attributes of an element:

http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()

One should be able to use a NamedNodeMap to populate the attributes of an
element that initially has no attributes; with this null returning behavior
that's not possible. I think you should take this issue up with the DOM
implementation.


Muruga Chinnananchi wrote:

> 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

--------------13221BC20A38D9A9A41441F6
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Muruga,
<p>The Javadoc seems quite clear that I should not expect to get a null
for the attributes of an element:
<blockquote><a href=" http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l"> http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l</a>&nbsp;
<a href=" http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()"> http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.htm l#getAttributes()</a></blockquote>
One should be able to use a NamedNodeMap to populate the attributes of
an element that initially has no attributes; with this null returning behavior
that's not possible.&nbsp; I think you should take this issue up with the
DOM implementation.
<br>&nbsp;
<p>Muruga Chinnananchi wrote:
<blockquote TYPE=CITE>I am using oracle xml parser with eclipse xsd. I
get nullpointer exception
<br>at line 1904 in XSDSchemaImpl.java
<p>04/02/24 18:34:24 >>>>>>>>>> reconcileAttributes
<br>oracle.xml.parser.v2.XMLElement@191f022
<br>04/02/24 18:34:24 java.lang.NullPointerException
<br>04/02/24 18:34:24&nbsp; at
<br> org.eclipse.xsd.impl.XSDSchemaImpl.reconcileAttributes(XSDSc hemaImpl.java:19
<br>04)
<br>04/02/24 18:34:24&nbsp; at
<br> org.eclipse.xsd.impl.XSDConcreteComponentImpl.reconcile(XSDC oncreteComponent
<br>Impl.java:951)
<p>Problem:
<br>I looked at the source, it throws exception in the "for" loop
<br>attributes.getLength().
<br>Because attributes is null in this case.
<br>line 1903: NamedNodeMap attributes = currentElement.getAttributes();
<br>line 1904: for (int i = 0, size = attributes.getLength(); i &lt; size;
++i)
<p>Solution:
<br>Need to do null check for "attributes". After introducing the if condition
<br>the problem goes away.
<p>NamedNodeMap attributes = currentElement.getAttributes();
<br>if (attributes != null) // checking whether attributes is null
<br>{
<br>&nbsp;&nbsp;&nbsp; for (int i = 0, size = attributes.getLength(); i
&lt; size; ++i)
<br>}
<p>thanks,
<br>-muruga</blockquote>
</html>

--------------13221BC20A38D9A9A41441F6--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:NullpointerException in XSDSchemaImpl
Next Topic:ClassCastException in XSDSchemaImpl
Goto Forum:
  


Current Time: Fri Apr 26 06:54:17 GMT 2024

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

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

Back to the top