Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 516329

Summary: On Reopen Eclipse the Variable "project.loc" can't be resolved on target definition
Product: [Eclipse Project] PDE Reporter: Christoph Laeubrich <laeubi>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: julian.honnen, mleone, Vikas.Chandra
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Christoph Laeubrich CLA 2017-05-08 14:32:22 EDT
What steps will reproduce the problem?
1. Create a target plattform referencing the varaiable  ${project_loc}
2. Open the target and apply it --> everything works (keep the tab open!)
3. Open some source code files to have more tabs and keep them open
4. Close Eclipse
5. Start Eclipse and use STRG+SHIFT+R (find resource) and select the target
6. The editor complains about unresolvable variable project_loc
7. Close the editor and reopen it --> everything fine now

It seems that this also happens from time to time under other conditions if the target definition editor is keept open.


-- Error Details --
Date: Mon May 08 07:54:27 CEST 2017
Message: Variable references empty selection: ${project_loc}
Severity: Error
Product: Eclipse 4.5.2.20160218-0600 (org.eclipse.epp.package.rcp.product)
Plugin: org.eclipse.debug.core
Session Data:
eclipse.buildId=4.5.2.M20160212-1500
java.version=1.8.0_66
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -vm C:\Program Files\Java\jdk1.8.0_65 -product org.eclipse.epp.package.rcp.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -clean -vm C:\Program Files\Java\jdk1.8.0_65 -product org.eclipse.epp.package.rcp.product
Comment 1 Mark Leone CLA 2017-05-25 10:11:24 EDT
I've had this problem also, noted first with Mars, and currently still happening with Neon (4.6.3). I have some target platform locations of type directory, and they often fail to load when starting eclipse, with the error message "variable references empty selection ${project_loc}" appearing in the target editor as the child node of the directory location that failed to load. I assume the error means the variable project_loc is not being resolved, which is why I think it's the same bug as reported here.

Clicking "Reload" in the target editor fixes it. It doesn't happen all the time, but maybe 80% of the time. I haven't been able to find a configuration or set of steps that always produces the problem. Sometimes I get an NPE in org.eclipse.pde.internal.core.target.IUBundleContainer (stack trace below) when the problem occurs, which seems to be related. But the problem often happens without that NPE being reported.

!ENTRY org.eclipse.core.jobs 4 2 2017-05-25 09:19:02.693
!MESSAGE An internal error occurred during: "Resolving Target Definition".
!STACK 0
java.lang.NullPointerException
        at org.eclipse.pde.internal.core.target.IUBundleContainer.generateBundle(IUBundleContainer.java:429)
        at org.eclipse.pde.internal.core.target.IUBundleContainer.generateResolvedBundles(IUBundleContainer.java:415)
        at org.eclipse.pde.internal.core.target.IUBundleContainer.cacheBundles(IUBundleContainer.java:306)
        at org.eclipse.pde.internal.core.target.IUBundleContainer.synchronizerChanged(IUBundleContainer.java:332)
        at org.eclipse.pde.internal.core.target.P2TargetUtils.notify(P2TargetUtils.java:807)
        at org.eclipse.pde.internal.core.target.P2TargetUtils.synchronize(P2TargetUtils.java:744)
        at org.eclipse.pde.internal.core.target.TargetDefinition.resolve(TargetDefinition.java:259)
        at org.eclipse.pde.internal.ui.editor.targetdefinition.TargetEditor$TargetChangedListener$1.run(TargetEditor.java:479)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 2 Vikas Chandra CLA 2017-05-26 00:01:36 EDT
Looks duplicate of bug 507325. This problem is fixed now.
Comment 3 Mark Leone CLA 2017-05-26 12:09:32 EDT
Do you know if https://bugs.eclipse.org/bugs/show_bug.cgi?id=507325 fixed the problem reported in the OP (which didn't mention the NPE)? I assume it did, but I'd like to verify it since in my case the occurrence of the NPE and the failure to resolve directory locations in the target do not always coincide.

I tried to verify https://bugs.eclipse.org/bugs/show_bug.cgi?id=507325 by running 4.7, but I'm unable to launch 4.7 RC1 on my EL6 system because of this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=515155. (The bug is reported as fixed in M7, but it still occurs for me)
Comment 4 Mark Leone CLA 2017-05-26 13:19:01 EDT
I was able to run 4.7 RC1 32-bit on my EL6 system. The problem reported in this bug does not appear to be fixed in [507325](https://bugs.eclipse.org/bugs/show_bug.cgi?id=507325), unless I misunderstand what the target milestones in bugzilla mean. The aforementioned bug is closed, with target milestone 4.7 M5. I assume that means the fix is included in 4.7 RC1. Is that correct?

If so, then it does not address the problem reported in this bug. In 4.7 RC1 I consistently see the problem reported in the OP here, although I haven't encountered the NPE so far.
Comment 5 Vikas Chandra CLA 2017-05-29 04:00:12 EDT
Can you please check in I20170528-0800?

The NPE was fixed long time back ( 4.7M5).

Bug 515155 is fixed very recently.
Comment 6 Mark Leone CLA 2017-05-30 09:04:47 EDT
Please clarify what you're asking to be checked. I understand the NPE was fixed in M7, and bug 515155 is not relevant to this problem. I was originally unable to test the M7 fix for the NPE because of bug 515155, but I worked around that by using a 32-bit version of the app, and I saw also that there was a fix on Friday awaiting additional verification.

So are you suggesting that there is a fix for the problem reported here (target locations of type directory not resolved until manually reloaded) in I20170528-0800, apart from the NPE? Since I still have this problem in M7, and not the NPE, I believe they are separate problems.
Comment 7 Mark Leone CLA 2017-05-30 09:05:25 EDT
Correction: the NPE was fixed in M5
Comment 8 Christoph Laeubrich CLA 2017-11-05 12:46:56 EST
While it now works to resolve if you wait some time after opening the target, it still seem to cause also problems on lost target definition after restart, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=490909
Comment 9 Eclipse Genie CLA 2019-10-27 04:52:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 10 Christoph Laeubrich CLA 2019-10-30 01:45:13 EDT
This is still not working on

Version: Photon Release (4.8.0)
Build id: 20180619-1200

the target definition is lost after restart, if the target is opened (or the target editor activated) then it resolves but one must use "Reload Targetplatform" to successfully apply it to the workspace.

This results in at least three Workspace-Rebuilds:
1) when opening eclipse, everything is red
2) after activating the target editor
3) after "Reload Targetplatform"
4) sometimes (because of inter project dependencies) another rebuild is triggered because the dependencies now can compile
Comment 11 Julian Honnen CLA 2019-10-30 05:22:14 EDT
${project_loc} refers to selected resource's project. Where selected means the active editor's file input or package explorer selection.

Defining a target in terms of an UI selection will obviously never work correctly so I'm marking this as WONTFIX.
Comment 12 Julian Honnen CLA 2019-10-30 05:23:48 EDT
*** Bug 490909 has been marked as a duplicate of this bug. ***
Comment 13 Julian Honnen CLA 2019-10-30 06:15:08 EDT
*** Bug 490909 has been marked as a duplicate of this bug. ***