Buggy code:
public class SetContainerOperation extends ChangeClasspathOperation { IPath containerPath ; IJavaProject [ ] affectedProjects ; IClasspathContainer [ ] respectiveContainers ; public SetContainerOperation ( IPath containerPath , IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers ) { } protected void executeOperation ( ) throws JavaModelException { checkCanceled ( ) ; try { beginTask ( "" , 1 ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_set_container ( ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_set_container_invocation_trace ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( manager . containerPutIfInitializingWithSameEntries ( this . containerPath , this . affectedProjects , this . respectiveContainers ) ) return ; final int projectLength = this . affectedProjects . length ; final IJavaProject [ ] modifiedProjects ; System . arraycopy ( this . affectedProjects , 0 , ( modifiedProjects = new IJavaProject [ projectLength ] ) , 0 , projectLength ) ; final IClasspathEntry [ ] [ ] oldResolvedPaths = new IClasspathEntry [ projectLength ] [ ] ; int remaining = 0 ; for ( int i = 0 ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( ( JavaProject ) ( this . affectedProjects [ i ] ) ) ; IClasspathContainer newContainer = this . respectiveContainers [ i ] ; if ( newContainer == null ) newContainer = JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ; boolean found = false ; if ( JavaProject . hasJavaNature ( affectedProject . getProject ( ) ) ) { IClasspathEntry [ ] rawClasspath = affectedProject . getRawClasspath ( ) ; for ( int j = 0 , cpLength = rawClasspath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = rawClasspath [ j ] ; if ( ( ( entry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_CONTAINER ) ) && ( entry . getPath ( ) . equals ( this . containerPath ) ) ) { found = true ; break ; } } } if ( ! found ) { modifiedProjects [ i ] = null ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; continue ; } IClasspathContainer oldContainer = manager . containerGet ( affectedProject , this . containerPath ) ; if ( oldContainer == ( JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) ) { oldContainer = null ; } if ( ( ( oldContainer != null ) && ( oldContainer . equals ( this . respectiveContainers [ i ] ) ) ) || ( oldContainer == ( this . respectiveContainers [ i ] ) ) ) { modifiedProjects [ i ] = null ; continue ; } remaining ++ ; oldResolvedPaths [ i ] = affectedProject . getResolvedClasspath ( ) ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; } if ( remaining == 0 ) return ; try { for ( int i = 0 ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( ( JavaProject ) ( modifiedProjects [ i ] ) ) ; if ( affectedProject == null ) continue ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_update_project ( affectedProject ) ; ClasspathChange classpathChange = affectedProject . getPerProjectInfo ( ) . resetResolvedClasspath ( ) ; classpathChanged ( classpathChange ) ; if ( this . canChangeResources ) { try { affectedProject . getProject ( ) . touch ( this . progressMonitor ) ; } catch ( CoreException e ) { if ( ! ( ExternalJavaProject . EXTERNAL_PROJECT_NAME . equals ( affectedProject . getElementName ( ) ) ) ) throw e ; } } } } catch ( CoreException e ) { <START_BUG> if ( JavaModelManager . CP_RESOLVE_VERBOSE ) <END_BUG> verbose_failure ( e ) ; if ( e instanceof JavaModelException ) { throw ( ( JavaModelException ) ( e ) ) ; } else { throw new JavaModelException ( e ) ; } } finally { for ( int i = 0 ; i < projectLength ; i ++ ) { if ( ( this . respectiveContainers [ i ] ) == null ) { manager . containerPut ( this . affectedProjects [ i ] , this . containerPath , null ) ; } } } } finally { done ( ) ; } } private void verbose_failure ( CoreException e ) { } private void verbose_update_project ( JavaProject affectedProject ) { } private void verbose_set_container ( ) { } private void verbose_set_container_invocation_trace ( ) { } }

Fix:
if ( ( JavaModelManager . CP_RESOLVE_VERBOSE ) || ( JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) )