Community
Participate
Working Groups
Caused by: java.lang.NullPointerException at org.eclipse.persistence.indirection.IndirectSet.size(IndirectSet.java:501) When an attribute is typed as Set or Map and mapped using transparent indirection (IndirectSet, IndirectMap), setting a default ValueHolder instance into the IndirectContainer's ValueHolder will return null when buildDelegate() is called internally to the IndirectSet/IndirectMap. If null is returned by buildDelegate, operations such as size() on the IndirectSet/Map will fail with a spurious NullPointerException. This does not occur for IndirectList, as this situation is handled in buildDelegate() with a null check which returns a default List object on null instead of null itself. The potential fix for this issue is to check for a null ValueHolder delegate within the buildDelegate methods of IndirectSet and IndirectMap. If null is detected, instantiate and return a "default" collection specific to the indirect container.
Created attachment 195443 [details] Proposed fix, and testcase - Main changes are to buildDelegate for IndirectSet and IndirectMap - Removed unneeded "testing prototype" IndirectSet and changed test references to use the correct EL IndirectSet - Added NullDelegateInValueHolderTest (for each container) to TransparentIndirectionModel
Created attachment 195513 [details] Proposed fix, and testcase Forgot to svn 'add' the actual testcase class. Corrected.
Checked in changes to trunk (2.3) at revision 9370 Reviewed: Gordon Yorke
Checked into 2.1 trunk at revision: 9444
Checked into 2.2 trunk at revision 9445
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink