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

OsgiClassLoader needs null check when iterating bundles

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 7.0.0.Beta2, 7.0.0.Final
    • 7.0.0.Beta1
    • Core
    • None

    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>
      

      Attachments

        Activity

          People

            dberinde@redhat.com Dan Berindei (Inactive)
            bertramn Niels Bertram (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: