Bug 565257 - org.eclipse.urischeme.internal.registration.RegistrationWindows causes NPE in JNA access to windows registry
Summary: org.eclipse.urischeme.internal.registration.RegistrationWindows causes NPE in...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.17   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-15 22:59 EDT by Jonah Graham 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 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.