aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1187719 - /aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java
Date Sat, 22 Oct 2011 14:22:00 GMT
Author: not
Date: Sat Oct 22 14:21:59 2011
New Revision: 1187719

URL: http://svn.apache.org/viewvc?rev=1187719&view=rev
Log:
ARIES-764 Remove an infinate loop if a bundle is not ACTIVE.


Modified:
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java?rev=1187719&r1=1187718&r2=1187719&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java (original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java Sat Oct 22 14:21:59
2011
@@ -31,7 +31,9 @@ import javax.naming.NamingException;
 import org.apache.aries.jndi.spi.EnvironmentAugmentation;
 import org.apache.aries.jndi.startup.Activator;
 import org.apache.aries.util.nls.MessageUtil;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.BundleReference;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
@@ -108,7 +110,16 @@ public final class Utils {
         BundleContext result = null;
         while (result == null && cl != null) {
             if (cl instanceof BundleReference) {
-                result = ((BundleReference) cl).getBundle().getBundleContext();
+                Bundle b = ((BundleReference)cl).getBundle();
+                result = b.getBundleContext();
+                if (result == null) {
+                  try {
+                    b.start();
+                    result = b.getBundleContext();
+                  } catch (BundleException e) {
+                  }
+                  break;
+                }
             } else if (cl != null) {
                 cl = cl.getParent();
             }



Mime
View raw message