Program: 63375
Project: 63375
Buggy source:
/** 
 * Create an instance of   {@link ServerPlatform} from parameters passed in.
 * @param session {@link DatabaseSession} which will be passed to the constructor of {@link ServerPlatform}
 * @param platformClass fully qualified name of the {@link ServerPlatform} implementation to initialize
 * @param loader {@link ClassLoader} to look up given platformClass
 * @return initialized instance of {@link ServerPlatform}
 * @throws NullPointerException if platformClass is null
 * @throws ServerPlatformException if supplied platformClass is not found or can not be initialized
 * @see ServerPlatformBase#ServerPlatformBase(DatabaseSession)
 */
public static ServerPlatform createServerPlatform(DatabaseSession session,String platformClass,ClassLoader loader){
  if (platformClass == null) {
    throw new NullPointerException();
  }
  Class cls=null;
  try {
    cls=findClass(platformClass,loader);
  }
 catch (  ClassNotFoundException|PrivilegedActionException ex) {
    ClassLoader cl=ServerPlatformUtils.class.getClassLoader();
    if (loader != cl) {
      try {
        cls=findClass(platformClass,cl);
      }
 catch (      ClassNotFoundException|PrivilegedActionException ex1) {
        throw ServerPlatformException.serverPlatformClassNotFound(platformClass,ex);
      }
    }
 else {
      throw ServerPlatformException.serverPlatformClassNotFound(platformClass,ex);
    }
  }
  final Class[] paramTypes=new Class[]{DatabaseSession.class};
  final Object[] params=new Object[]{session};
  ServerPlatform platform=null;
  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
    try {
      Constructor constructor=AccessController.doPrivileged(new PrivilegedGetConstructorFor(cls,paramTypes,false));
      platform=(ServerPlatform)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor,params));
    }
 catch (    PrivilegedActionException ex) {
      throw ServerPlatformException.invalidServerPlatformClass(platformClass,ex);
    }
  }
 else {
    try {
      Constructor constructor=PrivilegedAccessHelper.getConstructorFor(cls,paramTypes,false);
      platform=(ServerPlatform)PrivilegedAccessHelper.invokeConstructor(constructor,params);
    }
 catch (    NoSuchMethodException|IllegalAccessException|InvocationTargetException|InstantiationException ex) {
      throw ServerPlatformException.invalidServerPlatformClass(platformClass,ex);
    }
  }
  return platform;
}

Fixed version (ground truth):
/** 
 * Create an instance of   {@link ServerPlatform} from parameters passed in.
 * @param session {@link DatabaseSession} which will be passed to the constructor of {@link ServerPlatform}
 * @param platformClass fully qualified name of the {@link ServerPlatform} implementation to initialize
 * @param loader {@link ClassLoader} to look up given platformClass
 * @return initialized instance of {@link ServerPlatform}
 * @throws ServerPlatformException if supplied platformClass is not found, can not be initialized, or is null.
 * @see ServerPlatformBase#ServerPlatformBase(DatabaseSession)
 */
public static ServerPlatform createServerPlatform(DatabaseSession session,String platformClass,ClassLoader loader){
  if (platformClass == null) {
    throw ServerPlatformException.invalidServerPlatformClass(platformClass,null);
  }
  Class cls=null;
  try {
    cls=findClass(platformClass,loader);
  }
 catch (  ClassNotFoundException|PrivilegedActionException ex) {
    ClassLoader cl=ServerPlatformUtils.class.getClassLoader();
    if (loader != cl) {
      try {
        cls=findClass(platformClass,cl);
      }
 catch (      ClassNotFoundException|PrivilegedActionException ex1) {
        throw ServerPlatformException.serverPlatformClassNotFound(platformClass,ex);
      }
    }
 else {
      throw ServerPlatformException.serverPlatformClassNotFound(platformClass,ex);
    }
  }
  final Class[] paramTypes=new Class[]{DatabaseSession.class};
  final Object[] params=new Object[]{session};
  ServerPlatform platform=null;
  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
    try {
      Constructor constructor=AccessController.doPrivileged(new PrivilegedGetConstructorFor(cls,paramTypes,false));
      platform=(ServerPlatform)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor,params));
    }
 catch (    PrivilegedActionException ex) {
      throw ServerPlatformException.invalidServerPlatformClass(platformClass,ex);
    }
  }
 else {
    try {
      Constructor constructor=PrivilegedAccessHelper.getConstructorFor(cls,paramTypes,false);
      platform=(ServerPlatform)PrivilegedAccessHelper.invokeConstructor(constructor,params);
    }
 catch (    NoSuchMethodException|IllegalAccessException|InvocationTargetException|InstantiationException ex) {
      throw ServerPlatformException.invalidServerPlatformClass(platformClass,ex);
    }
  }
  return platform;
}