Index: src/main/java/java/beans/beancontext/BeanContextSupport.java =================================================================== --- src/main/java/java/beans/beancontext/BeanContextSupport.java (revision 430780) +++ src/main/java/java/beans/beancontext/BeanContextSupport.java (working copy) @@ -779,6 +779,10 @@ throw new NullPointerException("The child can not be null"); } + if (!containsKey(bcc)) { + throw new IllegalArgumentException("Not a valid child"); + } + // Load resource using the same ClassLoader as BeanContextChild specified // If NullPointerException occurs try to load it as system resource try { @@ -809,6 +813,10 @@ throw new NullPointerException("The child can not be null"); } + if (!containsKey(bcc)) { + throw new IllegalArgumentException("Not a valid child"); + } + // Load resource using the same ClassLoader as BeanContextChild specified // If NullPointerException occurs try to load it as system resource try {