Magne Rasmussen commented on Bug XSTR-749

The field's type may never be null, but the way superclasses of the fields type are looked up, a NPE is almost certain:

FieldDictionary.java
124                final List superClasses = new ArrayList();
125                while (!Object.class.equals(cls)) {
126                    superClasses.add(0, cls);
127                    cls = cls.getSuperclass();
128                }

The problem is in line 127 (line numbers from version 1.4.6). The javadoc of Class.getSuperclass() states:

Returns the Class representing the superclass of the entity (class, interface, primitive type or void) represented by this Class. If this Class represents either the Object class, an interface, a primitive type, or void, then null is returned.

So, if the type of a field is an interface, we will get a NPE in line 127. The trivial fix is to augment the test in line 125:

FieldDictionary.java
124                final List superClasses = new ArrayList();
125                while (!Object.class.equals(cls) && cls != null) {
126                    superClasses.add(0, cls);
127                    cls = cls.getSuperclass();
128                }
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to