Program: 141771
Project: 141771
Buggy source:
private void addMavenBuildScripts(List<URL> scriptsUrls,ProcessItem processItem,String selectedJobVersion,String privatePackage,String exportService){
  IResourceService resourceService=(IResourceService)GlobalServiceRegister.getDefault().getService(IResourceService.class);
  if (resourceService == null) {
    return;
  }
  String projectName=getCorrespondingProjectName(processItem);
  String jobName=processItem.getProperty().getLabel();
  String jobVersion=processItem.getProperty().getVersion();
  final Map<String,String> mavenPropertiesMap=new HashMap<String,String>();
  mavenPropertiesMap.put(EMavenBuildScriptProperties.ItemProjectName.getVarScript(),projectName);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.ItemName.getVarScript(),jobName);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.ItemVersion.getVarScript(),jobVersion);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.BundleConfigPrivatePackage.getVarScript(),privatePackage);
  mavenPropertiesMap.put(EMavenBuildScriptProperties.BundleConfigExportService.getVarScript(),exportService);
  Set<ModuleNeeded> neededModules=LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(processItem.getProperty().getId(),selectedJobVersion);
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_BUILD_FILE_NAME);
  File mavenBuildBundleFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
  File mavenBuildFeatureFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
  File mavenBuildParentFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
  try {
    IPreferenceStore mavenPreferenceStore=CamelDesignerPlugin.getDefault().getPreferenceStore();
    String mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_BUNDLE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildBundleFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildBundleFile,mavenPropertiesMap,neededModules,MAVEN_PROP_LIB_PATH);
      scriptsUrls.add(mavenBuildBundleFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_FEATURE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFeatureFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFeatureFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFeatureFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_PARENT);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildParentFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildParentFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildParentFile.toURL());
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override protected void addMavenBuildScripts(List<URL> scriptsUrls,ProcessItem processItem,String selectedJobVersion,Map<String,String> mavenPropertiesMap){
  IResourceService resourceService=(IResourceService)GlobalServiceRegister.getDefault().getService(IResourceService.class);
  if (resourceService == null) {
    return;
  }
  Set<ModuleNeeded> neededModules=LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(processItem.getProperty().getId(),selectedJobVersion);
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_BUILD_FILE_NAME);
  File mavenBuildBundleFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
  File mavenBuildFeatureFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
  File mavenBuildParentFile=new File(getTmpFolder() + PATH_SEPARATOR + ExportJobConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
  try {
    IPreferenceStore mavenPreferenceStore=CamelDesignerPlugin.getDefault().getPreferenceStore();
    String mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_BUNDLE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildBundleFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildBundleFile,mavenPropertiesMap,neededModules,MAVEN_PROP_LIB_PATH);
      scriptsUrls.add(mavenBuildBundleFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_FEATURE);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFeatureFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFeatureFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFeatureFile.toURL());
    }
    mavenScript=mavenPreferenceStore.getString(ICamelPrefConstants.MAVEN_KARAF_SCRIPT_TEMPLATE_PARENT);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildParentFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildParentFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildParentFile.toURL());
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}