Program: 122838
Project: 122838
Buggy source:
public TalendEclipseHelper(IProgressMonitor progressMonitor,TalendJetEmitter jetEmitter,boolean rebuild) throws JETException {
  progressMonitor.beginTask("String_Node_Str",10);
  try {
    final IWorkspace workspace=ResourcesPlugin.getWorkspace();
    IJavaModel javaModel=JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    if (!javaModel.isOpen()) {
      javaModel.open(new SubProgressMonitor(progressMonitor,1));
    }
 else {
      progressMonitor.worked(1);
    }
    project=workspace.getRoot().getProject(projectName);
    progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
    if (!project.exists()) {
      progressMonitor.subTask("String_Node_Str" + project.getName());
      project.create(new SubProgressMonitor(progressMonitor,1));
      progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
      IProjectDescription description=workspace.newProjectDescription(project.getName());
      description.setNatureIds(new String[]{JavaCore.NATURE_ID});
      description.setLocation(null);
      project.open(new SubProgressMonitor(progressMonitor,1));
      project.setDescription(description,new SubProgressMonitor(progressMonitor,1));
    }
 else {
      project.open(new SubProgressMonitor(progressMonitor,5));
      IProjectDescription description=project.getDescription();
      description.setNatureIds(new String[]{JavaCore.NATURE_ID});
      project.setDescription(description,new SubProgressMonitor(progressMonitor,1));
    }
    javaProject=JavaCore.create(project);
    progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
    IClasspathEntry classpathEntry=JavaCore.newSourceEntry(new Path("String_Node_Str" + project.getName() + "String_Node_Str"));
    IClasspathEntry jreClasspathEntry=JavaCore.newContainerEntry(new Path("String_Node_Str"));
    Set<IClasspathEntry> classpath=new HashSet<IClasspathEntry>();
    classpath.add(classpathEntry);
    classpath.add(jreClasspathEntry);
    classpath.addAll(jetEmitter.getClasspathEntries());
    IFolder sourceFolder=project.getFolder(new Path("String_Node_Str"));
    if (!sourceFolder.exists()) {
      sourceFolder.create(false,true,new SubProgressMonitor(progressMonitor,1));
    }
    IFolder runtimeFolder=project.getFolder(new Path("String_Node_Str"));
    if (!runtimeFolder.exists()) {
      runtimeFolder.create(false,true,new SubProgressMonitor(progressMonitor,1));
    }
    if (classpathEntryMissing(javaProject,classpath)) {
      IClasspathEntry[] classpathEntryArray=classpath.toArray(new IClasspathEntry[classpath.size()]);
      javaProject.setRawClasspath(classpathEntryArray,new SubProgressMonitor(progressMonitor,1));
    }
    javaProject.setOutputLocation(new Path("String_Node_Str" + project.getName() + "String_Node_Str"),new SubProgressMonitor(progressMonitor,1));
    if (rebuild) {
      javaProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD,new NullProgressMonitor());
    }
    javaProject.close();
    progressMonitor.done();
  }
 catch (  CoreException exception) {
    throw new JETException(exception);
  }
catch (  Exception exception) {
    throw new JETException(exception);
  }
 finally {
    progressMonitor.done();
  }
}

Fixed version (ground truth):
public TalendEclipseHelper(IProgressMonitor progressMonitor,TalendJetEmitter jetEmitter,boolean rebuild) throws JETException {
  progressMonitor.beginTask("String_Node_Str",10);
  try {
    final IWorkspace workspace=ResourcesPlugin.getWorkspace();
    IJavaModel javaModel=JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    if (!javaModel.isOpen()) {
      javaModel.open(new SubProgressMonitor(progressMonitor,1));
    }
 else {
      progressMonitor.worked(1);
    }
    project=workspace.getRoot().getProject(projectName);
    progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
    if (!project.exists()) {
      progressMonitor.subTask("String_Node_Str" + project.getName());
      project.create(new SubProgressMonitor(progressMonitor,1));
      progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
      IProjectDescription description=workspace.newProjectDescription(project.getName());
      description.setNatureIds(new String[]{JavaCore.NATURE_ID});
      description.setLocation(null);
      project.open(new SubProgressMonitor(progressMonitor,1));
      project.setDescription(description,new SubProgressMonitor(progressMonitor,1));
    }
 else {
      project.open(new SubProgressMonitor(progressMonitor,5));
      IProjectDescription description=project.getDescription();
      if (!ArrayUtils.contains(description.getNatureIds(),JavaCore.NATURE_ID)) {
        description.setNatureIds(new String[]{JavaCore.NATURE_ID});
        project.setDescription(description,new SubProgressMonitor(progressMonitor,1));
      }
    }
    javaProject=JavaCore.create(project);
    progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("String_Node_Str",new Object[]{project.getName()}));
    IClasspathEntry classpathEntry=JavaCore.newSourceEntry(new Path("String_Node_Str" + project.getName() + "String_Node_Str"));
    IClasspathEntry jreClasspathEntry=JavaCore.newContainerEntry(new Path("String_Node_Str"));
    Set<IClasspathEntry> classpath=new HashSet<IClasspathEntry>();
    classpath.add(classpathEntry);
    classpath.add(jreClasspathEntry);
    classpath.addAll(jetEmitter.getClasspathEntries());
    IFolder sourceFolder=project.getFolder(new Path("String_Node_Str"));
    if (!sourceFolder.exists()) {
      sourceFolder.create(false,true,new SubProgressMonitor(progressMonitor,1));
    }
    IFolder runtimeFolder=project.getFolder(new Path("String_Node_Str"));
    if (!runtimeFolder.exists()) {
      runtimeFolder.create(false,true,new SubProgressMonitor(progressMonitor,1));
    }
    if (isClasspathDifferent(javaProject,classpath)) {
      IClasspathEntry[] classpathEntryArray=classpath.toArray(new IClasspathEntry[classpath.size()]);
      javaProject.setRawClasspath(classpathEntryArray,new SubProgressMonitor(progressMonitor,1));
      javaProject.setOutputLocation(new Path("String_Node_Str" + project.getName() + "String_Node_Str"),new SubProgressMonitor(progressMonitor,1));
      javaProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD,new NullProgressMonitor());
    }
    progressMonitor.done();
  }
 catch (  CoreException exception) {
    throw new JETException(exception);
  }
catch (  Exception exception) {
    throw new JETException(exception);
  }
 finally {
    progressMonitor.done();
  }
}