Program: 75141
Project: 75141
Buggy source:
/** 
 * Check if the name corresponds to a nested class in a specified current class. If so, load the nested class and return it. This function does not load anonymous classes with names like "Class$1". Users should not dynamically resolve anonymous classes, because they cannot be instantiated without knowing the enclosing method and the enclosing class.
 * @param dollarName The name of the nested class to be loaded. "$" isused as the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param currentClass The current class from whose scope the nested classis searched for.
 * @return The nested class loaded if found. If no such class is found orerror occurs while loading, the return value is <tt>null</tt>.
 * @see #searchForClass(StringBuffer,boolean,Class)
 */
private Class _checkNestedClass(StringBuffer dollarName,boolean resolve,Class currentClass){
  if (currentClass == null)   return null;
  Set handledSet=new HashSet();
  List workList=new LinkedList();
  workList.add(currentClass);
  while (!workList.isEmpty()) {
    Class c=(Class)workList.remove(0);
    dollarName.insert(0,"String_Node_Str");
    dollarName.insert(0,c.getName());
    try {
      String className=dollarName.toString();
      Class classLoaded=super.loadClass(className,resolve);
      _loadedClasses.put(className,classLoaded);
      return classLoaded;
    }
 catch (    ClassNotFoundException e) {
    }
catch (    NoClassDefFoundError e) {
    }
 finally {
      dollarName.delete(0,c.getName().length() + 1);
    }
    handledSet.add(c);
    Class declaring=c.getDeclaringClass();
    if (declaring != null && !handledSet.contains(declaring))     workList.add(declaring);
    Class superClass=c.getSuperclass();
    if (superClass != null && !handledSet.contains(superClass))     workList.add(superClass);
    Class[] interfaces=c.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Check if the name corresponds to a nested class in a specified current class. If so, load the nested class and return it. This function does not load anonymous classes with names like "Class$1". Users should not dynamically resolve anonymous classes, because they cannot be instantiated without knowing the enclosing method and the enclosing class.
 * @param dollarName The name of the nested class to be loaded. "$" isused as the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param currentClass The current class from whose scope the nested classis searched for.
 * @return The nested class loaded if found. If no such class is found orerror occurs while loading, the return value is <tt>null</tt>.
 * @see #searchForClass(StringBuffer,boolean,Class)
 */
private Class _checkNestedClass(StringBuffer dollarName,boolean resolve,Class currentClass){
  if (currentClass == null)   return null;
  Set handledSet=new HashSet();
  List workList=new LinkedList();
  workList.add(currentClass);
  while (!workList.isEmpty()) {
    Class c=(Class)workList.remove(0);
    dollarName.insert(0,"String_Node_Str");
    dollarName.insert(0,c.getName());
    try {
      String className=dollarName.toString();
      Class classLoaded=super.loadClass(className,resolve);
      _loadedClasses.put(className,classLoaded);
      return classLoaded;
    }
 catch (    ClassNotFoundException e) {
    }
catch (    NoClassDefFoundError e) {
    }
 finally {
      dollarName.delete(0,c.getName().length() + 1);
    }
    handledSet.add(c);
    try {
      Class declaring=c.getDeclaringClass();
      if (declaring != null && !handledSet.contains(declaring))       workList.add(declaring);
    }
 catch (    ClassCircularityError e) {
    }
    if (_enclosingClasses.containsKey(c.getName()))     workList.add(_enclosingClasses.get(c.getName()));
    Class superClass=c.getSuperclass();
    if (superClass != null && !handledSet.contains(superClass))     workList.add(superClass);
    Class[] interfaces=c.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}