holgerfriedrich commented on code in PR #2720:
URL: https://github.com/apache/karaf/pull/2720#discussion_r3835993956
##########
config/core/src/main/java/org/apache/karaf/config/core/MetaServiceCaller.java:
##########
@@ -73,13 +72,15 @@ public static List<String>
getPidsWithMetaInfo(BundleContext context) {
* Attempts to find MetaType information for the specified PID and
* invokes the supplied callback with the result of the search
*/
- public static <T> T doWithMetaType(BundleContext context, String pid,
Function<Optional<MetaInfo>, T> function) {
+ public static <T> T doWithMetaType(BundleContext context, String pid,
Function<MetaInfo, T> function) {
ServiceReference<MetaTypeService> ref =
context.getServiceReference(MetaTypeService.class);
if (ref != null) {
try {
MetaTypeService metaService = context.getService(ref);
MetaInfo metaInfo = getMetatype(context, metaService, pid);
- return function.apply(Optional.ofNullable(metaInfo));
+ if (metaInfo != null) {
Review Comment:
This change seems to have an effect on semantics for the null case: before,
`function.apply` of an empty `Optional` was returned, now the fall-through may
just return null.
This could lead to an NPE in the statement from the other file above
(`return MetaServiceCaller.doWithMetaType(...)`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]