You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ca...@apache.org on 2008/08/06 00:28:25 UTC
svn commit: r682998 -
/logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java
Author: carnold
Date: Tue Aug 5 15:28:25 2008
New Revision: 682998
URL: http://svn.apache.org/viewvc?rev=682998&view=rev
Log:
Bug 45485: Agent now throws RuntimeException instead of Errors when jmxtools.jar is missing at runtime or other problems
Modified:
logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java
Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java?rev=682998&r1=682997&r2=682998&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/Agent.java Tue Aug 5 15:28:25 2008
@@ -45,6 +45,7 @@
/**
* Create new instance.
+ * @deprecated
*/
public Agent() {
}
@@ -61,12 +62,8 @@
try {
newInstance = Class.forName(
"com.sun.jdmk.comm.HtmlAdapterServer").newInstance();
- } catch (ClassNotFoundException ex) {
- throw new NoClassDefFoundError(ex.toString());
- } catch (IllegalAccessException ex) {
- throw new IllegalAccessError(ex.toString());
- } catch (InstantiationException ex) {
- throw new InstantiationError(ex.toString());
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
}
return newInstance;
}
@@ -81,18 +78,22 @@
try {
server.getClass().getMethod("start", new Class[0]).
invoke(server, new Object[0]);
- } catch(NoSuchMethodException ex) {
- throw new NoSuchMethodError(ex.toString());
- } catch(IllegalAccessException ex) {
- throw new IllegalAccessError(ex.toString());
} catch(InvocationTargetException ex) {
- throw (RuntimeException) ex.getTargetException();
+ Throwable cause = ex.getTargetException();
+ if (cause instanceof RuntimeException) {
+ throw (RuntimeException) cause;
+ } else {
+ throw new RuntimeException(cause);
+ }
+ } catch(Exception ex) {
+ throw new RuntimeException(ex);
}
}
/**
* Starts instance of HtmlAdapterServer.
+ * @deprecated
*/
public void start() {
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org