Program: 72338
Project: 72338
Buggy source:
/** 
 * Change a parameter in the .xml, making it vary within an interval defined by the parameters start and end. Run a ptolemy simulation for each step between the interval.
 * @param waitingTime The time the system will wait to close all the windows of a federation, after its execution has finished.This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results. If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will only close when he answers "yes".
 * @param vergil An instance of vergil.
 * @param modelPath The path to the model you want to run.
 * @param propertyLines The xml line of the parameter that we want to change.
 * @param values The values the new property will assume.
 * @param solver The Runge-Kutta solver order number.
 * @exception IllegalActionException If there is a problem reading a file.
 */
public static void changeParameters(int waitingTime,AutomaticSimulation vergil,String[] modelPath,String[] propertyLines,double[][] values,int solver) throws IllegalActionException {
  if (propertyLines.length != values.length) {
    System.out.println("String_Node_Str");
    return;
  }
  int numberOfFederates=modelPath.length;
  int numberOfParameters=propertyLines.length;
  File[] file=new File[numberOfFederates];
  String[][][] data=new String[numberOfFederates][numberOfParameters + 1][2];
  for (int i=0; i < numberOfFederates; i++) {
    file[i]=new File(modelPath[i]);
    ArrayList<String> content;
    try {
      content=convertFileToString(file[i]);
    }
 catch (    IOException ex) {
      throw new IllegalActionException(null,ex,"String_Node_Str" + file[i]);
    }
    content=_changeRKSolver(content,solver);
    content=_changeRKSolver(content,solver);
    data[i]=_findPropertyLines(content,propertyLines);
  }
  int numberOfInteractions=values[0].length;
  for (int i=0; i < numberOfInteractions; i++) {
    final CompositeEntity[] model=new CompositeEntity[numberOfFederates];
    for (int j=0; j < numberOfFederates; j++) {
      StringBuffer info=new StringBuffer();
      for (int y=0; y < numberOfParameters; y++) {
        info.append("String_Node_Str" + data[j][y][0] + "String_Node_Str"+ data[j][y][1]+ values[y][i]+ "String_Node_Str");
      }
      System.out.println("String_Node_Str" + j + "String_Node_Str");
      _writeInFile(file[j],info.substring(1) + "String_Node_Str" + data[j][numberOfParameters][0]);
      model[j]=_openModel(modelPath[j]);
    }
    runAllModels(vergil);
    if (waitingTime < 0) {
      Scanner input=new Scanner(System.in,"String_Node_Str");
      while (true) {
        System.out.println("String_Node_Str");
        String answer=input.next();
        if (answer.equalsIgnoreCase("String_Node_Str"))         input.close();
        break;
      }
      _sleep(2000);
    }
 else     if (waitingTime > 0) {
      _sleep(waitingTime);
    }
    for (int j=0; j < numberOfFederates; j++) {
      _closeModel(model[j]);
    }
    _killRTIG();
  }
  try {
    Configuration.closeAllTableaux();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Change a parameter in the .xml, making it vary within an interval defined by the parameters start and end. Run a ptolemy simulation for each step between the interval.
 * @param waitingTime The time the system will wait to close all the windows of a federation, after its execution has finished.This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results. If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will only close when he answers "yes".
 * @param vergil An instance of vergil.
 * @param modelPath The path to the model you want to run.
 * @param propertyLines The xml line of the parameter that we want to change.
 * @param values The values the new property will assume.
 * @param solver The Runge-Kutta solver order number.
 * @exception IllegalActionException If there is a problem reading a file.
 */
public static void changeParameters(int waitingTime,AutomaticSimulation vergil,String[] modelPath,String[] propertyLines,double[][] values,int solver) throws IllegalActionException {
  if (propertyLines.length != values.length) {
    System.out.println("String_Node_Str");
    return;
  }
  int numberOfFederates=modelPath.length;
  int numberOfParameters=propertyLines.length;
  File[] file=new File[numberOfFederates];
  String[][][] data=new String[numberOfFederates][numberOfParameters + 1][2];
  for (int i=0; i < numberOfFederates; i++) {
    file[i]=new File(modelPath[i]);
    ArrayList<String> content;
    try {
      content=convertFileToString(file[i]);
    }
 catch (    IOException ex) {
      throw new IllegalActionException(null,ex,"String_Node_Str" + file[i]);
    }
    content=_changeRKSolver(content,solver);
    content=_changeRKSolver(content,solver);
    data[i]=_findPropertyLines(content,propertyLines);
  }
  int numberOfInteractions=values[0].length;
  for (int i=0; i < numberOfInteractions; i++) {
    final CompositeEntity[] model=new CompositeEntity[numberOfFederates];
    for (int j=0; j < numberOfFederates; j++) {
      StringBuffer info=new StringBuffer();
      for (int y=0; y < numberOfParameters; y++) {
        info.append("String_Node_Str" + data[j][y][0] + "String_Node_Str"+ data[j][y][1]+ values[y][i]+ "String_Node_Str");
      }
      System.out.println("String_Node_Str" + j + "String_Node_Str");
      _writeInFile(file[j],info.substring(1) + "String_Node_Str" + data[j][numberOfParameters][0]);
      model[j]=_openModel(modelPath[j]);
    }
    runAllModels(vergil);
    if (waitingTime < 0) {
      Scanner input=new Scanner(System.in,"String_Node_Str");
      while (true) {
        System.out.println("String_Node_Str");
        String answer=input.next();
        if (answer.equalsIgnoreCase("String_Node_Str")) {
          input.close();
          break;
        }
      }
      _sleep(2000);
    }
 else     if (waitingTime > 0) {
      _sleep(waitingTime);
    }
    for (int j=0; j < numberOfFederates; j++) {
      _closeModel(model[j]);
    }
    _killRTIG();
  }
  try {
    Configuration.closeAllTableaux();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}