Program: 64765
Project: 64765
Buggy source:
public void convertClassNamesToClasses(ClassLoader classLoader){
  Iterator<Entry<XMLField,String>> entries=fieldToClassNameMappings.entrySet().iterator();
  while (entries.hasNext()) {
    Map.Entry<XMLField,String> entry=entries.next();
    String className=entry.getValue();
    Class elementType=null;
    try {
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        try {
          elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
        }
 catch (        PrivilegedActionException exception) {
          throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
        }
      }
 else {
        elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
      }
    }
 catch (    ClassNotFoundException exc) {
      throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
    }
    XMLMapping mapping=this.choiceElementMappings.get(entry.getKey());
    mapping.convertClassNamesToClasses(classLoader);
    if (fieldToClassMappings.get(entry.getKey()) == null) {
      fieldToClassMappings.put(entry.getKey(),elementType);
    }
  }
  for (  Entry<String,XMLField> next : this.classNameToFieldMappings.entrySet()) {
    String className=next.getKey();
    Class elementType=null;
    try {
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        try {
          elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
        }
 catch (        PrivilegedActionException exception) {
          throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
        }
      }
 else {
        elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
      }
    }
 catch (    ClassNotFoundException exc) {
      throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
    }
    classToFieldMappings.put(elementType,next.getValue());
  }
  if (classNameToSourceFieldsMappings != null) {
    Iterator<Entry<String,List<XMLField>>> sourceFieldEntries=classNameToSourceFieldsMappings.entrySet().iterator();
    while (sourceFieldEntries.hasNext()) {
      Entry<String,List<XMLField>> nextEntry=sourceFieldEntries.next();
      String className=nextEntry.getKey();
      List<XMLField> fields=nextEntry.getValue();
      Class elementType=null;
      try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
          try {
            elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
          }
 catch (          PrivilegedActionException exception) {
            throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
          }
        }
 else {
          elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
        }
      }
 catch (      ClassNotFoundException exc) {
        throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
      }
      this.getClassToSourceFieldsMappings().put(elementType,fields);
    }
  }
  if (classNameToConverter != null) {
    if (this.classToConverter == null) {
      this.classToConverter=new HashMap<Class,Converter>();
    }
    for (    Entry<String,Converter> next : classNameToConverter.entrySet()) {
      String className=next.getKey();
      Class elementType=null;
      try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
          try {
            elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
          }
 catch (          PrivilegedActionException exception) {
            throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
          }
        }
 else {
          elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
        }
      }
 catch (      ClassNotFoundException exc) {
        throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
      }
      this.classToConverter.put(elementType,next.getValue());
    }
  }
}

Fixed version (ground truth):
public void convertClassNamesToClasses(ClassLoader classLoader){
  Iterator<Entry<XMLField,String>> entries=fieldToClassNameMappings.entrySet().iterator();
  while (entries.hasNext()) {
    Map.Entry<XMLField,String> entry=entries.next();
    String className=entry.getValue();
    Class elementType=null;
    try {
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        try {
          elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
        }
 catch (        PrivilegedActionException exception) {
          throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
        }
      }
 else {
        elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
      }
    }
 catch (    ClassNotFoundException exc) {
      throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
    }
    XMLMapping mapping=this.choiceElementMappings.get(entry.getKey());
    mapping.convertClassNamesToClasses(classLoader);
    if (fieldToClassMappings.get(entry.getKey()) == null) {
      fieldToClassMappings.put(entry.getKey(),elementType);
    }
  }
  for (  Entry<String,XMLField> next : this.classNameToFieldMappings.entrySet()) {
    String className=next.getKey();
    Class elementType=null;
    try {
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        try {
          elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
        }
 catch (        PrivilegedActionException exception) {
          throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
        }
      }
 else {
        elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
      }
    }
 catch (    ClassNotFoundException exc) {
      throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
    }
    classToFieldMappings.put(elementType,next.getValue());
  }
  if (classNameToSourceFieldsMappings != null) {
    Iterator<Entry<String,List<XMLField>>> sourceFieldEntries=classNameToSourceFieldsMappings.entrySet().iterator();
    while (sourceFieldEntries.hasNext()) {
      Entry<String,List<XMLField>> nextEntry=sourceFieldEntries.next();
      String className=nextEntry.getKey();
      List<XMLField> fields=nextEntry.getValue();
      Class elementType=null;
      try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
          try {
            elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
          }
 catch (          PrivilegedActionException exception) {
            throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
          }
        }
 else {
          elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
        }
      }
 catch (      ClassNotFoundException exc) {
        throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
      }
      this.getClassToSourceFieldsMappings().put(elementType,fields);
    }
  }
  if (classNameToConverter != null) {
    if (this.classToConverter == null) {
      this.classToConverter=new HashMap<Class,Converter>();
    }
    for (    Entry<String,Converter> next : classNameToConverter.entrySet()) {
      String className=next.getKey();
      Class elementType=null;
      try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
          try {
            elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
          }
 catch (          PrivilegedActionException exception) {
            throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
          }
        }
 else {
          elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
        }
      }
 catch (      ClassNotFoundException exc) {
        throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
      }
      this.classToConverter.put(elementType,next.getValue());
    }
  }
  if (!choiceElementMappingsByClassName.isEmpty()) {
    for (    Entry<String,XMLMapping> next : choiceElementMappingsByClassName.entrySet()) {
      Class elementType=null;
      String className=next.getKey();
      try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
          try {
            elementType=(Class)AccessController.doPrivileged(new PrivilegedClassForName(className,true,classLoader));
          }
 catch (          PrivilegedActionException exception) {
            throw ValidationException.classNotFoundWhileConvertingClassNames(className,exception.getException());
          }
        }
 else {
          elementType=org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(className,true,classLoader);
        }
      }
 catch (      ClassNotFoundException exc) {
        throw ValidationException.classNotFoundWhileConvertingClassNames(className,exc);
      }
      if (this.choiceElementMappingsByClass.get(elementType) == null) {
        this.choiceElementMappingsByClass.put(elementType,next.getValue());
      }
      next.getValue().convertClassNamesToClasses(classLoader);
    }
  }
}