Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in ClassList.loadClassList when context class loader is unavailable in current thread. #401

Closed
Htarlov opened this issue May 24, 2022 · 1 comment · Fixed by #402

Comments

@Htarlov
Copy link
Contributor

Htarlov commented May 24, 2022

Describe the bug
If we try to use Jep from a thread that has context class loader null (e.g. thread created from the outside of Java runtime) it fails with java.lang.NullPointerException at line 282 in ClassList in method loadClassList.

To Reproduce
Not yet have code to reproduce. A possible way similar to what we try to do:

Expected behavior
Instance of the class should be created without exception.

Environment (please complete the following information):

  • OS Ubuntu 18.04
  • Python 3.8
  • OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.18.04.1)
  • Jep Version: 4.0.3, 3.8.2
  • Python packages: numpy

Additional context
When Thread.currentThread().getContextClassLoader() returns null then that null is added to the list of class loaders and then code tries to call in = cl.getResourceAsStream(rsc); and fails. A null check is needed before adding a class loader to the list.

Htarlov added a commit to Htarlov/jep that referenced this issue May 24, 2022
…ntext class loader is unavailable in current thread (ninia#401)
bsteffensmeier pushed a commit that referenced this issue May 31, 2022
…ntext class loader is unavailable in current thread (#401)
@ndjensen
Copy link
Member

Fixed in Jep 4.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants