Program: 61341
Project: 61341
Buggy source:
/** 
 * Creates a DirichletState object from the given arguments. Note that the modelFactory is presumed to be a subclass of VectorModelDistribution that can be initialized with a concrete Vector prototype.
 * @param modelFactory a String which is the class name of the model factory
 * @param modelPrototype a String which is the class name of the Vector used to initialize the factory
 * @param prototypeSie an int number of dimensions of the model prototype vector
 * @param numModels an int number of models to be created
 * @param alpha_0 the double alpha_0 argument to the algorithm
 * @return an initialized DirichletState
 * @throws ClassNotFoundException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws NoSuchMethodException 
 * @throws SecurityException 
 * @throws InvocationTargetException 
 * @throws IllegalArgumentException 
 */
public static DirichletState<VectorWritable> createState(String modelFactory,String modelPrototype,int prototypeSize,int numModels,double alpha_0) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
  ClassLoader ccl=Thread.currentThread().getContextClassLoader();
  Class<? extends VectorModelDistribution> cl=ccl.loadClass(modelFactory).asSubclass(VectorModelDistribution.class);
  VectorModelDistribution factory=(VectorModelDistribution)cl.newInstance();
  Class<? extends Vector> vcl=ccl.loadClass(modelPrototype).asSubclass(Vector.class);
  Constructor<? extends Vector> v=vcl.getConstructor(int.class);
  factory.setModelPrototype(new VectorWritable(v.newInstance(prototypeSize)));
  return new DirichletState<VectorWritable>(factory,numModels,alpha_0,1,1);
}

Fixed version (ground truth):
/** 
 * Creates a DirichletState object from the given arguments. Note that the modelFactory is presumed to be a subclass of VectorModelDistribution that can be initialized with a concrete Vector prototype.
 * @param modelFactory a String which is the class name of the model factory
 * @param modelPrototype a String which is the class name of the Vector used to initialize the factory
 * @param prototypeSize an int number of dimensions of the model prototype vector
 * @param numModels an int number of models to be created
 * @param alpha_0 the double alpha_0 argument to the algorithm
 * @return an initialized DirichletState
 * @throws ClassNotFoundException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws NoSuchMethodException 
 * @throws SecurityException 
 * @throws InvocationTargetException 
 * @throws IllegalArgumentException 
 */
public static DirichletState<VectorWritable> createState(String modelFactory,String modelPrototype,int prototypeSize,int numModels,double alpha_0) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
  ClassLoader ccl=Thread.currentThread().getContextClassLoader();
  Class<? extends VectorModelDistribution> cl=ccl.loadClass(modelFactory).asSubclass(VectorModelDistribution.class);
  VectorModelDistribution factory=cl.newInstance();
  Class<? extends Vector> vcl=ccl.loadClass(modelPrototype).asSubclass(Vector.class);
  Constructor<? extends Vector> v=vcl.getConstructor(int.class);
  factory.setModelPrototype(new VectorWritable(v.newInstance(prototypeSize)));
  return new DirichletState<VectorWritable>(factory,numModels,alpha_0,1,1);
}