Program: 94585
Project: 94585
Buggy source:
public Error.Type render(){
  gui.status("String_Node_Str" + this.name + "String_Node_Str");
  RenderProcess process=getProcessRender();
  String core_script="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  if (getUseGPU() && config.getGPUDevice() != null) {
    core_script=String.format(core_script,"String_Node_Str","String_Node_Str",config.getGPUDevice().getCudaName());
  }
 else {
    core_script=String.format(core_script,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
  core_script+=String.format("String_Node_Str",getTileSize());
  File script_file=null;
  String command1[]=getRenderCommand().split("String_Node_Str");
  int size_command=command1.length + 2;
  if (config.getNbCores() > 0) {
    size_command+=2;
  }
  List<String> command=new ArrayList<String>(size_command);
  Map<String,String> new_env=new HashMap<String,String>();
  new_env.put("String_Node_Str",config.workingDirectory.getAbsolutePath().replace("String_Node_Str","String_Node_Str"));
  new_env.put("String_Node_Str",Integer.toString(config.getNbCores()));
  for (  String arg : command1) {
switch (arg) {
case "String_Node_Str":
      command.add(getScenePath());
    command.add("String_Node_Str");
  try {
    script_file=File.createTempFile("String_Node_Str","String_Node_Str",config.workingDirectory);
    File file=new File(script_file.getAbsolutePath());
    FileWriter txt;
    txt=new FileWriter(file);
    PrintWriter out=new PrintWriter(txt);
    out.write(getScript());
    out.write("String_Node_Str");
    out.write(core_script);
    out.write("String_Node_Str");
    out.close();
    command.add(script_file.getAbsolutePath());
  }
 catch (  IOException e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    log.error("String_Node_Str" + e + "String_Node_Str"+ sw.toString());
    return Error.Type.UNKNOWN;
  }
script_file.deleteOnExit();
break;
case "String_Node_Str":
command.add(getRendererPath());
if (config.getNbCores() > 0) {
command.add("String_Node_Str");
command.add(Integer.toString(config.getNbCores()));
}
break;
case "String_Node_Str":
command.add(config.workingDirectory.getAbsolutePath() + File.separator + getPrefixOutputImage());
break;
case "String_Node_Str":
command.add(getFrameNumber());
break;
default :
command.add(arg);
break;
}
}
try {
String line;
log.debug(command.toString());
OS os=OS.getOS();
process.setCoresUsed(config.getNbCores());
process.start();
getProcessRender().setProcess(os.exec(command,new_env));
BufferedReader input=new BufferedReader(new InputStreamReader(getProcessRender().getProcess().getInputStream()));
long last_update_status=0;
log.debug("String_Node_Str");
try {
while ((line=input.readLine()) != null) {
updateRenderingMemoryPeak(line);
log.debug(line);
if ((new Date().getTime() - last_update_status) > 2000) {
updateRenderingStatus(line);
last_update_status=new Date().getTime();
}
Type error=detectError(line);
if (error != Error.Type.OK) {
if (script_file != null) {
script_file.delete();
}
return error;
}
}
input.close();
}
 catch (IOException err1) {
log.error("String_Node_Str" + err1);
}
log.debug("String_Node_Str");
}
 catch (Exception err) {
if (script_file != null) {
script_file.delete();
}
StringWriter sw=new StringWriter();
err.printStackTrace(new PrintWriter(sw));
log.error("String_Node_Str" + err + "String_Node_Str"+ sw.toString());
return Error.Type.FAILED_TO_EXECUTE;
}
int exit_value=process.exitValue();
process.finish();
if (script_file != null) {
script_file.delete();
}
final String filename_without_extension=getPrefixOutputImage() + getFrameNumber();
FilenameFilter textFilter=new FilenameFilter(){
public boolean accept(File dir,String name){
return name.startsWith(filename_without_extension);
}
}
;
File[] files=config.workingDirectory.listFiles(textFilter);
if (files.length == 0) {
log.error("String_Node_Str" + filename_without_extension + "String_Node_Str");
if (getAskForRendererKill()) {
log.debug("String_Node_Str");
if (getUserBlockJob()) {
return Error.Type.RENDERER_KILLED_BY_USER;
}
return Error.Type.RENDERER_KILLED;
}
String basename="String_Node_Str";
try {
basename=getPath().substring(0,getPath().lastIndexOf('.'));
}
 catch (Exception e) {
e.printStackTrace();
}
File crash_file=new File(config.workingDirectory + File.separator + basename+ "String_Node_Str");
if (crash_file.exists()) {
log.error("String_Node_Str");
crash_file.delete();
return Error.Type.RENDERER_CRASHED;
}
if (exit_value == 127 && process.getDuration() < 10) {
log.error("String_Node_Str" + process.getDuration() + "String_Node_Str");
return Error.Type.RENDERER_MISSING_LIBRARIES;
}
return Error.Type.NOOUTPUTFILE;
}
 else {
setOutputImagePath(files[0].getAbsolutePath());
log.debug("String_Node_Str" + getOutputImagePath() + "String_Node_Str");
}
File scene_dir=new File(getSceneDirectory());
long date_modification_scene_directory=(long)Utils.lastModificationTime(scene_dir);
if (date_modification_scene_directory > process.getStartTime()) {
scene_dir.delete();
}
gui.status(String.format("String_Node_Str",process.getDuration() / 60,process.getDuration() % 60));
return Error.Type.OK;
}

Fixed version (ground truth):
public Error.Type render(){
  gui.status("String_Node_Str" + this.name + "String_Node_Str");
  RenderProcess process=getProcessRender();
  String core_script="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  if (getUseGPU() && config.getGPUDevice() != null) {
    core_script=String.format(core_script,"String_Node_Str","String_Node_Str",config.getGPUDevice().getCudaName());
  }
 else {
    core_script=String.format(core_script,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
  core_script+=String.format("String_Node_Str",getTileSize());
  File script_file=null;
  String command1[]=getRenderCommand().split("String_Node_Str");
  int size_command=command1.length + 2;
  if (config.getNbCores() > 0) {
    size_command+=2;
  }
  List<String> command=new ArrayList<String>(size_command);
  Map<String,String> new_env=new HashMap<String,String>();
  new_env.put("String_Node_Str",config.workingDirectory.getAbsolutePath().replace("String_Node_Str","String_Node_Str"));
  new_env.put("String_Node_Str",Integer.toString(config.getNbCores()));
  for (  String arg : command1) {
switch (arg) {
case "String_Node_Str":
      command.add(getScenePath());
    command.add("String_Node_Str");
  try {
    script_file=File.createTempFile("String_Node_Str","String_Node_Str",config.workingDirectory);
    File file=new File(script_file.getAbsolutePath());
    FileWriter txt;
    txt=new FileWriter(file);
    PrintWriter out=new PrintWriter(txt);
    out.write(getScript());
    out.write("String_Node_Str");
    out.write(core_script);
    out.write("String_Node_Str");
    out.close();
    command.add(script_file.getAbsolutePath());
  }
 catch (  IOException e) {
    StringWriter sw=new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    log.error("String_Node_Str" + e + "String_Node_Str"+ sw.toString());
    return Error.Type.UNKNOWN;
  }
script_file.deleteOnExit();
break;
case "String_Node_Str":
command.add(getRendererPath());
if (config.getNbCores() > 0) {
command.add("String_Node_Str");
command.add(Integer.toString(config.getNbCores()));
}
break;
case "String_Node_Str":
command.add(config.workingDirectory.getAbsolutePath() + File.separator + getPrefixOutputImage());
break;
case "String_Node_Str":
command.add(getFrameNumber());
break;
default :
command.add(arg);
break;
}
}
try {
String line;
log.debug(command.toString());
OS os=OS.getOS();
process.setCoresUsed(config.getNbCores());
process.start();
getProcessRender().setProcess(os.exec(command,new_env));
BufferedReader input=new BufferedReader(new InputStreamReader(getProcessRender().getProcess().getInputStream()));
long last_update_status=0;
log.debug("String_Node_Str");
try {
while ((line=input.readLine()) != null) {
updateRenderingMemoryPeak(line);
log.debug(line);
if ((new Date().getTime() - last_update_status) > 2000) {
updateRenderingStatus(line);
last_update_status=new Date().getTime();
}
Type error=detectError(line);
if (error != Error.Type.OK) {
if (script_file != null) {
script_file.delete();
}
return error;
}
}
input.close();
}
 catch (IOException err1) {
log.error("String_Node_Str" + err1);
}
log.debug("String_Node_Str");
}
 catch (Exception err) {
if (script_file != null) {
script_file.delete();
}
StringWriter sw=new StringWriter();
err.printStackTrace(new PrintWriter(sw));
log.error("String_Node_Str" + err + "String_Node_Str"+ sw.toString());
return Error.Type.FAILED_TO_EXECUTE;
}
int exit_value=process.exitValue();
process.finish();
if (script_file != null) {
script_file.delete();
}
final String filename_without_extension=getPrefixOutputImage() + getFrameNumber();
FilenameFilter textFilter=new FilenameFilter(){
public boolean accept(File dir,String name){
return name.startsWith(filename_without_extension);
}
}
;
File[] files=config.workingDirectory.listFiles(textFilter);
if (getAskForRendererKill()) {
log.debug("String_Node_Str");
if (files.length != 0) {
new File(files[0].getAbsolutePath()).delete();
}
if (getUserBlockJob()) {
return Error.Type.RENDERER_KILLED_BY_USER;
}
return Error.Type.RENDERER_KILLED;
}
if (files.length == 0) {
log.error("String_Node_Str" + filename_without_extension + "String_Node_Str");
String basename="String_Node_Str";
try {
basename=getPath().substring(0,getPath().lastIndexOf('.'));
}
 catch (Exception e) {
e.printStackTrace();
}
File crash_file=new File(config.workingDirectory + File.separator + basename+ "String_Node_Str");
if (crash_file.exists()) {
log.error("String_Node_Str");
crash_file.delete();
return Error.Type.RENDERER_CRASHED;
}
if (exit_value == 127 && process.getDuration() < 10) {
log.error("String_Node_Str" + process.getDuration() + "String_Node_Str");
return Error.Type.RENDERER_MISSING_LIBRARIES;
}
return Error.Type.NOOUTPUTFILE;
}
 else {
setOutputImagePath(files[0].getAbsolutePath());
log.debug("String_Node_Str" + getOutputImagePath() + "String_Node_Str");
}
File scene_dir=new File(getSceneDirectory());
long date_modification_scene_directory=(long)Utils.lastModificationTime(scene_dir);
if (date_modification_scene_directory > process.getStartTime()) {
scene_dir.delete();
}
gui.status(String.format("String_Node_Str",process.getDuration() / 60,process.getDuration() % 60));
return Error.Type.OK;
}