Buggy code:
public class JavaModel extends Openable implements IJavaModel { public static HashSet existingExternalFiles = new HashSet ( ) ; public static HashSet existingExternalConfirmedFiles = new HashSet ( ) ; protected JavaModel ( ) throws Error { } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) { } public boolean contains ( IResource resource ) { } public void copy ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected Object createElementInfo ( ) { } public void delete ( IJavaElement [ ] elements , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public boolean equals ( Object o ) { } public int getElementType ( ) { } public static void flushExternalFileCache ( ) { } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { } protected void getHandleMemento ( StringBuffer buff ) { } protected char getHandleMementoDelimiter ( ) { } public IJavaProject getJavaProject ( String projectName ) { } public IJavaProject getJavaProject ( IResource resource ) { } public IJavaProject [ ] getJavaProjects ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public IPath getPath ( ) { } public IResource resource ( PackageFragmentRoot root ) { } public IResource getUnderlyingResource ( ) { } 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 { } protected void runOperation ( MultiOperation op , IJavaElement [ ] elements , IJavaElement [ ] siblings , String [ ] renamings , IProgressMonitor monitor ) throws JavaModelException { } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { } public static Object getTarget ( IPath path , boolean checkResourceExistence ) { } <START_BUG> public static Object getWorkspaceTarget ( IPath path ) { <END_BUG> if ( ( path == null ) || ( ( path . getDevice ( ) ) != null ) ) return null ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace == null ) return null ; return workspace . getRoot ( ) . findMember ( path ) ; } public static Object getExternalTarget ( IPath path , boolean checkResourceExistence ) { } private static synchronized void existingExternalFilesAdd ( File externalFile ) { } private static synchronized boolean existingExternalFilesContains ( File externalFile ) { } public static boolean isFile ( Object target ) { } public static synchronized File getFile ( Object target ) { } protected IStatus validateExistence ( IResource underlyingResource ) { } }

Fix:
public static IResource getWorkspaceTarget ( IPath path ) {