incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1041365 - in /incubator/aries/trunk/jndi: jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
Date Thu, 02 Dec 2010 13:20:56 GMT
Author: gnodet
Date: Thu Dec  2 13:20:56 2010
New Revision: 1041365

URL: http://svn.apache.org/viewvc?rev=1041365&view=rev
Log:
[ARIES-505] Do not use System.err nor Throwable#printStackTraces() but rather use a jul Logger

Modified:
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
    incubator/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java

Modified: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java?rev=1041365&r1=1041364&r2=1041365&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
(original)
+++ incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
Thu Dec  2 13:20:56 2010
@@ -20,6 +20,8 @@ package org.apache.aries.jndi.startup;
 
 import java.lang.reflect.Field;
 import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
@@ -50,7 +52,9 @@ import org.osgi.util.tracker.ServiceTrac
  * driven so they can do their magic stuff properly.
  */
 public class Activator implements BundleActivator {
-    
+
+    private static final Logger LOGGER = Logger.getLogger(Activator.class.getName());
+
     private OSGiInitialContextFactoryBuilder icfBuilder;
     private OSGiObjectFactoryBuilder ofBuilder;
     private static ServiceTracker icfBuilders;
@@ -72,9 +76,9 @@ public class Activator implements Bundle
             NamingManager.setInitialContextFactoryBuilder(builder);
             icfBuilder = builder;
         } catch (NamingException e) {
-            e.printStackTrace();
+            LOGGER.log(Level.INFO, "Cannot set the InitialContextFactoryBuilder.", e);
         } catch (IllegalStateException e) {
-            System.err.println("Cannot set the InitialContextFactoryBuilder. Another builder
is already installed");
+            LOGGER.log(Level.INFO, "Cannot set the InitialContextFactoryBuilder. Another
builder is already installed", e);
         }
     
         try {
@@ -82,9 +86,9 @@ public class Activator implements Bundle
             NamingManager.setObjectFactoryBuilder(builder);
             ofBuilder = builder;
         } catch (NamingException e) {
-            e.printStackTrace();
+            LOGGER.log(Level.INFO, "Cannot set the ObjectFactoryBuilder.", e);
         } catch (IllegalStateException e) {
-            System.err.println("Cannot set the ObjectFactoryBuilder. Another builder is already
installed");
+            LOGGER.log(Level.INFO, "Cannot set the ObjectFactoryBuilder. Another builder
is already installed", e);
         }
         
         context.registerService(JNDIProviderAdmin.class.getName(), 
@@ -141,7 +145,7 @@ public class Activator implements Bundle
             }
         } catch (Throwable t) {
             // Ignore
-          t.printStackTrace();
+            LOGGER.log(Level.FINE, "Error setting field.", t);
         }
     }
 

Modified: incubator/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java?rev=1041365&r1=1041364&r2=1041365&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
(original)
+++ incubator/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
Thu Dec  2 13:20:56 2010
@@ -19,6 +19,7 @@
 package org.apache.aries.jndi.rmi;
 
 import java.util.Hashtable;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.naming.spi.ObjectFactory;
@@ -32,9 +33,11 @@ public class Activator implements Bundle
 
     private ServiceRegistration reg;
 
+    private static final Logger LOGGER = Logger.getLogger(Activator.class.getName());
+
     public void start(BundleContext context) {
 
-        Logger.getLogger("org.apache.aries.jndi.rmi").fine("Registering RMI url handler");
+        LOGGER.fine("Registering RMI url handler");
 
         try {
             Hashtable<Object, Object> props = new Hashtable<Object, Object>();
@@ -46,7 +49,7 @@ public class Activator implements Bundle
         }
         catch (Exception e)
         {
-            e.printStackTrace();
+            LOGGER.log(Level.INFO, "Could not create the jndi rmi url factory.", e);
         }
     }
 



Mime
View raw message