felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1430412 - /felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java
Date Tue, 08 Jan 2013 17:56:57 GMT
Author: rickhall
Date: Tue Jan  8 17:56:57 2013
New Revision: 1430412

URL: http://svn.apache.org/viewvc?rev=1430412&view=rev
Log:
Perform null check when trying to get bundle from service reference. (FELIX-3842)

Modified:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java?rev=1430412&r1=1430411&r2=1430412&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java
(original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java
Tue Jan  8 17:56:57 2013
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -68,7 +68,8 @@ public class LocalRepositoryImpl impleme
     public void serviceChanged(ServiceEvent event)
     {
         Bundle bundle = event.getServiceReference().getBundle();
-        if (bundle.getState() == Bundle.ACTIVE && event.getType() != ServiceEvent.MODIFIED)
+        if ((bundle != null)
+            && (bundle.getState() == Bundle.ACTIVE && event.getType() !=
ServiceEvent.MODIFIED))
         {
             synchronized (this)
             {
@@ -81,7 +82,6 @@ public class LocalRepositoryImpl impleme
 
     private void addBundle(Bundle bundle, Logger logger)
     {
-        
         /*
          * Concurrency note: This method MUST be called in a context which
          * is synchronized on this instance to prevent data structure
@@ -104,19 +104,18 @@ public class LocalRepositoryImpl impleme
             m_logger.log(Logger.LOG_WARNING, ex.getMessage(), ex);
         }
     }
-    
+
     private void removeBundle(Bundle bundle, Logger logger)
     {
-        
         /*
          * Concurrency note: This method MUST be called in a context which
          * is synchronized on this instance to prevent data structure
          * corruption.
          */
-        
+
         m_localResourceList.remove(new Long(bundle.getBundleId()));
     }
-    
+
     public void dispose()
     {
         m_context.removeBundleListener(this);
@@ -150,9 +149,9 @@ public class LocalRepositoryImpl impleme
         m_context.addServiceListener(this);
 
         // Generate the resource list from the set of installed bundles.
-        // Lock so we can ensure that no bundle events arrive before we 
+        // Lock so we can ensure that no bundle events arrive before we
         // are done getting our state snapshot.
-        Bundle[] bundles = null;
+        Bundle[] bundles;
         synchronized (this)
         {
             // Create a local resource object for each bundle, which will
@@ -166,5 +165,4 @@ public class LocalRepositoryImpl impleme
             m_snapshotTimeStamp = System.currentTimeMillis();
         }
     }
-
-}
+}
\ No newline at end of file



Mime
View raw message