Program: 117193
Project: 117193
Buggy source:
/** 
 * <p> <pre> Usage: Discretizer -r	attribute file path -i	input dataset path -o	output dataset path [-d]	discretized attribute file path [-m]	output attribute file path [-n]	maximum num of bins (default: 256) [-t]	training file path </pre> </p>
 * @param args the command line arguments.
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options app=new Options();
  CmdLineParser parser=new CmdLineParser(Discretizer.class,app);
  try {
    parser.parse(args);
    if (app.maxNumBins < 0) {
      throw new IllegalArgumentException();
    }
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  List<Attribute> attributes=null;
  if (app.trainPath != null) {
    Instances trainSet=InstancesReader.read(app.attPath,app.trainPath);
    attributes=trainSet.getAttributes();
    for (int i=0; i < attributes.size(); i++) {
      Attribute attribute=attributes.get(i);
      if (attribute.getType() == Type.NUMERIC) {
        Discretizer.discretize(trainSet,i,app.maxNumBins);
      }
    }
  }
 else   if (app.disAttPath != null) {
    attributes=AttributesReader.read(app.disAttPath).v1;
  }
 else {
    parser.printUsage();
    System.exit(1);
  }
  Instances instances=InstancesReader.read(app.attPath,app.inputPath);
  List<Attribute> attrs=instances.getAttributes();
  for (int i=0; i < attrs.size(); i++) {
    Attribute attr=attrs.get(i);
    if (attr.getType() == Type.NUMERIC) {
      BinnedAttribute binnedAttr=(BinnedAttribute)attributes.get(i);
      Discretizer.discretize(instances,i,binnedAttr.getBins());
    }
  }
  if (app.outputAttPath != null) {
    InstancesWriter.write(instances,app.outputAttPath,app.outputPath);
  }
 else {
    InstancesWriter.write(instances,app.outputPath);
  }
}

Fixed version (ground truth):
/** 
 * <p> <pre> Usage: mltk.core.processor.Discretizer -i	input dataset path -o	output dataset path [-r]	attribute file path [-t]	training file path [-d]	discretized attribute file path [-m]	output attribute file path [-n]	maximum num of bins (default: 256) </pre> </p>
 * @param args the command line arguments.
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options app=new Options();
  CmdLineParser parser=new CmdLineParser(Discretizer.class,app);
  try {
    parser.parse(args);
    if (app.maxNumBins < 0) {
      throw new IllegalArgumentException();
    }
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  List<Attribute> attributes=null;
  if (app.trainPath != null) {
    Instances trainSet=InstancesReader.read(app.attPath,app.trainPath);
    attributes=trainSet.getAttributes();
    for (int i=0; i < attributes.size(); i++) {
      Attribute attribute=attributes.get(i);
      if (attribute.getType() == Type.NUMERIC) {
        Discretizer.discretize(trainSet,i,app.maxNumBins);
      }
    }
  }
 else   if (app.disAttPath != null) {
    attributes=AttributesReader.read(app.disAttPath).v1;
  }
 else {
    parser.printUsage();
    System.exit(1);
  }
  Instances instances=InstancesReader.read(app.attPath,app.inputPath);
  List<Attribute> attrs=instances.getAttributes();
  for (int i=0; i < attrs.size(); i++) {
    Attribute attr=attrs.get(i);
    if (attr.getType() == Type.NUMERIC) {
      BinnedAttribute binnedAttr=(BinnedAttribute)attributes.get(i);
      Discretizer.discretize(instances,i,binnedAttr.getBins());
    }
  }
  if (app.outputAttPath != null) {
    InstancesWriter.write(instances,app.outputAttPath,app.outputPath);
  }
 else {
    InstancesWriter.write(instances,app.outputPath);
  }
}