Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4679

OsgiClassLoader needs null check when iterating bundles

    Details

      Description

      org.infinispan.commons.util.OsgiClassLoader requires a null check when the bundle is retrieved from a WeakReference.

      for (WeakReference<Bundle> ref : bundles) {
         final Bundle bundle = ref.get();
         // BUG: we may not get a bundle back from the weak reference, eg. if uninstalled or deactivated
         if (bundle.getState() == Bundle.ACTIVE) {
            try {
               final Class clazz = bundle.loadClass(name);
               if (clazz != null) {
                  classCache.put(name, clazz);
                  return clazz;
               }
            } catch (Exception ignore) {
            }
         }
      }
      

      I am running 7.0.0.Beta1 on servicemix 5.1.1 and can't load this simple infinispan.xml:

      <infinispan xmlns="urn:infinispan:config:7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="urn:infinispan:config:7.0 http://infinispan.org/schemas/infinispan-config-7.0.xsd">
      	<cache-container default-cache="default" name="TestContainer">
      		<jmx domain="TestDomain" mbean-server-lookup="org.infinispan.jmx.PerThreadMBeanServerLookup" duplicate-domains="true"/>
      		<!-- definitions of the caches -->
      		<local-cache name="default" statistics="false">
      			<locking concurrency-level="100" acquire-timeout="1000"/>
      			<transaction mode="NONE" complete-timeout="3123" reaper-interval="123"/>
      		</local-cache>
      	</cache-container>
      </infinispan>
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dan.berindei Dan Berindei
                Reporter:
                nbertram Niels Bertram
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: