private static boolean checkLoaderAncestry(ClassLoader child,ClassLoader ancestor){
  if (ancestor == null) {
    return true;
  }
 else   if (child == null) {
    return false;
  }
 else {
    for (ClassLoader parent=child; parent != null; parent=parent.getParent()) {
      if (parent == ancestor) {
        return true;
      }
    }
    return false;
  }
}

private static boolean checkLoaderAncestry ( ClassLoader child , ClassLoader ancestor ) { if ( ancestor == null ) { return true ; } else if ( child == null ) { return false ; } else { for ( ClassLoader parent = child ; parent != null ; parent = parent . getParent ( ) ) { if ( parent == ancestor ) { return true ; } } return false ; } }
return true if the first class loader is a child of ( or identical to ) the second class loader . either loader may be " null " , which is considered to be the parent of any non - null class loader . ( utility method added for the 1 . 2beta4 fix for 4149366 )
