Program: 122362
Project: 122362
Buggy source:
private void addMavenBuildScripts(IExportJobResourcesService resourcesService,List<URL> scriptsUrls,ProcessItem processItem,String selectedJobVersion){
  String mavenScript=resourcesService.getScriptFromPreferenceStore(IExportJobPrefConstants.MAVEN_SCRIPT_AUTONOMOUSJOB_TEMPLATE);
  if (mavenScript == null) {
    return;
  }
  String assemblyMavenScript=resourcesService.getScriptFromPreferenceStore(IExportJobPrefConstants.MAVEN_SCRIPT_AUTONOMOUSJOB_ASSEMBLY_TEMPLATE);
  if (assemblyMavenScript == null) {
    return;
  }
  String jobName=processItem.getProperty().getLabel();
  String jobVersion=processItem.getProperty().getVersion();
  String jobExportedJarName=jobName + '_' + jobVersion.replaceAll("String_Node_Str","String_Node_Str");
  jobExportedJarName=jobExportedJarName.toLowerCase();
  final Map<String,String> mavenPropertiesMap=getMainMavenProperties(processItem);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.ItemExportedJarName.getVarScript(),jobExportedJarName);
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + IExportJobConstants.MAVEN_BUILD_FILE_NAME);
  File mavenAssemblyFile=new File(getTmpFolder() + PATH_SEPARATOR + IExportJobConstants.MAVEN_ASSEMBLY_FILE_NAME);
  try {
    FileOutputStream outStream=null;
    try {
      outStream=new FileOutputStream(mavenBuildFile);
      outStream.write(mavenScript.getBytes());
    }
  finally {
      if (outStream != null) {
        outStream.close();
      }
    }
    updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap,true);
    scriptsUrls.add(mavenBuildFile.toURL());
    try {
      outStream=new FileOutputStream(mavenAssemblyFile);
      outStream.write(assemblyMavenScript.getBytes());
    }
  finally {
      if (outStream != null) {
        outStream.close();
      }
    }
    scriptsUrls.add(mavenAssemblyFile.toURL());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
private void addMavenBuildScripts(IExportJobResourcesService resourcesService,List<URL> scriptsUrls,ProcessItem processItem,String selectedJobVersion){
  String mavenScript=resourcesService.getScriptFromPreferenceStore(IExportJobPrefConstants.MAVEN_SCRIPT_AUTONOMOUSJOB_TEMPLATE);
  if (mavenScript == null) {
    return;
  }
  String assemblyMavenScript=resourcesService.getScriptFromPreferenceStore(IExportJobPrefConstants.MAVEN_SCRIPT_AUTONOMOUSJOB_ASSEMBLY_TEMPLATE);
  if (assemblyMavenScript == null) {
    return;
  }
  String jobName=processItem.getProperty().getLabel();
  String jobVersion=processItem.getProperty().getVersion();
  String jobExportedJarName=jobName + '_' + jobVersion.replaceAll("String_Node_Str","String_Node_Str");
  jobExportedJarName=jobExportedJarName.toLowerCase();
  final Map<String,String> mavenPropertiesMap=getMainMavenProperties(processItem);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.ItemExportedJarName.getVarScript(),jobExportedJarName);
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + IExportJobConstants.MAVEN_BUILD_FILE_NAME);
  File mavenAssemblyFile=new File(getTmpFolder() + PATH_SEPARATOR + IExportJobConstants.MAVEN_ASSEMBLY_FILE_NAME);
  try {
    FileOutputStream outStream=null;
    try {
      outStream=new FileOutputStream(mavenBuildFile);
      outStream.write(mavenScript.getBytes());
    }
  finally {
      if (outStream != null) {
        outStream.close();
      }
    }
    updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap,true,false);
    scriptsUrls.add(mavenBuildFile.toURL());
    try {
      outStream=new FileOutputStream(mavenAssemblyFile);
      outStream.write(assemblyMavenScript.getBytes());
    }
  finally {
      if (outStream != null) {
        outStream.close();
      }
    }
    scriptsUrls.add(mavenAssemblyFile.toURL());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}