FELIX-2997 : java.lang.NullPointerException during shutdown while sending events
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1138785 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/eventadmin/impl/changelog.txt b/eventadmin/impl/changelog.txt
index e2ec2bb..c216220 100644
--- a/eventadmin/impl/changelog.txt
+++ b/eventadmin/impl/changelog.txt
@@ -2,6 +2,7 @@
-----------------------------
** Bug
+ * [FELIX-2997] - java.lang.NullPointerException during shutdown while sending events
* [FELIX-3002] - Embed the OBR specific information for the EventAdmin bundle in the manifest
diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/BlacklistingHandlerTasks.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/BlacklistingHandlerTasks.java
index ab31fe0..84282ed 100644
--- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/BlacklistingHandlerTasks.java
+++ b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/BlacklistingHandlerTasks.java
@@ -113,29 +113,32 @@
final List result = new ArrayList();
for (int i = 0; i < handlerRefs.length; i++)
{
- if (!m_blackList.contains(handlerRefs[i])
- && handlerRefs[i].getBundle().hasPermission(
- PermissionsUtil.createSubscribePermission(event.getTopic())))
+ final ServiceReference ref = handlerRefs[i];
+ final Bundle serviceBundle = ref.getBundle();
+ if ( serviceBundle != null )
{
- try
+ if (!m_blackList.contains(ref)
+ && serviceBundle.hasPermission(
+ PermissionsUtil.createSubscribePermission(event.getTopic())))
{
- if (event.matches(m_filters.createFilter(
- (String) handlerRefs[i]
- .getProperty(EventConstants.EVENT_FILTER))))
+ try
{
- result.add(new HandlerTaskImpl(handlerRefs[i],
- event, this));
- }
- } catch (InvalidSyntaxException e)
- {
- LogWrapper.getLogger().log(
- handlerRefs[i],
- LogWrapper.LOG_WARNING,
- "Invalid EVENT_FILTER - Blacklisting ServiceReference ["
- + handlerRefs[i] + " | Bundle("
- + handlerRefs[i].getBundle() + ")]", e);
+ if (event.matches(m_filters.createFilter(
+ (String) ref.getProperty(EventConstants.EVENT_FILTER))))
+ {
+ result.add(new HandlerTaskImpl(ref, event, this));
+ }
+ } catch (InvalidSyntaxException e)
+ {
+ LogWrapper.getLogger().log(
+ ref,
+ LogWrapper.LOG_WARNING,
+ "Invalid EVENT_FILTER - Blacklisting ServiceReference ["
+ + ref + " | Bundle("
+ + serviceBundle + ")]", e);
- m_blackList.add(handlerRefs[i]);
+ m_blackList.add(ref);
+ }
}
}
}