Program: 74537
Project: 74537
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 arrayCount=0;
  int nameEnd=name.length() - 1;
  if (name.charAt(nameStart) == '[') {
    while (name.charAt(nameStart) == '[') {
      nameStart++;
    }
    arrayCount=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;
  }
  String basicName=name.substring(nameStart,nameEnd + 1);
  Class c;
  if (isPrimitiveArray || !search) {
    c=super.loadClass(basicName,true);
  }
 else {
    c=searchForClass(new StringBuffer(basicName),_currentClass);
  }
  for (int i=0; i < arrayCount; i++) {
    c=java.lang.reflect.Array.newInstance(c,0).getClass();
  }
  String typeName=Type.toArrayType(name.toString());
  _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 arrayCount=0;
  int nameEnd=name.length() - 1;
  if (name.charAt(nameStart) == '[') {
    while (name.charAt(nameStart) == '[') {
      nameStart++;
    }
    arrayCount=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;
  }
  String basicName=name.substring(nameStart,nameEnd + 1);
  Class c;
  if (isPrimitiveArray) {
    if (basicName.equals("String_Node_Str")) {
      c=boolean.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=byte.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=char.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=double.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=float.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=int.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=long.class;
    }
 else     if (basicName.equals("String_Node_Str")) {
      c=short.class;
    }
 else {
      throw new ClassNotFoundException("String_Node_Str" + "String_Node_Str" + basicName);
    }
  }
 else   if (search) {
    c=searchForClass(new StringBuffer(basicName),_currentClass);
  }
 else {
    c=super.loadClass(basicName,true);
  }
  for (int i=0; i < arrayCount; i++) {
    c=java.lang.reflect.Array.newInstance(c,0).getClass();
  }
  String typeName=Type.toArrayType(name.toString());
  _loadedClasses.put(typeName,c);
  return c;
}