Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » NullPointerException thrown in JavaElementContainmentAdapter
NullPointerException thrown in JavaElementContainmentAdapter [message #57264] Fri, 13 June 2003 22:23 Go to next message
Ryan Wannop is currently offline Ryan WannopFriend
Messages: 12
Registered: July 2009
Junior Member
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 09:32 Go to previous message
Eclipse UserFriend
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
Previous Topic:Cut and Paste
Next Topic:How to get editor to display the java document
Goto Forum:
  


Current Time: Wed Sep 18 17:37:32 GMT 2024

Powered by FUDForum. Page generated in 0.04749 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top