geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: rev 47138 - geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local
Date Fri, 24 Sep 2004 07:05:28 GMT
Author: djencks
Date: Fri Sep 24 00:05:26 2004
New Revision: 47138

Modified:
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
Log:
uniformize exception reporting, unwrap mbean exceptions

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
Fri Sep 24 00:05:26 2004
@@ -21,6 +21,8 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.io.StringWriter;
+import java.io.PrintWriter;
 import javax.enterprise.deploy.shared.ActionType;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.shared.StateType;
@@ -31,6 +33,7 @@
 import javax.enterprise.deploy.spi.status.ProgressEvent;
 import javax.enterprise.deploy.spi.status.ProgressListener;
 import javax.enterprise.deploy.spi.status.ProgressObject;
+import javax.management.MBeanException;
 
 /**
  *
@@ -99,6 +102,17 @@
     protected final void complete(String message) {
         sendEvent(message, StateType.COMPLETED);
     }
+
+    protected void doFail(Exception e) {
+        if (e instanceof MBeanException) {
+            e = ((MBeanException)e).getTargetException();
+        }
+        StringWriter writer = new StringWriter();
+         PrintWriter printWriter = new PrintWriter(writer);
+         printWriter.println(e.getMessage());
+         e.printStackTrace(printWriter);
+         fail(writer.toString());
+     }
 
     private void sendEvent(String message, StateType state) {
         assert !Thread.holdsLock(this) : "Trying to send event whilst holding lock";

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
Fri Sep 24 00:05:26 2004
@@ -18,23 +18,21 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.io.File;
-import java.io.InputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.FileOutputStream;
-import java.io.StringWriter;
-import java.io.PrintWriter;
+import java.net.URI;
 import java.util.Iterator;
 import java.util.Set;
-import java.net.URI;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.Target;
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.management.ObjectName;
 
-import org.apache.geronimo.kernel.KernelMBean;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
 import org.apache.geronimo.deployment.util.FileUtil;
+import org.apache.geronimo.kernel.KernelMBean;
 
 /**
  * @version $Rev$ $Date$
@@ -98,10 +96,7 @@
             addModule(moduleID);
             complete("Completed");
         } catch (Exception e) {
-            StringWriter writer = new StringWriter();
-            PrintWriter printWriter = new PrintWriter(writer);
-            e.printStackTrace(printWriter);
-            fail(writer.toString());
+            doFail(e);
         } finally {
             if (spool) {
                 if (moduleArchive != null) {

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
Fri Sep 24 00:05:26 2004
@@ -16,18 +16,18 @@
  */
 package org.apache.geronimo.deployment.plugin.local;
 
-import java.net.URI;
 import java.io.File;
-import java.util.Set;
+import java.net.URI;
 import java.util.Iterator;
-import javax.enterprise.deploy.spi.TargetModuleID;
+import java.util.Set;
 import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.management.ObjectName;
 
-import org.apache.geronimo.kernel.KernelMBean;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.kernel.KernelMBean;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 
 /**
  * @version $Rev$ $Date$
@@ -78,7 +78,7 @@
             }
             complete("Completed");
         } catch (Exception e) {
-            fail(e.getMessage());
+            doFail(e);
         }
     }
 }

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
Fri Sep 24 00:05:26 2004
@@ -18,8 +18,6 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.net.URI;
-import java.io.StringWriter;
-import java.io.PrintWriter;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
@@ -51,10 +49,7 @@
             }
             complete("Completed");
         } catch (Exception e) {
-            StringWriter writer = new StringWriter();
-            PrintWriter printWriter = new PrintWriter(writer);
-            e.printStackTrace(printWriter);
-            fail(writer.toString());
+            doFail(e);
         }
     }
 }

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
Fri Sep 24 00:05:26 2004
@@ -18,16 +18,12 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.net.URI;
-import java.io.StringWriter;
-import java.io.PrintWriter;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
 import org.apache.geronimo.kernel.KernelMBean;
 
 /**
- *
- *
  * @version $Rev$ $Date$
  */
 public class StopCommand extends CommandSupport {
@@ -51,10 +47,7 @@
             }
             complete("Completed");
         } catch (Exception e) {
-            StringWriter writer = new StringWriter();
-            PrintWriter printWriter = new PrintWriter(writer);
-            e.printStackTrace(printWriter);
-            fail(writer.toString());
+            doFail(e);
         }
     }
 }

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
Fri Sep 24 00:05:26 2004
@@ -17,16 +17,14 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.net.URI;
-import java.io.StringWriter;
-import java.io.PrintWriter;
-import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.management.ObjectName;
 
-import org.apache.geronimo.kernel.KernelMBean;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.kernel.KernelMBean;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
 
 /**
  * @version $Rev$ $Date$
@@ -63,10 +61,7 @@
             }
             complete("Completed");
         } catch (Exception e) {
-            StringWriter writer = new StringWriter();
-            PrintWriter printWriter = new PrintWriter(writer);
-            e.printStackTrace(printWriter);
-            fail(writer.toString());
+            doFail(e);
         }
     }
 }

Mime
View raw message