Browse Source

Check to ensure the child object returned is not null before adding to list of child objects to validate.

Matthew Porter 20 năm trước cách đây
mục cha
commit
625efa4782

+ 4 - 2
domain/src/main/java/org/acegisecurity/domain/hibernate/IntrospectionManagerHibernate.java

@@ -122,8 +122,10 @@ public class IntrospectionManagerHibernate implements IntrospectionManager,
                     // only if a Validator is registered for that Object
                     if (this.validationRegistryManager.findValidator(
                             propertyType.getReturnedClass()) != null) {
-                        allObjects.add(classMetadata.getPropertyValue(
-                                parentObject, propertyNames[i], EntityMode.POJO));
+                        Object childObject = classMetadata.getPropertyValue(parentObject, propertyNames[i], EntityMode.POJO);
+                        if (childObject != null) {
+                            allObjects.add(childObject);
+                        }
                     }
                 }
             }