| NullPointerException thrown in JavaElementContainmentAdapter [message #57264] | 
Fri, 13 June 2003 18:23   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi, 
I think I came across a bug in 
 "org.eclipse.jdt.internal.ui.JavaElementContainmentAdapter" 
 
I couldn't find a bug report for it but I've never had much luck 
searching with bugzilla.  Is this a known issue? 
 
The following code is copied from method contains(Object, Object, int), 
and fails if element is an IJavaElement not contained in the 
workingSetElement of type IJavaElement.PACKAGE_FRAGMENT: 
 
.... 
 IResource resource= null; 
  IJavaElement jElement= null; 
  if (element instanceof IJavaElement) { 
   jElement= (IJavaElement)element; 
  } else { 
   if (element instanceof IAdaptable) { 
    resource= 
 (IResource)((IAdaptable)element).getAdapter(IResource.class) ; 
    if (resource != null) { 
     if (fJavaModel.contains(resource)) { 
      jElement= JavaCore.create(resource); 
      if (jElement != null && !jElement.exists()) 
       jElement= null; 
     } 
    } 
   } 
  } 
  if (jElement != null) { 
   if (contains(workingSetJavaElement, jElement, flags)) 
    return true; 
   if (workingSetJavaElement.getElementType() == 
IJavaElement.PACKAGE_FRAGMENT && 
   //***THE FOLLOWING THROWS AN NPE, "resource" IS NULL*** 
resource.getType() == IResource.FOLDER && checkIfDescendant(flags)) 
    return isChild(workingSetJavaElement, resource);
 |  
 |  
  | 
| Re: NullPointerException thrown in JavaElementContainmentAdapter [message #58353 is a reply to message #57264] | 
Mon, 16 June 2003 05:32   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: daniel.megert.gmx.net 
 
Ryan Wannop wrote: 
 
>Hi, 
>I think I came across a bug in 
> "org.eclipse.jdt.internal.ui.JavaElementContainmentAdapter" 
> 
>I couldn't find a bug report for it but I've never had much luck 
>searching with bugzilla.  
> 
Since you could not find it in bugzilla you should file the bug  
yourself. It really looks like a problem. 
 
Dani
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03525 seconds