Troubleshooting

Accessing Properties

Q1:Why do I have strange properties like "class" that aren't in my bean?
The introspector is picking up properties and methods from the superclass. Use the optional "stop class" parameter to tell the introspector where to stop. For example, if your class extends java.lang.Object, pass Object.class as the second parameter of the getBeanInfo class.
Q2:Why do I get a NullPointerException when I access a particular property?
The introspector reports a property if it sees either a get or a set method; it doesn't need to see both. If you have a get method with no corresponding set method, the getWriteMethod method in the PropertyDescriptor object returns null. The getReadMethod method returns null if there is no

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.