Buggy code:
public class JavaModel extends Openable implements IJavaModel { public static HashSet existingExternalFiles = new HashSet ( ) ; protected JavaModel ( ) throws Error { } public boolean contains ( IResource resource ) { } public void copy ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected OpenableElementInfo createElementInfo ( ) { } public void delete ( IJavaElement [ ] elements , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public IJavaProject findJavaProject ( IProject project ) { } public static void flushExternalFileCache ( ) { } protected boolean generateInfos ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { JavaModelManager . getJavaModelManager ( ) . putInfo ( this , info ) ; <START_BUG> IProject [ ] projects = this . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; <END_BUG> for ( int i = 0 , max = projects . length ; i < max ; i ++ ) { IProject project = projects [ i ] ; if ( JavaProject . hasJavaNature ( project ) ) { info . addChild ( getJavaProject ( project ) ) ; } } return true ; } protected IJavaElement getHandleFromMementoForBinaryMembers ( String memento , IPackageFragmentRoot root , int rootEnd , int end ) throws JavaModelException { } protected IPackageFragmentRoot getHandleFromMementoForRoot ( String memento , JavaProject project , int projectEnd , int rootEnd ) { } protected IJavaElement getHandleFromMementoForSourceMembers ( String memento , IPackageFragmentRoot root , int rootEnd , int end ) throws JavaModelException { } protected IType getHandleFromMementoForSourceType ( String memento , ICompilationUnit cu , int typeStart , int typeEnd ) throws JavaModelException { } public String getHandleMemento ( ) { } protected char getHandleMementoDelimiter ( ) { } public IJavaModel getJavaModel ( ) { } public IJavaProject getJavaProject ( ) { } public IJavaProject getJavaProject ( String name ) { } public IJavaProject getJavaProject ( IResource resource ) { } public IJavaProject [ ] getJavaProjects ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public IJavaProject [ ] getOldJavaProjectsList ( ) throws JavaModelException { } public IPath getPath ( ) { } public IResource getResource ( ) { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public IWorkspace getWorkspace ( ) { } public void move ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void refreshExternalArchives ( IJavaElement [ ] elementsScope , IProgressMonitor monitor ) throws JavaModelException { } public void rename ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public IJavaElement rootedAt ( IJavaProject project ) { } protected void runOperation ( MultiOperation op , IJavaElement [ ] elements , IJavaElement [ ] siblings , String [ ] renamings , IProgressMonitor monitor ) throws JavaModelException { } protected void toStringInfo ( int tab , StringBuffer buffer , Object info ) { } public static Object getTarget ( IContainer container , IPath path , boolean checkResourceExistence ) { } }

Fix:
IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ;