Program: 74538
Project: 74538
Buggy source:
/** 
 * Check if the given name refers to an array class. If so, load the array class.
 * @param name The name of the class to be loaded.
 * @param search If <tt>true</tt>, the class for elements in thearray is searched for with  {@link #searchForClass(StringBuffer,Class)}; otherwise, the name of the class for elements is considered a complete class name, and   {@link #loadClass(String)} is usedto load it.
 * @return The class loaded if not <tt>null</tt>. If the name doesnot refer to an array class, the return value is <tt>null</tt>.
 * @exception ClassNotFoundException If the name refers toan array class but the class cannot be loaded.
 * @see #searchForClass(StringBuffer,Class)
 */
private Class _checkArrayClass(StringBuffer name,boolean search) throws ClassNotFoundException {
  boolean isPrimitiveArray;
  int nameStart=0;
  int nameEnd=name.length() - 1;
  if (name.charAt(nameStart) == '[') {
    while (name.charAt(nameStart) == '[') {
      nameStart++;
    }
    if (name.charAt(nameStart) == 'L') {
      nameStart++;
      nameEnd--;
      isPrimitiveArray=false;
    }
 else {
      isPrimitiveArray=true;
    }
  }
 else   if (name.charAt(nameEnd) == ']') {
    while (name.charAt(nameEnd) == ']') {
      nameEnd-=2;
    }
    isPrimitiveArray=Type.isPrimitive(name.substring(nameStart,nameEnd + 1));
  }
 else {
    return null;
  }
  if (isPrimitiveArray) {
    String typeName=Type.toArrayType(name.toString());
    Class c=super.loadClass(typeName,true);
    _loadedClasses.put(typeName,c);
    return c;
  }
 else {
    Class c=search ? searchForClass(new StringBuffer(name.substring(nameStart,nameEnd + 1)),_currentClass) : super.loadClass(name.substring(nameStart,nameEnd + 1),true);
    name.delete(nameStart,nameEnd + 1);
    name.insert(nameStart,c.getName());
    String typeName=Type.toArrayType(name.toString());
    c=Class.forName(typeName,true,this);
    _loadedClasses.put(typeName,c);
    return c;
  }
}

Fixed version (ground truth):
/** 
 * Check if the given name refers to an array class. If so, load the array class.
 * @param name The name of the class to be loaded.
 * @param search If <tt>true</tt>, the class for elements in thearray is searched for with  {@link #searchForClass(StringBuffer,Class)}; otherwise, the name of the class for elements is considered a complete class name, and   {@link #loadClass(String)} is usedto load it.
 * @return The class loaded if not <tt>null</tt>. If the name doesnot refer to an array class, the return value is <tt>null</tt>.
 * @exception ClassNotFoundException If the name refers toan array class but the class cannot be loaded.
 * @see #searchForClass(StringBuffer,Class)
 */
private Class _checkArrayClass(StringBuffer name,boolean search) throws ClassNotFoundException {
  boolean isPrimitiveArray;
  int nameStart=0;
  int nameEnd=name.length() - 1;
  if (name.charAt(nameStart) == '[') {
    while (name.charAt(nameStart) == '[') {
      nameStart++;
    }
    if (name.charAt(nameStart) == 'L') {
      nameStart++;
      nameEnd--;
      isPrimitiveArray=false;
    }
 else {
      isPrimitiveArray=true;
    }
  }
 else   if (name.charAt(nameEnd) == ']') {
    while (name.charAt(nameEnd) == ']') {
      nameEnd-=2;
    }
    isPrimitiveArray=Type.isPrimitive(name.substring(nameStart,nameEnd + 1));
  }
 else {
    return null;
  }
  if (isPrimitiveArray) {
    String typeName=name.toString();
    Class c=super.loadClass(typeName,true);
    c=java.lang.reflect.Array.newInstance(c,0).getClass();
    typeName=Type.toArrayType(typeName);
    _loadedClasses.put(typeName,c);
    return c;
  }
 else {
    Class c=search ? searchForClass(new StringBuffer(name.substring(nameStart,nameEnd + 1)),_currentClass) : super.loadClass(name.substring(nameStart,nameEnd + 1),true);
    name.delete(nameStart,nameEnd + 1);
    name.insert(nameStart,c.getName());
    String typeName=name.toString();
    c=Class.forName(typeName,true,this);
    c=java.lang.reflect.Array.newInstance(c,0).getClass();
    typeName=Type.toArrayType(typeName);
    _loadedClasses.put(typeName,c);
    return c;
  }
}