Program: 117194
Project: 117194
Buggy source:
/** 
 * <p> <pre> Usage: mltk.core.processor.InstancesSplitter -r	attribute file path -i	input dataset path -o	output directory path [-c]	splitting mode:parameter. Splitting mode can be split (s) and cross validation (c) (default: c:5) [-s]	seed of the random number generator (default: 0) </pre> </p>
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options opts=new Options();
  CmdLineParser parser=new CmdLineParser(InstancesSplitter.class,opts);
  String[] data=null;
  try {
    parser.parse(args);
    data=opts.crossValidationMode.split("String_Node_Str");
    if (data.length < 2) {
      throw new IllegalArgumentException();
    }
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  Random.getInstance().setSeed(opts.seed);
  Instances instances=InstancesReader.read(opts.attPath,opts.inputPath);
  File attFile=new File(opts.attPath);
  String prefix=attFile.getName().split("String_Node_Str")[0];
  File dir=new File(opts.outputDirPath);
  if (!dir.exists()) {
    dir.mkdir();
  }
switch (data[0]) {
case "String_Node_Str":
    int k=Integer.parseInt(data[1]);
  if (data.length == 2) {
    Instances[][] folds=InstancesSplitter.createCrossValidationFolds(instances,k);
    for (int i=0; i < folds.length; i++) {
      String path=opts.outputDirPath + File.separator + "String_Node_Str"+ i;
      File directory=new File(path);
      if (!directory.exists()) {
        directory.mkdir();
      }
      InstancesWriter.write(folds[i][0],path + File.separator + prefix+ "String_Node_Str",path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][1],path + File.separator + prefix+ "String_Node_Str");
    }
  }
 else {
    double ratio=Double.parseDouble(data[2]);
    Instances[][] folds=InstancesSplitter.createCrossValidationFolds(instances,k,ratio);
    for (int i=0; i < folds.length; i++) {
      String path=opts.outputDirPath + File.separator + "String_Node_Str"+ i;
      File directory=new File(path);
      if (!directory.exists()) {
        directory.mkdir();
      }
      InstancesWriter.write(folds[i][0],path + File.separator + prefix+ "String_Node_Str",path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][1],path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][2],path + File.separator + prefix+ "String_Node_Str");
    }
  }
break;
case "String_Node_Str":
double ratio=Double.parseDouble(data[1]);
Instances[] datasets=InstancesSplitter.split(instances,ratio);
InstancesWriter.write(datasets[0],opts.outputDirPath + File.separator + prefix+ "String_Node_Str",opts.outputDirPath + File.separator + prefix+ "String_Node_Str");
InstancesWriter.write(datasets[1],opts.outputDirPath + File.separator + prefix+ "String_Node_Str");
break;
default :
break;
}
}

Fixed version (ground truth):
/** 
 * Splits a dataset. <pre> Usage: mltk.core.processor.InstancesSplitter -r	attribute file path -i	input dataset path -o	output directory path [-c]	splitting mode:parameter. Splitting mode can be split (s) and cross validation (c) (default: c:5) [-s]	seed of the random number generator (default: 0) </pre>
 * @param args the command line arguments.
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options opts=new Options();
  CmdLineParser parser=new CmdLineParser(InstancesSplitter.class,opts);
  String[] data=null;
  try {
    parser.parse(args);
    data=opts.crossValidationMode.split("String_Node_Str");
    if (data.length < 2) {
      throw new IllegalArgumentException();
    }
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  Random.getInstance().setSeed(opts.seed);
  Instances instances=InstancesReader.read(opts.attPath,opts.inputPath);
  File attFile=new File(opts.attPath);
  String prefix=attFile.getName().split("String_Node_Str")[0];
  File dir=new File(opts.outputDirPath);
  if (!dir.exists()) {
    dir.mkdir();
  }
switch (data[0]) {
case "String_Node_Str":
    int k=Integer.parseInt(data[1]);
  if (data.length == 2) {
    Instances[][] folds=InstancesSplitter.createCrossValidationFolds(instances,k);
    for (int i=0; i < folds.length; i++) {
      String path=opts.outputDirPath + File.separator + "String_Node_Str"+ i;
      File directory=new File(path);
      if (!directory.exists()) {
        directory.mkdir();
      }
      InstancesWriter.write(folds[i][0],path + File.separator + prefix+ "String_Node_Str",path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][1],path + File.separator + prefix+ "String_Node_Str");
    }
  }
 else {
    double ratio=Double.parseDouble(data[2]);
    Instances[][] folds=InstancesSplitter.createCrossValidationFolds(instances,k,ratio);
    for (int i=0; i < folds.length; i++) {
      String path=opts.outputDirPath + File.separator + "String_Node_Str"+ i;
      File directory=new File(path);
      if (!directory.exists()) {
        directory.mkdir();
      }
      InstancesWriter.write(folds[i][0],path + File.separator + prefix+ "String_Node_Str",path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][1],path + File.separator + prefix+ "String_Node_Str");
      InstancesWriter.write(folds[i][2],path + File.separator + prefix+ "String_Node_Str");
    }
  }
break;
case "String_Node_Str":
double ratio=Double.parseDouble(data[1]);
Instances[] datasets=InstancesSplitter.split(instances,ratio);
InstancesWriter.write(datasets[0],opts.outputDirPath + File.separator + prefix+ "String_Node_Str",opts.outputDirPath + File.separator + prefix+ "String_Node_Str");
InstancesWriter.write(datasets[1],opts.outputDirPath + File.separator + prefix+ "String_Node_Str");
break;
default :
break;
}
}