Program: 38036
Project: 38036
Buggy source:
/** 
 * Creates Grid resources
 */
protected void createMETAGridResources(double bandwidth,double cost,String data_set){
  LinkedList<String> lines=new LinkedList();
  Input r=new Input();
  BufferedReader br=null;
  br=r.openFile(new File(ExperimentSetup.data_sets + "String_Node_Str" + data_set+ "String_Node_Str"));
  r.getLines(lines,br);
  r.closeFile(br);
  LinkedList<String> cpu_types=new LinkedList();
  LinkedList<Double> cpu_bench=new LinkedList();
  LinkedList<Double> cpu_speed=new LinkedList();
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_bench.add((1.0));
  cpu_bench.add((1.771666667));
  cpu_bench.add((2.88));
  cpu_bench.add((3.643333333));
  cpu_bench.add((4.743333333));
  cpu_bench.add((6.844));
  cpu_bench.add((1.79));
  cpu_bench.add((1.0));
  cpu_speed.add(1000.0);
  cpu_speed.add(1800.0);
  cpu_speed.add(2400.0);
  cpu_speed.add(3060.0);
  cpu_speed.add(2200.0);
  cpu_speed.add(1500.0);
  cpu_speed.add(1000.0);
  cpu_speed.add(1000.0);
  String[] last_machine=null;
  int machine_id=0;
  MachineList mList=new MachineList();
  String name="String_Node_Str";
  int name_id=0;
  String cpu_ids="String_Node_Str";
  LinkedList<String> names=new LinkedList();
  for (int j=0; j < lines.size(); j++) {
    String[] values=((String)lines.get(j)).split("String_Node_Str");
    name=values[1];
    int MachCount=Integer.parseInt(values[7]);
    String PEs[]=values[9].split("String_Node_Str");
    String PEids[]=values[10].split("String_Node_Str");
    for (int id=0; id < PEids.length; id++) {
      if (Integer.parseInt(PEids[id]) > total_CPUs) {
        total_CPUs=Integer.parseInt(PEids[id]);
      }
    }
    for (int ma=0; ma < MachCount; ma++) {
      int totalPE=Integer.parseInt(PEs[ma]);
      PEList peList=new PEList();
      Double rel_speed=1.0 + ((Double.parseDouble(values[2]) - cpu_speed.get(cpu_types.indexOf(values[4]))) / cpu_speed.get(cpu_types.indexOf(values[4])));
      String pokus=Long.toString(Math.round(rel_speed * 100000 * cpu_bench.get(cpu_types.indexOf(values[4]))));
      int peRating=Integer.parseInt(pokus);
      if (!ExperimentSetup.use_speeds) {
        peRating=1;
      }
      if (peRating > ExperimentSetup.maxPErating) {
        ExperimentSetup.maxPErating=peRating;
      }
      for (int k=0; k < totalPE; k++) {
        peList.add(new PE(k,peRating));
      }
      mList.add(new Machine(machine_id,peList));
      machine_id++;
    }
    names.addLast(values[1]);
    last_machine=((String)lines.get(j)).split("String_Node_Str");
    String arch=last_machine[4];
    String os=last_machine[5];
    double time_zone=0.0;
    int ram=0;
    if (last_machine[3].equals("String_Node_Str")) {
      ram=1000000;
    }
 else {
      ram=Integer.parseInt(last_machine[3]);
    }
    String properties=last_machine[6];
    ExperimentSetup.clusterNames.addLast(name);
    LinkedList mach_names=new LinkedList(names);
    ExperimentSetup.machineNames.addLast(mach_names);
    names.clear();
    ComplexResourceCharacteristics resConfig=new ComplexResourceCharacteristics(arch,os,mList,ResourceCharacteristics.SPACE_SHARED,time_zone,cost,ram,properties,cpu_ids);
    long seed=11L * 13 * 17* 19* 23 + 1;
    double peakLoad=0.0;
    double offPeakLoad=0.0;
    double holidayLoad=0.0;
    LinkedList Weekends=new LinkedList();
    Weekends.add(new Integer(Calendar.SATURDAY));
    Weekends.add(new Integer(Calendar.SUNDAY));
    LinkedList Holidays=new LinkedList();
    AllocPolicy apolicy=null;
    try {
      if (ExperimentSetup.use_RAM) {
        AdvancedSpaceSharedWithRAM policy=null;
        policy=new AdvancedSpaceSharedWithRAM(name,"String_Node_Str",resConfig);
        ExperimentSetup.local_schedulers.add(policy);
        apolicy=policy;
      }
 else {
        AdvancedSpaceShared policy=null;
        policy=new AdvancedSpaceShared(name,"String_Node_Str",resConfig);
        ExperimentSetup.local_schedulers.add(policy);
        apolicy=policy;
      }
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
    try {
      ResourceCalendar resCalendar=new ResourceCalendar(time_zone,peakLoad,offPeakLoad,holidayLoad,Weekends,Holidays,seed);
      ComplexGridResource gridRes=new ComplexGridResource(name,bandwidth,resConfig,resCalendar,apolicy);
      int max=gridRes.getResourceCharacteristics().getNumPE();
      if (max > ExperimentSetup.maxPE) {
        ExperimentSetup.maxPE=max;
      }
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      System.out.println(e.getMessage());
    }
    machine_id=0;
    mList=new MachineList();
    cpu_ids="String_Node_Str";
    name="String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Creates Grid resources
 */
protected void createMETAGridResources(double bandwidth,double cost,String data_set){
  LinkedList<String> lines=new LinkedList();
  Input r=new Input();
  BufferedReader br=null;
  br=r.openFile(new File(ExperimentSetup.data_sets + "String_Node_Str" + data_set+ "String_Node_Str"));
  r.getLines(lines,br);
  r.closeFile(br);
  LinkedList<String> cpu_types=new LinkedList();
  LinkedList<Double> cpu_bench=new LinkedList();
  LinkedList<Double> cpu_speed=new LinkedList();
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_types.add("String_Node_Str");
  cpu_bench.add((1.0));
  cpu_bench.add((1.771666667));
  cpu_bench.add((2.88));
  cpu_bench.add((3.643333333));
  cpu_bench.add((4.743333333));
  cpu_bench.add((6.844));
  cpu_bench.add((1.79));
  cpu_bench.add((1.0));
  cpu_speed.add(1000.0);
  cpu_speed.add(1800.0);
  cpu_speed.add(2400.0);
  cpu_speed.add(3060.0);
  cpu_speed.add(2200.0);
  cpu_speed.add(1500.0);
  cpu_speed.add(1000.0);
  cpu_speed.add(1000.0);
  String[] last_machine=null;
  int machine_id=0;
  MachineList mList=new MachineList();
  String name="String_Node_Str";
  int name_id=0;
  String cpu_ids="String_Node_Str";
  LinkedList<String> names=new LinkedList();
  for (int j=0; j < lines.size(); j++) {
    String[] values=((String)lines.get(j)).split("String_Node_Str");
    name=values[1];
    int MachCount=Integer.parseInt(values[7]);
    String PEs[]=values[9].split("String_Node_Str");
    String PEids[]=values[10].split("String_Node_Str");
    for (int id=0; id < PEids.length; id++) {
      if (Integer.parseInt(PEids[id]) > total_CPUs) {
        total_CPUs=Integer.parseInt(PEids[id]);
      }
    }
    for (int ma=0; ma < MachCount; ma++) {
      int totalPE=Integer.parseInt(PEs[ma]);
      PEList peList=new PEList();
      Double rel_speed=1.0 + ((Double.parseDouble(values[2]) - cpu_speed.get(cpu_types.indexOf(values[4]))) / cpu_speed.get(cpu_types.indexOf(values[4])));
      String pokus=Long.toString(Math.round(rel_speed * 100000 * cpu_bench.get(cpu_types.indexOf(values[4]))));
      int peRating=Integer.parseInt(pokus);
      if (!ExperimentSetup.use_speeds) {
        peRating=1;
      }
      if (peRating > ExperimentSetup.maxPErating) {
        ExperimentSetup.maxPErating=peRating;
      }
      for (int k=0; k < totalPE; k++) {
        peList.add(new PE(k,peRating));
      }
      mList.add(new MachineWithRAM(machine_id,peList,1000));
      machine_id++;
    }
    names.addLast(values[1]);
    last_machine=((String)lines.get(j)).split("String_Node_Str");
    String arch=last_machine[4];
    String os=last_machine[5];
    double time_zone=0.0;
    int ram=0;
    if (last_machine[3].equals("String_Node_Str")) {
      ram=1000000;
    }
 else {
      ram=Integer.parseInt(last_machine[3]);
    }
    String properties=last_machine[6];
    ExperimentSetup.clusterNames.addLast(name);
    LinkedList mach_names=new LinkedList(names);
    ExperimentSetup.machineNames.addLast(mach_names);
    names.clear();
    ComplexResourceCharacteristics resConfig=new ComplexResourceCharacteristics(arch,os,mList,ResourceCharacteristics.SPACE_SHARED,time_zone,cost,ram,properties,cpu_ids);
    long seed=11L * 13 * 17* 19* 23 + 1;
    double peakLoad=0.0;
    double offPeakLoad=0.0;
    double holidayLoad=0.0;
    LinkedList Weekends=new LinkedList();
    Weekends.add(new Integer(Calendar.SATURDAY));
    Weekends.add(new Integer(Calendar.SUNDAY));
    LinkedList Holidays=new LinkedList();
    AllocPolicy apolicy=null;
    try {
      if (ExperimentSetup.use_RAM) {
        AdvancedSpaceSharedWithRAM policy=null;
        policy=new AdvancedSpaceSharedWithRAM(name,"String_Node_Str",resConfig);
        ExperimentSetup.local_schedulers.add(policy);
        apolicy=policy;
      }
 else {
        AdvancedSpaceShared policy=null;
        policy=new AdvancedSpaceShared(name,"String_Node_Str",resConfig);
        ExperimentSetup.local_schedulers.add(policy);
        apolicy=policy;
      }
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
    try {
      ResourceCalendar resCalendar=new ResourceCalendar(time_zone,peakLoad,offPeakLoad,holidayLoad,Weekends,Holidays,seed);
      ComplexGridResource gridRes=new ComplexGridResource(name,bandwidth,resConfig,resCalendar,apolicy);
      int max=gridRes.getResourceCharacteristics().getNumPE();
      if (max > ExperimentSetup.maxPE) {
        ExperimentSetup.maxPE=max;
      }
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str");
      System.out.println(e.getMessage());
    }
    machine_id=0;
    mList=new MachineList();
    cpu_ids="String_Node_Str";
    name="String_Node_Str";
  }
}