You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by GitBox <gi...@apache.org> on 2022/09/23 12:35:40 UTC
[GitHub] [felix-dev] tjwatson commented on a diff in pull request #172: [FELIX-6564] Fixed NPE while retrieving component descriptions from SCR
tjwatson commented on code in PR #172:
URL: https://github.com/apache/felix-dev/pull/172#discussion_r978575369
##########
scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java:
##########
@@ -117,6 +117,10 @@ public Collection<ComponentConfigurationDTO> getComponentConfigurationDTOs(Compo
try
{
ComponentHolder<?> holder = getHolderFromDescription( description);
+ // the holder can also be null if the associated component is deregistered
Review Comment:
If null is allowed to be returned here then I think we need null checks in all 4 locations it is called:
`disableComponent(ComponentDescriptionDTO)`
`enableComponent(ComponentDescriptionDTO)`
`getComponentConfigurationDTOs(ComponentDescriptionDTO)`
`isComponentEnabled(ComponentDescriptionDTO)`
Also, looking at `getHolderFromDescription(ComponentDescriptionDTO description)` I think it has an issue where it could get called on an uninstalled bundle in which case `Bundle b = context.getBundle(bundleId);` will result in a `null` value in `b` causing an NPE also.
--
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: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org