incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r919132 - /incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
Date Thu, 04 Mar 2010 19:06:52 GMT
Author: not
Date: Thu Mar  4 19:06:52 2010
New Revision: 919132

URL: http://svn.apache.org/viewvc?rev=919132&view=rev
Log:
ARIES-128 Couple of minor changes:

1. Updated to use Constants.OBJECTCLASS rather than "objectClass" when looking for the objectClass
service property
2. Updated to use the osgi.jndi.service.name rather than the incorrect osgi.jndi.serviceName
3. Removed a ClassNotFoundException and updated the IllegalArgumentException to list the interfaces
that could not be loaded.

Modified:
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java

Modified: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java?rev=919132&r1=919131&r2=919132&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
(original)
+++ incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
Thu Mar  4 19:06:52 2010
@@ -27,12 +27,9 @@
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 import javax.naming.NamingException;
 
@@ -40,6 +37,7 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleReference;
+import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceException;
 import org.osgi.framework.ServiceReference;
@@ -190,12 +188,12 @@
     
     if (pair == null) {
       interface1 = null;
-      filter = "(osgi.jndi.serviceName=" + serviceName + ")";
+      filter = "(osgi.jndi.service.name=" + serviceName + ")";
       pair = findService(ctx, interface1, filter);
     }
     
     if (pair != null) {
-      String[] interfaces = (String[]) pair.ref.getProperty("objectClass");
+      String[] interfaces = (String[]) pair.ref.getProperty(Constants.OBJECTCLASS);
       
       List<Class<?>> clazz = new ArrayList<Class<?>>(interfaces.length);
       
@@ -205,13 +203,11 @@
         try {
           clazz.add(b.loadClass(interfaceName));
         } catch (ClassNotFoundException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
         }
       }
       
       if (clazz.isEmpty()) {
-        throw new IllegalArgumentException();
+        throw new IllegalArgumentException(Arrays.asList(interfaces).toString());
       }
       
       InvocationHandler ih = new JNDIServiceDamper(ctx, interface1, filter, pair, dynamicRebind);
@@ -222,7 +218,7 @@
     return result;
   }
 
-  private static ServicePair findService(BundleContext ctx, String interface1, String filter)
+  private static ServicePair findService(BundleContext ctx, String interface1, String filter)
throws NamingException
   {
     ServicePair p = null;
     
@@ -251,8 +247,7 @@
       }
       
     } catch (InvalidSyntaxException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+      throw (NamingException) new NamingException(e.getMessage()).initCause(e);
     }
     
     return p;



Mime
View raw message