Apoorv-R98 opened a new pull request, #521:
URL: https://github.com/apache/felix-dev/pull/521
## Summary
`Log.serviceChanged()` throws a `NullPointerException` when
`ServiceReference.getBundle()` returns `null` during service event processing.
Per the OSGi spec, `ServiceReference.getBundle()` returns `null` when the
registering bundle has already been unregistered. This is a known race
condition during service unregistration, but the Felix log layer does not guard
against it, resulting in a misleading ERROR-level NPE in logs.
## Fix
Extract the bundle reference and return early if null in
`Log.serviceChanged()`:
```java
final Bundle bundle = event.getServiceReference().getBundle();
if (bundle == null)
{
return;
}
```
Note: `event.getServiceReference()` itself is guaranteed non-null by
`EventObject`'s constructor, so only the bundle needs to be null-checked.
## Related
- https://issues.apache.org/jira/browse/FELIX-6845
--
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]