Bug 545790 - Link handler for URI scheme cannot be added if "eclipse.launcher" property is not set
Summary: Link handler for URI scheme cannot be added if "eclipse.launcher" property is...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.12   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.12 M1   Edit
Assignee: Sebastian Ratz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-26 08:47 EDT by Sebastian Ratz CLA
Modified: 2020-07-16 11:44 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Ratz CLA 2019-03-26 08:47:34 EDT
When the "eclipse.launcher" property is not set, e.g. if started as a target platform, the UriSchemeHandlerPreferencePage does not work as expected:

IOperatingSystemRegistration.getEclipseLauncher() can potentially return null, which leads to a NPE when checking an entry in the list.

If the location of the own launcher cannot be determined, the page should probably show an error/warning message that it cannot be used and the controls should be disabled.

As for determining the location:

For MacOS, getEclipseLauncher() does not rely on "eclipse.launcher", it should already work when used as target.

For Windows, getEclipseLauncher() currently relies on "eclipse.launcher", but the org.eclipse.urischeme.internal.registration.RegistryWriter also knows of a fallback that uses "eclipse.home.location". This fallback can be moved over to org.eclipse.urischeme.internal.registration.RegistrationWindows.
The fallback searches for ".exe" files in the "eclipse.home.location" directory.

For Linux, no fallback exists, yet, but can probably be implemented similarly to windows.
Comment 1 Eclipse Genie CLA 2019-03-26 08:58:02 EDT
New Gerrit change created: https://git.eclipse.org/r/139486
Comment 3 Matthias Becker CLA 2019-04-03 06:12:52 EDT
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/139486 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=e3efe330bca1b05bc0a6cd224c535b313f47d4db

Thank you Sebastian for fixing this.
Comment 4 Sebastian Ratz CLA 2019-04-03 06:38:55 EDT
IOperatingSystemRegistration.getEclipseLauncher() can still return null, it the launcher cannot be found.

So UrlHandlerPreferencePageContributor also should be able to handle such a case correctly.

Currently, this causes a NullPointerException.

If the launcher cannot be determined, it could for example set an error status on the preference page and disable the table control.
Comment 5 Eclipse Genie CLA 2019-04-08 09:38:58 EDT
New Gerrit change created: https://git.eclipse.org/r/140215
Comment 6 Eclipse Genie CLA 2019-04-08 09:51:14 EDT
New Gerrit change created: https://git.eclipse.org/r/140216
Comment 9 Matthias Becker CLA 2019-04-08 11:11:12 EDT
Sebastian: Thank you for fixing.