Program: 72804
Project: 72804
Buggy source:
/** 
 * Build the Modelica model. Then, run the executable result file of buildModel() in both interactive and non-interactive processing mode in order to generate the simulation result file.
 * @param fileName File which the model should be loaded from.
 * @param modelName Name of the (base-)model which should be built.
 * @param startTime The start time of simulation.
 * @param stopTime The stop time of simulation.
 * @param numberOfIntervals Number of intervals in the result file.
 * @param outputFormat Format of the result file.
 * @param processingMode The mode of processing for running the executable result file of building the Modelica model.
 * @exception ConnectException If commands couldn'tbe sent to the (OpenModelic Compiler)OMC.
 * @exception IOException If the executable result file of buildModel()couldn't be executed.
 * @exception IllegalActionException
 */
public void runModel(String fileName,String modelName,String startTime,String stopTime,int numberOfIntervals,String outputFormat,String processingMode) throws ConnectException, IOException, IllegalActionException {
  String commands=null;
  String loggerInfo=null;
  commands=modelName + "String_Node_Str" + Float.valueOf(startTime).floatValue()+ "String_Node_Str"+ Float.valueOf(stopTime).floatValue()+ "String_Node_Str"+ numberOfIntervals+ "String_Node_Str"+ "String_Node_Str"+ outputFormat+ "String_Node_Str";
  loggerInfo="String_Node_Str" + modelName + "String_Node_Str";
  _omcLogger.getInfo(loggerInfo);
  CompilerResult buildModelResult=sendCommand("String_Node_Str" + commands + "String_Node_Str");
  if (!buildModelResult.getFirstResult().isEmpty() && (!buildModelResult.getError().isEmpty() && buildModelResult.getError().contains("String_Node_Str"))) {
    loggerInfo=modelName + "String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
  }
  if (!buildModelResult.getError().isEmpty() && !(buildModelResult.getError().contains("String_Node_Str"))) {
    loggerInfo=buildModelResult.getError();
    _omcLogger.getInfo(loggerInfo);
    throw new ConnectException(loggerInfo);
  }
  if (!outputFormat.equalsIgnoreCase("String_Node_Str")) {
switch (getOs()) {
case WINDOWS:
      commands=_temp + _username + "String_Node_Str"+ modelName+ "String_Node_Str";
    break;
case UNIX:
  commands=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ modelName;
break;
case MAC:
commands=_temp + _username + "String_Node_Str"+ modelName;
break;
}
if (processingMode.equalsIgnoreCase("String_Node_Str")) {
try {
Runtime.getRuntime().exec(commands,_environmentalVariables,_workDir);
}
 catch (IOException e) {
System.err.println("String_Node_Str" + commands);
StringUtilities.exit(1);
}
loggerInfo="String_Node_Str";
_omcLogger.getInfo(loggerInfo);
switch (getOs()) {
case WINDOWS:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
case UNIX:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ "String_Node_Str"+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
case MAC:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
}
}
 else {
commands=commands + "String_Node_Str";
try {
loggerInfo="String_Node_Str" + commands + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
Runtime.getRuntime().exec(commands,_environmentalVariables,_workDir);
loggerInfo="String_Node_Str" + commands + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
}
 catch (IOException e) {
new IOException(e.getMessage()).printStackTrace();
return;
}
loggerInfo="String_Node_Str";
_omcLogger.getInfo(loggerInfo);
}
}
}

Fixed version (ground truth):
/** 
 * Build the Modelica model. Then, run the executable result file of buildModel() in both interactive and non-interactive processing mode in order to generate the simulation result file.
 * @param fileName File which the model should be loaded from.
 * @param modelName Name of the (base-)model which should be built.
 * @param startTime The start time of simulation.
 * @param stopTime The stop time of simulation.
 * @param numberOfIntervals Number of intervals in the result file.
 * @param outputFormat Format of the result file.
 * @param processingMode The mode of processing for running the executable result file of building the Modelica model.
 * @exception ConnectException If commands couldn'tbe sent to the (OpenModelic Compiler)OMC.
 * @exception IOException If the executable result file of buildModel()couldn't be executed.
 * @exception IllegalActionException
 */
public void runModel(String fileName,String modelName,String startTime,String stopTime,int numberOfIntervals,String outputFormat,String processingMode) throws ConnectException, IOException, IllegalActionException {
  String commands=null;
  String loggerInfo=null;
  commands=modelName + "String_Node_Str" + Float.valueOf(startTime).floatValue()+ "String_Node_Str"+ Float.valueOf(stopTime).floatValue()+ "String_Node_Str"+ numberOfIntervals+ "String_Node_Str"+ "String_Node_Str"+ outputFormat+ "String_Node_Str";
  loggerInfo="String_Node_Str" + modelName + "String_Node_Str";
  _omcLogger.getInfo(loggerInfo);
  CompilerResult buildModelResult=sendCommand("String_Node_Str" + commands + "String_Node_Str");
  if (!buildModelResult.getFirstResult().isEmpty() && (!buildModelResult.getError().isEmpty() && buildModelResult.getError().contains("String_Node_Str"))) {
    loggerInfo=modelName + "String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
  }
  if (!buildModelResult.getError().isEmpty() && !(buildModelResult.getError().contains("String_Node_Str"))) {
    loggerInfo=buildModelResult.getError();
    _omcLogger.getInfo(loggerInfo);
    throw new ConnectException(loggerInfo);
  }
  if (!outputFormat.equalsIgnoreCase("String_Node_Str")) {
switch (getOs()) {
case WINDOWS:
      commands=_temp + _username + "String_Node_Str"+ modelName+ "String_Node_Str";
    break;
case UNIX:
  commands=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ modelName;
break;
case MAC:
commands=_temp + _username + "String_Node_Str"+ modelName;
break;
}
if (processingMode.equalsIgnoreCase("String_Node_Str")) {
try {
loggerInfo="String_Node_Str" + commands + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
Runtime.getRuntime().exec(commands,_environmentalVariables,_workDir);
loggerInfo="String_Node_Str";
_omcLogger.getInfo(loggerInfo);
}
 catch (IOException e) {
System.err.println("String_Node_Str" + commands);
StringUtilities.exit(1);
}
switch (getOs()) {
case WINDOWS:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
case UNIX:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ "String_Node_Str"+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
case MAC:
loggerInfo=modelName + "String_Node_Str" + outputFormat+ "String_Node_Str"+ _temp+ _username+ "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
break;
}
}
 else {
commands=commands + "String_Node_Str";
try {
loggerInfo="String_Node_Str" + commands + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
Runtime.getRuntime().exec(commands,_environmentalVariables,_workDir);
loggerInfo="String_Node_Str";
_omcLogger.getInfo(loggerInfo);
}
 catch (IOException e) {
new IOException(e.getMessage()).printStackTrace();
return;
}
}
}
}