This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 410647 - org.eclipse.core.runtime.CoreException is logged when touching the DD node of any Java EE module in Navigator
Summary: org.eclipse.core.runtime.CoreException is logged when touching the DD node of...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M2   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 298285 418241 (view as bug list)
Depends on:
Blocks: 419992
  Show dependency tree
 
Reported: 2013-06-12 14:16 EDT by Roberto Sanchez Herrera CLA
Modified: 2013-11-22 14:31 EST (History)
7 users (show)

See Also:


Attachments
Log with exceptions (65.83 KB, text/plain)
2013-06-12 14:16 EDT, Roberto Sanchez Herrera CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Sanchez Herrera CLA 2013-06-12 14:16:47 EDT
Created attachment 232305 [details]
Log with exceptions

I'm using 3.5 RC4 (http://download.eclipse.org/webtools/downloads/drops/R3.5.0/S-3.5.0RC4-20130610150119), and I found this:

1. Create an EAR 6 project with all default modules
2. In the Project Explorer of the Java EE perspective, click or double-click on the DD node of every project
3. You will see an exception like this (I'm attaching the complete log with exceptions for all the types of projects)

!ENTRY org.eclipse.ui.navigator 4 2 2013-06-12 13:06:32.982
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.navigator".
!STACK 1
org.eclipse.core.runtime.CoreException: No property tester contributes a property org.eclipse.core.resources.open to type class org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider
	at org.eclipse.core.internal.expressions.TypeExtensionManager.getProperty(TypeExtensionManager.java:123)
	at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:96)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
	at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53)
	at org.eclipse.ui.internal.navigator.NavigatorPlugin$Evaluator.run(NavigatorPlugin.java:245)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.navigator.NavigatorPlugin.safeEvaluate(NavigatorPlugin.java:260)
	at org.eclipse.ui.internal.navigator.actions.CommonActionProviderDescriptor.isEnabledFor(CommonActionProviderDescriptor.java:235)
	at org.eclipse.ui.internal.navigator.actions.CommonActionDescriptorManager.addProviderIfRelevant(CommonActionDescriptorManager.java:258)
	at org.eclipse.ui.internal.navigator.actions.CommonActionDescriptorManager.findRelevantActionDescriptors(CommonActionDescriptorManager.java:235)
	at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:248)
	at org.eclipse.ui.navigator.CommonNavigatorManager.selectionChanged(CommonNavigatorManager.java:222)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211)
.............
Comment 1 Roberto Sanchez Herrera CLA 2013-09-06 10:27:56 EDT
I found that these exceptions are logged when the enablement expression of these action providers are evaluated: org.eclipse.jdt.ui.navigator.resources.GoIntoActions and org.eclipse.ui.navigator.resources.GoIntoActions

Specifically, this is the expression that is causing the exceptions to be logged:

<and>
<adapt type="org.eclipse.core.resources.IProject" />
							<test property="org.eclipse.core.resources.open" 
                            	value="true"/>
						</and>
Comment 2 Roberto Sanchez Herrera CLA 2013-09-06 10:32:33 EDT
I found that these exceptions are logged when the enablement expression of these action providers are evaluated: org.eclipse.jdt.ui.navigator.resources.GoIntoActions and org.eclipse.ui.navigator.resources.GoIntoActions

Specifically, this is the expression that is causing the exceptions to be logged:

<and>
    <adapt type="org.eclipse.core.resources.IProject" />
    <test property="org.eclipse.core.resources.open" value="true"/> 
</and>

But the failure in the evaluation of this expression is caused by bug201743.

Before bug201743, the adapter to IProject was never found for objects like GroupEJBProvider (even if they implement IAdaptable and adapt IProject). After bug201743, the adapter is found, and then, when the property is tested, the exception is logged. 

I'm investigating which is the best way to fix this.
Comment 3 Roberto Sanchez Herrera CLA 2013-09-06 12:46:53 EDT
Hi, I moved this bug to JDT UI because I believe this is a possible problem with the action provider org.eclipse.ui.navigator.resources.GoIntoActionProvider in org.eclipse-jdt.ui

Its current enablement expression includes this:

<and>
    <adapt type="org.eclipse.core.resources.IProject" />
    <test property="org.eclipse.core.resources.open"  value="true"/>
</and> 

This causes that if the selection Adapts IProject, but is not an IProject, then the property org.eclipse.core.resources.open is tested against the original object (not the adapted one) and then the exception is logged. 

I believe this could be fixed by changing the expression to this:


<and>
    <adapt type="org.eclipse.core.resources.IProject"/>
    <adapt type="org.eclipse.core.resources.IProject">
       <test property="org.eclipse.core.resources.open"  value="true"/>
    </adapt>
</and> 


In this way, if the selection is adaptable to an IProject, then the property will be tested against an IProject object. 

Ideas?
Comment 4 Dani Megert CLA 2013-09-09 06:28:31 EDT
To me this looks like the adapter you return for IProject is not a real IProject, which would be illegal. I just tried this on a random type and as long as it returns an IProject, there is no exception.
Comment 5 Roberto Sanchez Herrera CLA 2013-09-09 10:13:53 EDT
(In reply to Dani Megert from comment #4)
> To me this looks like the adapter you return for IProject is not a real
> IProject, which would be illegal. I just tried this on a random type and as
> long as it returns an IProject, there is no exception.

Thanks for taking  a look at this. The object returned is an IProject. This is the getApadter(Class) method of GroupEJBProvider for example:


public Object getAdapter(Class adapter) {
    if (IProject.class == adapter){
        return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
    }
    return null;
}

Which random type did you test with?
Comment 6 Dani Megert CLA 2013-09-09 10:49:35 EDT
(In reply to Roberto Sanchez Herrera from comment #5)

I tried again and can now reproduce the problem  with clean 'master' (not sure what went wrong the first time).

Note that your suggested fix would not work and even if it did, it would be a workaround.

Moving to Platform UI for further debugging. Bug 414912 looks similar which is claimed to be fixed for 4.4 M2.
Comment 7 Dani Megert CLA 2013-09-09 10:50:33 EDT
*** Bug 298285 has been marked as a duplicate of this bug. ***
Comment 8 Paul Webster CLA 2013-09-09 11:00:56 EDT
This one was added in bug 302791 for Helios.

PW
Comment 9 Paul Webster CLA 2013-09-09 11:09:50 EDT
It looks like this is suspect:

<and>
    <adapt type="org.eclipse.core.resources.IProject" />
    <test property="org.eclipse.core.resources.open" value="true"/> 
</and>


The test element is outside the adapt element, so you have no gaurantee of the type of object that is being tested.

PW
Comment 10 Roberto Sanchez Herrera CLA 2013-09-09 11:48:48 EDT
(In reply to Paul Webster from comment #9)
> It looks like this is suspect:
> 
> <and>
>     <adapt type="org.eclipse.core.resources.IProject" />
>     <test property="org.eclipse.core.resources.open" value="true"/> 
> </and>
> 
> 
> The test element is outside the adapt element, so you have no gaurantee of
> the type of object that is being tested.
> 
> PW

Hi Paul, 
So was I in the right way in comment#3, and the test of the property should be inside the adapt element to make sure you are using an IProject for testing the property?
Comment 11 Dani Megert CLA 2013-09-10 04:17:14 EDT
(In reply to Paul Webster from comment #9)
> It looks like this is suspect:
> 
> <and>
>     <adapt type="org.eclipse.core.resources.IProject" />
>     <test property="org.eclipse.core.resources.open" value="true"/> 
> </and>
> 
> 
> The test element is outside the adapt element, so you have no gaurantee of
> the type of object that is being tested.
> 
> PW

I should have looked closer. The Expression Language implements conditional and/or but that does not mean it will use the adapter for the next evaluation.

Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=9fe47a4ae03f3e28b7ced0985e1a160853459044

and also in the Navigator who makes the same contribution:

Fixed with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=c490fbda2425322c236f96f019be38b60caf42e0
Comment 12 Roberto Sanchez Herrera CLA 2013-09-10 09:59:49 EDT
Thank you Dani and Paul.
Comment 13 Paul Webster CLA 2013-09-17 13:40:02 EDT
In 4.4.0.I20130916-2330

PW
Comment 14 Roberto Sanchez Herrera CLA 2013-10-18 11:26:41 EDT
Thank you again for fixing this in Luna. However, it is possible to backport the fix to Kepler SR2?
Comment 15 Dani Megert CLA 2013-10-21 11:50:31 EDT
(In reply to Roberto Sanchez Herrera from comment #14)
> Thank you again for fixing this in Luna. However, it is possible to backport
> the fix to Kepler SR2?

Done, see bug 419992.
Comment 16 Roberto Sanchez Herrera CLA 2013-10-21 11:53:41 EDT
(In reply to Dani Megert from comment #15)
> (In reply to Roberto Sanchez Herrera from comment #14)
> > Thank you again for fixing this in Luna. However, it is possible to backport
> > the fix to Kepler SR2?
> 
> Done, see bug 419992.

Thank you!
Comment 17 Paul Webster CLA 2013-11-22 14:31:19 EST
*** Bug 418241 has been marked as a duplicate of this bug. ***