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

Bug 566490

Summary: NPE in DesktopFileWriter.escapeSpaces
Product: [Eclipse Project] Platform Reporter: Christian Dietrich <christian.dietrich.opensource>
Component: UIAssignee: Andrey Loskutov <loskutov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: loskutov, wearybands
Version: 4.17   
Target Milestone: 4.18 M3   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=530835
https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/171409
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=13bd8d6d0429e44bd59cd28dbab4fea566442396
https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/171438
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b78036673f090e2042afc4964a38556a197b7c76
Whiteboard:

Description Christian Dietrich CLA 2020-08-28 10:14:44 EDT
java.lang.NullPointerException

	at org.eclipse.urischeme.internal.registration.DesktopFileWriter.escapeSpaces(DesktopFileWriter.java:186)

	at org.eclipse.urischeme.internal.registration.DesktopFileWriter.getMinimalDesktopFileContent(DesktopFileWriter.java:175)

	at org.eclipse.urischeme.internal.registration.RegistrationLinux.readFileOrGetInitialContent(RegistrationLinux.java:115)

	at org.eclipse.urischeme.internal.registration.RegistrationLinux.changeDesktopFile(RegistrationLinux.java:98)

	at org.eclipse.urischeme.internal.registration.RegistrationLinux.handleSchemes(RegistrationLinux.java:64)

	at org.eclipse.urischeme.AutoRegisterSchemeHandlersJob.run(AutoRegisterSchemeHandlersJob.java:78)

	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

getting these in our tests

https://travis-ci.org/github/itemis/xtext-reference-projects/jobs/719838186
Comment 1 Christian Dietrich CLA 2020-08-28 10:21:58 EDT
affects M3, Problem also was there in M2
Comment 2 Christian Dietrich CLA 2020-08-28 10:28:09 EDT
looks like there is no
eclipse.launcher
system property 
when you run tests
Comment 3 Christian Dietrich CLA 2020-08-28 10:36:46 EDT
on windows there is a fallback implemented using
 System.getProperty("eclipse.home.location")
Comment 4 Andrey Loskutov CLA 2020-10-28 10:37:12 EDT
*** Bug 568165 has been marked as a duplicate of this bug. ***
Comment 5 Umair Iqbal CLA 2020-10-28 10:41:43 EDT
It also happens in linux, I am using ubuntu 18.04 and I see this issue, any solution for linux?
Comment 6 Christian Dietrich CLA 2020-10-28 10:44:19 EDT
@Umair Iqba
this bug is a about linux.

the alternate paths on windows dont exist on linux.
Comment 7 Umair Iqbal CLA 2020-10-28 10:46:58 EDT
Do you mean it is fixed/implemented? I am using eclipse official release 2020-09, will this issue be fixed in that official release or I have to wait for the next official eclipse release?
Comment 8 Christian Dietrich CLA 2020-10-28 10:47:56 EDT
no this is a open bug on linux

for WINDOWS there are alternative treatments but NOT FOR LINUX
Comment 9 Umair Iqbal CLA 2020-10-28 10:51:30 EDT
Ok, I don't see the issue on windows but only on linux. Is there any ETA for the fix ?
Comment 10 Christian Dietrich CLA 2020-10-28 10:52:26 EDT
as nobody seems to work on it: NO
Comment 11 Andrey Loskutov CLA 2020-10-28 11:09:57 EDT
I can't see this misery anymore, I will push a patch in a moment.
Comment 12 Umair Iqbal CLA 2020-10-28 11:15:42 EDT
Thank you, Will this fix be available in eclipse 2020-09? My target definitions for eclipse looks like

<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
        <repository location="http://my.server.com:8081/nexus/content/repositories/eclipse-2020-09"/>
        <unit id="org.eclipse.cdt.build.crossgcc.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.cdt.debug.gdbjtag.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.cdt.launch.remote.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.egit.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.jdt.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.swtbot.eclipse.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.swtbot.eclipse.gef.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.swtbot.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.swtbot.ide.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.tcf.cdt.feature.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.tcf.te.tcf.feature.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.tcf.te.tcf.launch.cdt.feature.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.tm.terminal.feature.feature.group" version="0.0.0"/>
	<unit id="org.eclipse.wst.xml_ui.feature.feature.group" version="0.0.0"/>
</location>
Comment 13 Eclipse Genie CLA 2020-10-28 11:16:08 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/171409
Comment 14 Andrey Loskutov CLA 2020-10-28 11:17:19 EDT
(In reply to Umair Iqbal from comment #12)
> Thank you, Will this fix be available in eclipse 2020-09?

For sure not, except you would backport & build your own SDK.
Comment 15 Umair Iqbal CLA 2020-10-28 11:19:55 EDT
Hmmm, so it means I have to wait for the next official eclipse release if I don't want to build my own SDK
Comment 17 Andrey Loskutov CLA 2020-10-28 12:04:52 EDT
(In reply to Umair Iqbal from comment #15)
> Hmmm, so it means I have to wait for the next official eclipse release if I
> don't want to build my own SDK

You simply could add "-Declipse.launcher=/dev/null" to the test configuration, I believe that should work.
Comment 18 Andrey Loskutov CLA 2020-10-28 12:06:20 EDT
@Christian: could you please verify if your test job will work with the next integration build?
Comment 19 Christian Dietrich CLA 2020-10-28 12:10:18 EDT
unfortunately we dont use ibuild
will see if i can fake a build
on friday
(have to rework target file)
Comment 20 Umair Iqbal CLA 2020-10-28 12:23:59 EDT
(In reply to Andrey Loskutov from comment #17)
> (In reply to Umair Iqbal from comment #15)
> > Hmmm, so it means I have to wait for the next official eclipse release if I
> > don't want to build my own SDK
> 
> You simply could add "-Declipse.launcher=/dev/null" to the test
> configuration, I believe that should work.

By test configuration you mean adding this as an option to the java command that executes the tests like 

java -Declipse.launcher=/dev/null -XX:+CMSClassUnloadingEnabled -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 
-jar /eclipse/plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar 
org.eclipse.equinox.launcher.Main 
-swtbot
-application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication 
-product org.eclipse.platform.ide 
-testApplication /eclipse/plugins/org.eclipse.ui.ide.workbench 
-data /eclipse/workspace 
-testPluginName org.my.ui.stt.test 
-className org.my.ui.test.collection.window.WindowTests
Comment 21 Andrey Loskutov CLA 2020-10-28 12:44:39 EDT
(In reply to Umair Iqbal from comment #20)
> By test configuration you mean adding this as an option to the java command
> that executes the tests like 
> 
> java -Declipse.launcher=/dev/null -XX:+CMSClassUnloadingEnabled

Sure.
Comment 22 Christian Dietrich CLA 2020-10-29 07:55:12 EDT
i can confirm this fixed using latest ibuild
Comment 23 Eclipse Genie CLA 2020-10-29 08:07:23 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/171438