Null object references in instance fields causes Null pointer crash
-------------------------------------------------------------------
Key: IMPERIUS-19
URL: https://issues.apache.org/jira/browse/IMPERIUS-19
Project: Imperius
Issue Type: Bug
Environment: Windows, Eclipse
Reporter: David Wood
Assignee: Bill Stoddard
I've found that for an imported policy class that has a field with an
uninitialized object field value, the
JavaDataCollectorImpl.getSymbolsForInstance() gives a null pointer error in
Hashtable since Imperius tries to install the null value in the table. A fix
that has worked for us is the following (simply check for null before
inserting):
// Iterate over the fields
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
// Get the instance value of the current field
Object value = f.get(instance);
String fieldName = f.getName();
// Insert into map
if (value != null)
instanceMemberValues.put(fieldName,
value);
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.