[
https://issues.apache.org/jira/browse/IMPERIUS-19?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647639#action_12647639
]
Neeraj Joshi commented on IMPERIUS-19:
--------------------------------------
Thanks David for pointing this out. Checked in fix
Neeraj
> 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
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> 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.