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

NPE in JBossClassLoaderHandler#findClasspathOrder #651

Closed
arthware opened this issue Feb 15, 2022 · 5 comments
Closed

NPE in JBossClassLoaderHandler#findClasspathOrder #651

arthware opened this issue Feb 15, 2022 · 5 comments

Comments

@arthware
Copy link

arthware commented Feb 15, 2022

In our scenario we get a NullPointerException in JBossClassLoaderHandler#findClasspathOrder

The moduleMap is null in our case, leading to an NPE in the next line, when accessing the entrySet.

final Map<Object, Object> moduleMap = (Map<Object, Object>) ReflectionUtils.getFieldVal(false,
callerModuleLoader, "moduleMap");
for (final Entry<Object, Object> ent : moduleMap.entrySet()) {

I was able to fix this with a simple null check. The scan returns the expected results.

Before:
for (final Entry<Object, Object> ent : moduleMap.entrySet() ) {

After:
Set<Entry<Object, Object>> moduleMapEntries = moduleMap != null ? moduleMap.entrySet() : Collections.emptySet(); for (final Entry<Object, Object> ent : moduleMapEntries) {

arthware pushed a commit to actico/classgraph that referenced this issue Feb 15, 2022
arthware pushed a commit to actico/classgraph that referenced this issue Feb 16, 2022
lukehutch added a commit that referenced this issue Feb 17, 2022
#651 fixes NPE in JbossClassLoaderHandler
@lukehutch
Copy link
Member

Fixed via #652. Thank you!

@arthware
Copy link
Author

Thank you for merging and your efforts!

@arthware
Copy link
Author

@lukehutch any chance to get a release pushed out in the next two weeks? That'd be awesome. Thank you very much!

@lukehutch
Copy link
Member

Yes, I'm sorry for the delay. I will do it in a few hours once my current flight lands!

@lukehutch
Copy link
Member

OK, I was able to push out version 4.8.140 with this fix. I probably should have just done this after merging. Thanks again for your fix!

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

No branches or pull requests

2 participants