Bug 565257

Summary: org.eclipse.urischeme.internal.registration.RegistrationWindows causes NPE in JNA access to windows registry
Product: [Eclipse Project] Platform Reporter: Jonah Graham <jonah>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: rolf.theunissen
Version: 4.17   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=545790
Whiteboard:

Description Jonah Graham CLA 2020-07-15 22:59:38 EDT
I am seeing the below exception on Windows in my dev environment (2020-09 M1 target platform)

!ENTRY org.eclipse.urischeme 4 0 2020-07-15 22:57:50.679
!MESSAGE 
!STACK 0
java.lang.NullPointerException
	at com.sun.jna.Native.toCharArray(Native.java:824)
	at com.sun.jna.platform.win32.Advapi32Util.registrySetStringValue(Advapi32Util.java:1233)
	at com.sun.jna.platform.win32.Advapi32Util.registrySetStringValue(Advapi32Util.java:1262)
	at org.eclipse.urischeme.internal.registration.WinRegistry.setValueForKey(WinRegistry.java:33)
	at org.eclipse.urischeme.internal.registration.RegistryWriter.addScheme(RegistryWriter.java:60)
	at org.eclipse.urischeme.internal.registration.RegistrationWindows.handleSchemes(RegistrationWindows.java:61)
	at org.eclipse.urischeme.AutoRegisterSchemeHandlersJob.run(AutoRegisterSchemeHandlersJob.java:70)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I think this happens because the value passed to a registry can  not be null, but in RegistrationWindows.handleSchemes it calls getEclipseLauncher() which is used as the value, but getEclipseLauncher() can return null.
Comment 1 Rolf Theunissen CLA 2020-07-16 11:44:09 EDT
This is a regression from Bug 545790, there is no null check for launcherPath while indeed it could be null.