You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2015/12/09 10:55:11 UTC

svn commit: r1718800 - /aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java

Author: cschneider
Date: Wed Dec  9 09:55:11 2015
New Revision: 1718800

URL: http://svn.apache.org/viewvc?rev=1718800&view=rev
Log:
[ARIES-1468] Fixing NPE in case bundle is null

Modified:
    aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java

Modified: aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java?rev=1718800&r1=1718799&r2=1718800&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java (original)
+++ aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceEventData.java Wed Dec  9 09:55:11 2015
@@ -83,14 +83,17 @@ public class ServiceEventData {
     }
     
     public ServiceEventData(ServiceEvent serviceEvent) {
+        @SuppressWarnings("rawtypes")
         ServiceReference serviceReference = serviceEvent.getServiceReference();
         this.serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
         this.serviceInterfaces = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
-        Bundle bundle = serviceReference.getBundle();
-        this.bundleId = bundle.getBundleId();
-        this.bundleLocation = bundle.getLocation();
-        this.bundleSymbolicName = bundle.getSymbolicName();
         this.eventType = serviceEvent.getType();
+        Bundle bundle = serviceReference.getBundle();
+        if (bundle != null) {
+            this.bundleId = bundle.getBundleId();
+            this.bundleLocation = bundle.getLocation();
+            this.bundleSymbolicName = bundle.getSymbolicName();
+        }
     }
     
     /**