Program: 125271
Project: 125271
Buggy source:
public static void changeClasspath(IProgressMonitor monitor,IProject p){
  try {
    if (!p.hasNature(JavaCore.NATURE_ID)) {
      JavaUtils.addJavaNature(p,monitor);
    }
    IJavaProject javaProject=JavaCore.create(p);
    IClasspathEntry[] rawClasspathEntries=javaProject.getRawClasspath();
    List<IClasspathEntry> list=new LinkedList<>();
    ClasspathAttribute attribute=new ClasspathAttribute("String_Node_Str",Boolean.TRUE.toString());
    for (    ProjectSystemFolder psf : MavenSystemFolders.ALL_DIRS) {
      IFolder resources=p.getFolder(psf.getPath());
      if (resources.exists()) {
        IFolder output=p.getFolder(psf.getOutputPath());
        IClasspathEntry newEntry=JavaCore.newSourceEntry(resources.getFullPath(),new IPath[0],new IPath[0],output.getFullPath(),new IClasspathAttribute[]{attribute});
        list.add(newEntry);
      }
    }
    IPath defaultJREContainerPath=JavaRuntime.newDefaultJREContainerPath();
    IClasspathEntry newEntry=JavaCore.newContainerEntry(defaultJREContainerPath,new IAccessRule[]{},new IClasspathAttribute[]{attribute},false);
    list.add(newEntry);
    newEntry=JavaCore.newContainerEntry(new Path("String_Node_Str"),newEntry.getAccessRules(),new IClasspathAttribute[]{attribute},newEntry.isExported());
    list.add(newEntry);
    if (!Arrays.equals(rawClasspathEntries,list.toArray(new IClasspathEntry[]{}))) {
      rawClasspathEntries=list.toArray(new IClasspathEntry[]{});
      javaProject.setRawClasspath(rawClasspathEntries,monitor);
      javaProject.setOutputLocation(p.getFolder(MavenSystemFolders.JAVA.getOutputPath()).getFullPath(),monitor);
    }
  }
 catch (  CoreException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public static void changeClasspath(IProgressMonitor monitor,IProject p){
  try {
    if (!p.hasNature(JavaCore.NATURE_ID)) {
      JavaUtils.addJavaNature(p,monitor);
    }
    IJavaProject javaProject=JavaCore.create(p);
    IClasspathEntry[] rawClasspathEntries=javaProject.getRawClasspath();
    List<IClasspathEntry> list=new LinkedList<>();
    ClasspathAttribute attribute=new ClasspathAttribute("String_Node_Str",Boolean.TRUE.toString());
    for (    ProjectSystemFolder psf : MavenSystemFolders.ALL_DIRS) {
      IFolder resources=p.getFolder(psf.getPath());
      if (resources.exists()) {
        IFolder output=p.getFolder(psf.getOutputPath());
        IClasspathEntry newEntry=JavaCore.newSourceEntry(resources.getFullPath(),new IPath[0],new IPath[0],output.getFullPath(),new IClasspathAttribute[]{attribute});
        list.add(newEntry);
      }
    }
    IPath defaultJREContainerPath=JavaRuntime.newDefaultJREContainerPath();
    IClasspathEntry newEntry=JavaCore.newContainerEntry(defaultJREContainerPath,new IAccessRule[]{},new IClasspathAttribute[]{attribute},false);
    list.add(newEntry);
    newEntry=JavaCore.newContainerEntry(new Path("String_Node_Str"),newEntry.getAccessRules(),new IClasspathAttribute[]{attribute},newEntry.isExported());
    list.add(newEntry);
    if (!Arrays.equals(rawClasspathEntries,list.toArray(new IClasspathEntry[]{})) || !p.getFile("String_Node_Str").exists()) {
      rawClasspathEntries=list.toArray(new IClasspathEntry[]{});
      javaProject.setRawClasspath(rawClasspathEntries,monitor);
      javaProject.setOutputLocation(p.getFolder(MavenSystemFolders.JAVA.getOutputPath()).getFullPath(),monitor);
    }
  }
 catch (  CoreException e) {
    ExceptionHandler.process(e);
  }
}