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

Maven bnd:7.1.0:bnd-process. NPE after migrating from 7.0.0 #6387

Closed
dpishchukhin opened this issue Dec 4, 2024 · 6 comments · Fixed by #6388
Closed

Maven bnd:7.1.0:bnd-process. NPE after migrating from 7.0.0 #6387

dpishchukhin opened this issue Dec 4, 2024 · 6 comments · Fixed by #6388

Comments

@dpishchukhin
Copy link

After updating the maven plugin version to the version 7.1.0, there is an NPE

Exception: java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "map" is null
	at aQute.bnd.osgi.metainf.MetaInfService.getServiceFiles(MetaInfService.java:63)
	at aQute.bnd.osgi.metainf.MetaInfServiceParser.analyzeJar(MetaInfServiceParser.java:55)
	at aQute.bnd.osgi.Analyzer.lambda$doPlugins$21(Analyzer.java:992)
	at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:1024)
	at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:988)
        .....
@chrisrueger
Copy link
Contributor

I will have a look.

@chrisrueger
Copy link
Contributor

chrisrueger commented Dec 4, 2024

I almost have a fix ready. I think that happens where there is a jar with a META-INF/services/subfolder BUT META-INF/services itself does not contain any files.
Could you maybe confirm? @dpishchukhin

@chrisrueger chrisrueger mentioned this issue Dec 4, 2024
@dpishchukhin
Copy link
Author

I almost have a fix ready. I think that happens where there is a jar with a META-INF/services/subfolder BUT META-INF/services itself does not contain any files. Could you maybe confirm? @dpishchukhin

Yes, that is correct.

@chrisrueger
Copy link
Contributor

chrisrueger commented Dec 4, 2024

I almost have a fix ready. I think that happens where there is a jar with a META-INF/services/subfolder BUT META-INF/services itself does not contain any files. Could you maybe confirm? @dpishchukhin

Yes, that is correct.

Could you give some more details about this specific layout? I could not find anything in the Java SPI specification, that subfolders in META-INF/services are allowed (or considered by the SPI lookup mechanism).

Just want to find out more, about this specific use case.

Update: or is your META-INF/services folder just empty?

@dpishchukhin
Copy link
Author

you can check Karaf Shell Commands

@chrisrueger
Copy link
Contributor

@pkriens While my PR #6388 fixes the NPE, the question would be what to do with Subfolders inside META-INF/services like in the example of Karaf Shell Commands

which has nested subfolders (/META-INF/services/org/apache/karaf/shell/commands) where /commands seems to be the file containing the references to the Implementations.

Currently files in subfolders are ignored by our MetaInfServices.java.

... and as far as I could find out, also ignored by Java.
So maybe that is a Karaf-specific thing? Should we just ignored it? (but of course prevent the NPE like #6388 )

References:

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