Bug 572634 - java.lang.NullPointerException: Cannot invoke "java.util.function.Supplier.get()" because "<parameter1>" is null
Summary: java.lang.NullPointerException: Cannot invoke "java.util.function.Supplier.ge...
Status: CLOSED DUPLICATE of bug 571990
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.20   Edit
Hardware: PC Windows 10
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-06 15:58 EDT by Fabio Zadrozny CLA
Modified: 2021-07-08 10:06 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2021-04-06 15:58:26 EDT
I'm getting the following exception when initializing Jython (which is used internally in PyDev) -- note that while the exception is happening on PyDev this seems to be an Eclipse regression on 2021-03 (4.19) as it worked properly on 2020-12 (4.18).

```
java.lang.NullPointerException: Cannot invoke "java.util.function.Supplier.get()" because "<parameter1>" is null
	at java.base/java.util.Optional.orElseGet(Unknown Source)
	at org.eclipse.osgi.internal.loader.buddy.GlobalPolicy.loadResource(GlobalPolicy.java:66)
	at org.eclipse.osgi.internal.loader.buddy.PolicyHandler.doBuddyResourceLoading(PolicyHandler.java:171)
	at org.eclipse.osgi.internal.loader.BundleLoader.findResource(BundleLoader.java:685)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.getResource(ModuleClassLoader.java:216)
	at org.eclipse.osgi.internal.framework.ContextFinder.getResource(ContextFinder.java:161)
	at java.base/java.lang.ClassLoader.getResourceAsStream(Unknown Source)
	at org.python.core.PySystemState.initialize(PySystemState.java:998)
	at org.python.core.PySystemState.initialize(PySystemState.java:955)
	at org.python.core.PySystemState.initialize(PySystemState.java:938)
```

This seems to be a bug in `org.eclipse.osgi.internal.loader.buddy.GlobalPolicy.loadResource(String)` which is not protecting from a NPE properly.
Comment 1 Thomas Wolf CLA 2021-04-07 03:54:26 EDT
Duplicate of bug 571990?

I see the fix in 4.20 was back-ported to 4.19. How do users of 4.19 get that hotfix?
Comment 2 Fabio Zadrozny CLA 2021-04-07 07:06:02 EDT
I think this is such a serious bug that a 4.19a just with this fix would be something to consider... (at least in my case, I'm currently having to ask users to skip using 4.19 in order to use PyDev as I don't really see any workaround to be done in the plugin side).
Comment 3 Andrey Loskutov CLA 2021-04-08 02:39:28 EDT

*** This bug has been marked as a duplicate of bug 571990 ***
Comment 4 Fabio Zadrozny CLA 2021-04-11 06:30:43 EDT
As a note for any PyDev users arriving here, for 4.19, it seems like this won't work at all and there is no workaround.


The only solutions are keeping to 4.18 (2020-12) or using a newer build (such as Platform 4.20.M1).

Downloads may be gotten from: http://download.eclipse.org/eclipse/downloads/ (if you only need PyDev you can get the `Platform Runtime Binary` from your selected version).
Comment 5 Andrew Bielech CLA 2021-07-05 00:48:42 EDT
Installed eclipse 4.20 today and PyDev. When starting eclipse, I'm getting "Error initializing internal Jython". Simple python codes I tried run OK. Any help would be appreciated.

thanks
Comment 6 Fabio Zadrozny CLA 2021-07-05 08:05:12 EDT
@Andrew Bielech I'm already using 4.20 myself with PyDev and it seems to be working for me (and I've had reports of other users also confirming it's working for them).

So, maybe this is something else? Can you please report the full stack trace you're having as well as the contents of the `Help > About` in a bug in PyDev itself in:

https://www.brainwy.com/tracker/PyDev/
Comment 7 Andrew Bielech CLA 2021-07-06 07:07:15 EDT
(In reply to Fabio Zadrozny from comment #6)
> @Andrew Bielech I'm already using 4.20 myself with PyDev and it seems to be
> working for me (and I've had reports of other users also confirming it's
> working for them).
> 
> So, maybe this is something else? Can you please report the full stack trace
> you're having as well as the contents of the `Help > About` in a bug in
> PyDev itself in:
> 
> https://www.brainwy.com/tracker/PyDev/

Not getting a trace because it's an error message box titled Error initializing internal Jython. Error message in part states "If you're using Eclipse 2021-03 (4.19), please use an older (or newer) version as this version is know to have a critical bug: #572634" when I click OK, message box is removed and the code runs fine. Eclipse asbout indicates that it's version 2021-06 (4.20.0).

Sorry for not being more clear in my initial post.

thanks
Comment 8 Gabor Körber CLA 2021-07-08 06:02:16 EDT
Note, Fabio, I had this Error popping up in Eclipse 4.8 Photon as well; I just did a fresh install of Eclipse 4.20, and still get this Error message when I run eclipse

```
Exception in thread "PyEdit initializer" java.lang.NullPointerException: Cannot read field "modules" because "systemState" is null
        at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:110)
        at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:92)
        at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:64)
        at org.python.pydev.jython.PythonInterpreterWrapper.<init>(PythonInterpreterWrapper.java:12)
        at org.python.pydev.jython.JythonPlugin.newPythonInterpreter(JythonPlugin.java:642)
        at org.python.pydev.jython.JythonPlugin.newPythonInterpreter(JythonPlugin.java:629)
        at org.python.pydev.editor.scripting.PyEditScripting.createInterpreter(PyEditScripting.java:43)
        at org.python.pydev.editor.scripting.PyEditScripting.<init>(PyEditScripting.java:38)
        at org.python.pydev.editor.PyEdit$3.run(PyEdit.java:583)
        at java.base/java.lang.Thread.run(Thread.java:831)
```

I have a system jython installed in ubuntu (but that is not recognized by PyDev) and now also downloaded a jython standalone jar and configured an interpreter with it in the hopes it would change something, and installed JDT Developer Tools because it was mentioned somewhere, basicly tried everything regarding to this.

Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)
Version: 2021-06 (4.20.0)
Build id: 20210612-2011
OS: Linux, v.5.4.0-73-generic, x86_64 / gtk 3.24.20
Java vendor: Oracle Corporation
Java runtime version: 16.0.1+9-24
Java version: 16.0.1

The only thing I did not switch was my workspace.

So this might be more a bug which we should continue in your bug repo, but I can confirm definitely, that the popup comes up also in non-4.19 eclipses :)
Comment 9 Fabio Zadrozny CLA 2021-07-08 10:06:48 EDT
It's failing to startup the internal Jython. The message in the dialog is misleading in this case. 

Please report this to https://www.brainwy.com/tracker/PyDev/ (where we can proceed the conversation so that we can try to diagnose why this is happening)