Buggy code:
public String computeSharedPropertyFileName ( QualifiedName qName ) { } public void configure ( ) throws CoreException { } public boolean contains ( IResource resource ) { } public void createClasspathProblemMarker ( IJavaModelStatus status ) { } protected Object createElementInfo ( ) { } public IClasspathEntry [ ] [ ] decodeClasspath ( String xmlClasspath , Map unknownElements ) throws IOException , ClasspathEntry . AssertionFailedException { } public IClasspathEntry decodeClasspathEntry ( String encodedEntry ) { } public void deconfigure ( ) throws CoreException { } protected IClasspathEntry [ ] defaultClasspath ( ) { } protected IPath defaultOutputLocation ( ) { } protected String encodeClasspath ( IClasspathEntry [ ] classpath , IClasspathEntry [ ] referencedEntries , IPath outputLocation , boolean indent , Map unknownElements ) throws JavaModelException { } public String encodeClasspathEntry ( IClasspathEntry classpathEntry ) { } public boolean equals ( Object o ) { } public IJavaElement findElement ( IPath path ) throws JavaModelException { } public IJavaElement findElement ( IPath path , WorkingCopyOwner owner ) throws JavaModelException { } public IJavaElement findPackageFragment ( String packageName ) throws JavaModelException { } public IJavaElement findElement ( String bindingKey , WorkingCopyOwner owner ) throws JavaModelException { } public IPackageFragment findPackageFragment ( IPath path ) throws JavaModelException { } private IPackageFragment findPackageFragment0 ( IPath path ) throws JavaModelException { } public IPackageFragmentRoot findPackageFragmentRoot ( IPath path ) throws JavaModelException { } public IPackageFragmentRoot findPackageFragmentRoot0 ( IPath path ) throws JavaModelException { } public IPackageFragmentRoot [ ] findPackageFragmentRoots ( IClasspathEntry entry ) { } public IType findType ( String fullyQualifiedName ) throws JavaModelException { } public IType findType ( String fullyQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException { } IType findType ( String fullyQualifiedName , NameLookup lookup , boolean considerSecondaryTypes , IProgressMonitor progressMonitor ) throws JavaModelException { } public IType findType ( String packageName , String typeQualifiedName ) throws JavaModelException { } public IType findType ( String packageName , String typeQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException { } IType findType ( String packageName , String typeQualifiedName , NameLookup lookup , boolean considerSecondaryTypes , IProgressMonitor progressMonitor ) throws JavaModelException { } public IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner ) throws JavaModelException { } public IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException { } public IType findType ( String fullyQualifiedName , WorkingCopyOwner owner ) throws JavaModelException { } public IType findType ( String fullyQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException { } protected void flushClasspathProblemMarkers ( boolean flushCycleMarkers , boolean flushClasspathFormatMarkers ) { } public IPath [ ] getAccessRestrictions ( String optionName ) { } public IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( ) throws JavaModelException { } public IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( Map rootToResolvedEntries ) throws JavaModelException { } public IClasspathEntry getClasspathEntryFor ( IPath path ) throws JavaModelException { } public IMarker getCycleMarker ( ) { } public IEclipsePreferences getEclipsePreferences ( ) { } public String getElementName ( ) { } public int getElementType ( ) { } public IClasspathEntry [ ] getExpandedClasspath ( ) throws JavaModelException { } public IPackageFragmentRoot getFolderPackageFragmentRoot ( IPath path ) { } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { } protected char getHandleMementoDelimiter ( ) { } private int getJavaCommandIndex ( ICommand [ ] buildSpec ) { } protected JavaProjectElementInfo getJavaProjectElementInfo ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public String getOption ( String optionName , boolean inheritJavaCoreOptions ) { } public Map getOptions ( boolean inheritJavaCoreOptions ) { } public IPath getOutputLocation ( ) throws JavaModelException { } public IPackageFragmentRoot getPackageFragmentRoot ( IPath path ) { if ( ! ( path . isAbsolute ( ) ) ) { path = getPath ( ) . append ( path ) ; } int segmentCount = path . segmentCount ( ) ; if ( segmentCount == 0 ) { return null ; } if ( ( ( path . getDevice ( ) ) != null ) || ( ( JavaModel . getExternalTarget ( path , true ) ) != null ) ) { return getPackageFragmentRoot0 ( path ) ; } IWorkspaceRoot workspaceRoot = this . project . getWorkspace ( ) . getRoot ( ) ; IResource resource = workspaceRoot . findMember ( path ) ; if ( resource == null ) { if ( ( path . getFileExtension ( ) ) != null ) { <START_BUG> if ( ! ( workspaceRoot . getProject ( path . lastSegment ( ) ) . exists ( ) ) ) { <END_BUG> return getPackageFragmentRoot0 ( path ) ; } else { resource = workspaceRoot . getFile ( path ) ; } } else if ( segmentCount == 1 ) { String projectName = path . segment ( 0 ) ; if ( getElementName ( ) . equals ( projectName ) ) { resource = this . project ; } else { resource = workspaceRoot . getProject ( projectName ) ; } } else { resource = workspaceRoot . getFolder ( path ) ; } } return getPackageFragmentRoot ( resource ) ; } public IPackageFragmentRoot getPackageFragmentRoot ( IResource resource ) { } private IPackageFragmentRoot getPackageFragmentRoot ( IResource resource , IPath entryPath ) { } public IPackageFragmentRoot getPackageFragmentRoot ( String externalLibraryPath ) { } public IPackageFragmentRoot getPackageFragmentRoot0 ( IPath externalLibraryPath ) { } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( ) throws JavaModelException { } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( IClasspathEntry entry ) { } public IPackageFragment [ ] getPackageFragments ( ) throws JavaModelException { } public IPackageFragment [ ] getPackageFragmentsInRoots ( IPackageFragmentRoot [ ] roots ) { } public IPath getPath ( ) { } public JavaModelManager . PerProjectInfo getPerProjectInfo ( ) throws JavaModelException { } private IPath getPluginWorkingLocation ( ) { } public IProject getProject ( ) { } public JavaProjectElementInfo . ProjectCache getProjectCache ( ) throws JavaModelException { } public IClasspathEntry [ ] getRawClasspath ( ) throws JavaModelException { }

Fix:
if ( ! ( workspaceRoot . getProject ( path . segment ( 0 ) ) . exists ( ) ) ) {