The NPE is actually caused when the AnnotationException handler formats the message to wrap and re-throw.
throw new AnnotationException( "Unable to map collection " + collectionEntity.getClassName() + "." + property.getName(), ex );
The calling statement at BagBinder(CollectionBinder).bindOneToManySecondPass(Collection, Map, Ejb3JoinColumn[], XClass, boolean, boolean, Mappings, Map<XClass,InheritanceState>) line: 864 explicitly passes null in the collectionEntity parameter:
bindCollectionSecondPass( collection, null, fkJoinColumns, cascadeDeleteEnabled, property, mappings );
The NPE can easily be fixed with something like below (leaving the developer to work out what caused the original exception).
throw new AnnotationException( "Unable to map collection " + (collectionEntity == null ? "null" : collectionEntity.getClassName()) + "." + property.getName(), ex );
|