Program: 75087
Project: 75087
Buggy source:
/** 
 * Lookup a class with a partially given name as may appear in Java source code. The name may be relative to the current class and its enclosing classes. It may also be a full name.
 * @param partialSimpleName The partially given classname.
 * @return The class; <tt>null</tt> is returned if theclass cannot be found.
 */
private Class _lookupClass(String partialSimpleName){
  int dotPos=partialSimpleName.indexOf('.');
  String simpleName;
  if (dotPos == -1)   simpleName=partialSimpleName;
 else   simpleName=partialSimpleName.substring(0,dotPos);
  Class result=null;
  Stack previousClasses=_state.getPreviousClasses();
  int previousNumber=previousClasses.size();
  for (int i=previousNumber; i >= 0; i--) {
    Class workingClass=i == previousNumber ? _state.getCurrentClass() : (Class)previousClasses.get(i);
    if (workingClass != null) {
      if (_getSimpleClassName(workingClass).equals(simpleName)) {
        result=workingClass;
        break;
      }
      Class[] declaredClasses=workingClass.getDeclaredClasses();
      for (int j=0; j < declaredClasses.length; j++)       if (_getSimpleClassName(declaredClasses[j]).equals(simpleName)) {
        result=declaredClasses[j];
        break;
      }
      if (result != null)       break;
    }
  }
  if (result == null && _importedClasses.containsKey(simpleName))   result=(Class)_importedClasses.get(simpleName);
  if (result != null && dotPos >= 0)   try {
    result=_state.getClassLoader().loadClass(result.getName() + partialSimpleName.substring(dotPos));
  }
 catch (  ClassNotFoundException e) {
    result=null;
  }
  if (result == null)   try {
    result=_state.getClassLoader().searchForClass(partialSimpleName);
  }
 catch (  ClassNotFoundException e) {
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Lookup a class with a partially given name as may appear in Java source code. The name may be relative to the current class and its enclosing classes. It may also be a full name.
 * @param partialSimpleName The partially given classname.
 * @return The class; <tt>null</tt> is returned if theclass cannot be found.
 */
private Class _lookupClass(String partialSimpleName){
  int dotPos=partialSimpleName.indexOf('.');
  String simpleName;
  if (dotPos == -1)   simpleName=partialSimpleName;
 else   simpleName=partialSimpleName.substring(0,dotPos);
  Class result=null;
  if (result == null) {
    Stack previousClasses=_state.getPreviousClasses();
    int previousNumber=previousClasses.size();
    for (int i=previousNumber; i >= 0; i--) {
      Class workingClass=null;
      if (i == previousNumber)       workingClass=_state.getCurrentClass();
 else {
        Object previousObject=previousClasses.get(i);
        if (previousObject instanceof Class)         workingClass=(Class)previousObject;
 else         if (previousObject != null) {
          Hashtable previousTable=(Hashtable)previousObject;
          if (previousTable != null && previousTable.keySet().contains(simpleName)) {
            result=(Class)previousTable.get(simpleName);
            break;
          }
        }
      }
      if (workingClass != null) {
        if (_getSimpleClassName(workingClass).equals(simpleName)) {
          result=workingClass;
          break;
        }
        Class[] declaredClasses=workingClass.getDeclaredClasses();
        for (int j=0; j < declaredClasses.length; j++)         if (_getSimpleClassName(declaredClasses[j]).equals(simpleName)) {
          result=declaredClasses[j];
          break;
        }
        if (result != null)         break;
      }
    }
  }
  if (result == null && _importedClasses.containsKey(simpleName))   result=(Class)_importedClasses.get(simpleName);
  if (result != null && dotPos >= 0)   try {
    result=_state.getClassLoader().loadClass(result.getName() + partialSimpleName.substring(dotPos));
  }
 catch (  ClassNotFoundException e) {
    result=null;
  }
  if (result == null)   try {
    result=_state.getClassLoader().searchForClass(partialSimpleName);
  }
 catch (  ClassNotFoundException e) {
  }
  return result;
}