Program: 141673
Project: 141673
Buggy source:
@Override protected void addMavenBuildScripts(ExportFileResource[] processes,List<URL> scriptsUrls,Map<String,String> mavenPropertiesMap){
  if (!PluginChecker.isPluginLoaded(PluginChecker.EXPORT_ROUTE_PLUGIN_ID)) {
    return;
  }
  Item item=processes[0].getItem();
  File templatePomFile=null, templateBundleFile=null, templateFeatureFile=null, templateParentFile=null;
  if (item != null) {
    IPath itemLocationPath=ItemResourceUtil.getItemLocationPath(item.getProperty());
    IFolder objectTypeFolder=ItemResourceUtil.getObjectTypeFolder(item.getProperty());
    if (itemLocationPath != null && objectTypeFolder != null) {
      IPath itemRelativePath=itemLocationPath.removeLastSegments(1).makeRelativeTo(objectTypeFolder.getLocation());
      templatePomFile=PomUtil.getTemplateFile(objectTypeFolder,itemRelativePath,TalendMavenConstants.POM_FILE_NAME);
      if (FilesUtils.allInSameFolder(templatePomFile,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME)) {
        templateBundleFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
        templateFeatureFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
        templateParentFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
      }
 else {
        templatePomFile=null;
      }
    }
  }
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.POM_FILE_NAME);
  File mavenBuildBundleFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
  File mavenBuildFeatureFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
  File mavenBuildParentFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
  try {
    String mavenScript=MavenTemplateManager.getTemplateContent(templatePomFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_POM,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + TalendMavenConstants.POM_FILE_NAME);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap,false,true);
      scriptsUrls.add(mavenBuildFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateBundleFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_BUNDLE,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildBundleFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildBundleFile,mavenPropertiesMap,true,false);
      scriptsUrls.add(mavenBuildBundleFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateFeatureFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_FEATURE,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFeatureFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFeatureFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFeatureFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateParentFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_PARENT,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildParentFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildParentFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildParentFile.toURI().toURL());
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override protected void addMavenBuildScripts(ExportFileResource[] processes,List<URL> scriptsUrls,Map<String,String> mavenPropertiesMap){
  if (!PluginChecker.isPluginLoaded(PluginChecker.EXPORT_ROUTE_PLUGIN_ID)) {
    return;
  }
  Item item=processes[0].getItem();
  File templatePomFile=null, templateBundleFile=null, templateFeatureFile=null, templateParentFile=null;
  if (item != null) {
    IPath itemLocationPath=ItemResourceUtil.getItemLocationPath(item.getProperty());
    IFolder objectTypeFolder=ItemResourceUtil.getObjectTypeFolder(item.getProperty());
    if (itemLocationPath != null && objectTypeFolder != null) {
      IPath itemRelativePath=itemLocationPath.removeLastSegments(1).makeRelativeTo(objectTypeFolder.getLocation());
      templatePomFile=PomUtil.getTemplateFile(objectTypeFolder,itemRelativePath,TalendMavenConstants.POM_FILE_NAME);
      if (FilesUtils.allInSameFolder(templatePomFile,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME,IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME)) {
        templateBundleFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
        templateFeatureFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
        templateParentFile=new File(templatePomFile.getParentFile(),IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
      }
 else {
        templatePomFile=null;
      }
    }
  }
  File mavenBuildFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.POM_FILE_NAME);
  File mavenBuildBundleFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
  File mavenBuildFeatureFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);
  File mavenBuildParentFile=new File(getTmpFolder() + PATH_SEPARATOR + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
  try {
    final Map<String,Object> templateParameters=PomUtil.getTemplateParameters(item.getProperty());
    String mavenScript=MavenTemplateManager.getTemplateContent(templatePomFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_POM,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + TalendMavenConstants.POM_FILE_NAME,templateParameters);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFile,mavenPropertiesMap,false,true);
      scriptsUrls.add(mavenBuildFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateBundleFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_BUNDLE,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME,templateParameters);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildBundleFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildBundleFile,mavenPropertiesMap,true,false);
      scriptsUrls.add(mavenBuildBundleFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateFeatureFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_FEATURE,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME,templateParameters);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildFeatureFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildFeatureFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildFeatureFile.toURI().toURL());
    }
    mavenScript=MavenTemplateManager.getTemplateContent(templateParentFile,IProjectSettingPreferenceConstants.TEMPLATE_ROUTES_KARAF_PARENT,PluginChecker.EXPORT_ROUTE_PLUGIN_ID,IProjectSettingTemplateConstants.PATH_ROUTE + '/' + IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME,templateParameters);
    if (mavenScript != null) {
      createMavenBuildFileFromTemplate(mavenBuildParentFile,mavenScript);
      updateMavenBuildFileContent(mavenBuildParentFile,mavenPropertiesMap);
      scriptsUrls.add(mavenBuildParentFile.toURI().toURL());
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}