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

Bug 288759

Summary: [reconciler] eclipse will always report null point error when a non-existing path is used for links
Product: [Eclipse Project] Equinox Reporter: Ben Xu <xufengbing>
Component: p2Assignee: DJ Houghton <dj.houghton>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: loskutov, pascal
Version: unspecified   
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
patch code for this enhancement
none
patch none

Description Ben Xu CLA 2009-09-07 11:15:54 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 GTB5
Build Identifier: I20090611-1540

if you add a link into the links directory, and the path property of that link is a directory that not exist, eclipse will report error when startup say "no repository found at file:/..."

This mechanism doesn't work for the following use case, where we intend to add some non-exist directory to eclipse link. (Actually, we use such use case in our product)


Use Case Description:
Some external eclipse plug-ins contained in other product (call it product B) need to be used by eclipse product once product B is installed.
 
For example£º

In our use case:
XProduct system is a big product based on eclipse.
XHelp system is another eclipse based help documentation system for XProduct.

Both XProduct and XHelp are designed to be totally different systems. They can be separately installed/uninstalled/used by customer.

They only common use case between XProduct and XHelp is that if  XHelp is installed in the same workstation as XProduct , then Eclipse in XProduct must be able to use plug-ins in XHelp. (Plug-ins for XHelp is designed to be installed in a special directory and never change£¬say $XPRODUCT_HELP_DIR).

The easiest solution is to add a link file to the eclipse¡¯s link directory in the installation directory of XProduct. That link will point to $XPRODUCT_HELP_DIR.

AS IS:
These solution works quite well on Eclipse 3.1 ¨C 3.3. On eclipse 3.5,  if XProduct is installed while XHelp is not installed, Eclipse will report an error after starting XProduct, complaining that $XPRODUCT_HELP_DIR not exist. 

In our use case this is not an error for XProduct but Eclipse reports this as en error. 

TO BE: Eclipse should allow us to use ¡°empty¡± link directories and do not report an error in such case.


Reproducible: Always
Comment 1 Ben Xu CLA 2009-09-08 03:50:31 EDT
Created attachment 146638 [details]
patch code  for this enhancement

Attachment patch is one solution for this use case:
add one property "optional" for the link content, only this property is set and set to "true",then eclipse will check the path very early and filter path if not exists.

for example, before enhancement, a link named help has the following content:

path=/data/help_contents

before this enhancement, if "/data/help_contents" not exist, eclipse will always report an error on startup.

after this enhancement, if this help link is intentionally used for add document later. The content of the help link can be specified as

path=/data/help_contents
optional=true
Comment 2 Andrey Loskutov CLA 2009-09-08 04:33:19 EDT
P.S.
The patch is against latest CVS HEAD.
Comment 3 DJ Houghton CLA 2010-08-25 15:15:51 EDT
Created attachment 177463 [details]
patch

Thanks for the patch but unfortunately with the current patch you won't get the original stack trace on startup, but you will get a new error message in the log file:
    !MESSAGE Unable to determine link location from file: /tmp/eclipse/dropins/foo.link

I've attached a patch which will ignore non-existant optional repositories pointed to by link files.
Comment 4 DJ Houghton CLA 2010-08-25 15:17:02 EDT
Patch released to HEAD.
Closing.
Comment 5 Andrey Loskutov CLA 2010-08-25 15:29:10 EDT
Thanks for accepting the patch. 

I think one missing bit is some kind of documentation for the solution, which in my opinion belongs to the help package delivered with PDT.

I think something like "Link file may contain an optional 'optional=true' argument. In such case, link directory must not necessarily exists." would be good.
Comment 6 DJ Houghton CLA 2010-08-25 15:50:45 EDT
Opened bug 323649 to add the new attribute to the Help.
Comment 7 DJ Houghton CLA 2010-09-16 12:15:40 EDT
There was a problem with tagging HEAD so this fix won't appear in integration builds until the first build after 3.7 M2.