[jboss-svn-commits] JBL Code SVN: r15487 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 1 17:43:20 EDT 2007
Author: tcunning
Date: 2007-10-01 17:43:20 -0400 (Mon, 01 Oct 2007)
New Revision: 15487
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java
Log:
bug:JBESB-1109
Return error message rather than throwing exception so that the Invoker
sees the error. The invoker can be remote and will not see console
exceptions.
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java 2007-10-01 21:13:36 UTC (rev 15486)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java 2007-10-01 21:43:20 UTC (rev 15487)
@@ -45,6 +45,7 @@
import javax.management.ObjectName;
import javax.management.ReflectionException;
+import org.apache.log4j.Logger;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
@@ -59,6 +60,8 @@
private ConfigTree m_config;
private String m_startTime;
+ private static final Logger logger = Logger.getLogger(LifecycleController.class);
+
public static final String LIFECYCLESTATE_ATTRIB = "LifeCycleState";
public static final String STARTTIME_ATTRIB = "StartDate";
public static final String XML_ATTRIB = "ListenerXMLAsHtml";
@@ -192,29 +195,29 @@
listObjectName = new ObjectName("jboss.esb:" + objectName.toString());
} catch (MalformedObjectNameException e1) {
- e1.printStackTrace();
+ logger.error("", e1);
} catch (NullPointerException e1) {
- e1.printStackTrace();
+ logger.error("", e1);
}
if (mbeanServer.isRegistered(listObjectName)) {
try {
mbeanServer.unregisterMBean(listObjectName);
} catch (InstanceNotFoundException e) {
- e.printStackTrace();
+ logger.error("", e);
} catch (MBeanRegistrationException e) {
- e.printStackTrace();
+ logger.error("", e);
}
}
try {
mbeanServer.registerMBean(this, listObjectName);
} catch (InstanceAlreadyExistsException e) {
- e.printStackTrace();
+ logger.error("", e);
} catch (MBeanRegistrationException e) {
- e.printStackTrace();
+ logger.error("", e);
} catch (NotCompliantMBeanException e) {
- e.printStackTrace();
+ logger.error("", e);
}
}
@@ -310,33 +313,37 @@
* we throw the exception, and if an unknown operation is called, we throw
* an exception.
*/
- public Object invoke(String method, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException {
+ public Object invoke(String method, Object[] arg1, String[] arg2) throws ReflectionException {
if (method.equalsIgnoreCase(START_ACTION)) {
try {
start();
} catch (ManagedLifecycleException e) {
- throw new MBeanException(e);
+ logger.error("", e);
+ return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
} else if (method.equalsIgnoreCase(INIT_ACTION)) {
try {
initialise();
} catch (ManagedLifecycleException e) {
- throw new MBeanException(e);
+ logger.error("", e);
+ return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
} else if (method.equalsIgnoreCase(STOP_ACTION)) {
try {
stop();
} catch (ManagedLifecycleException e) {
- throw new MBeanException(e);
+ logger.error("", e);
+ return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
} else if (method.equalsIgnoreCase(DESTROY_ACTION)) {
try {
destroy();
} catch (ManagedLifecycleException e) {
- throw new MBeanException(e);
+ logger.error("", e);
+ return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
} else {
More information about the jboss-svn-commits
mailing list