Bug 341078 - Remove workaround for AspectJ bug
diff --git a/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/ExceptionCleaner.aj b/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/ExceptionCleaner.aj
index 4689d7a..f83fa01 100644
--- a/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/ExceptionCleaner.aj
+++ b/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/ExceptionCleaner.aj
@@ -15,19 +15,23 @@
import javax.management.MXBean;
/**
- * An aspect that catches all {@link Exception}s thrown through @{@link MXBean} annotated interfaces and filters
- * them to make sure they can be safely thrown to a JMX client. Safe means that there will be no types thrown that
- * cannot be loaded by the JMX client.
+ * An aspect that catches all {@link Exception}s thrown through @{@link MXBean} annotated interfaces and filters them to
+ * make sure they can be safely thrown to a JMX client. Safe means that there will be no types thrown that cannot be
+ * loaded by the JMX client.
* <p/>
- * This is accomplished by throwing a <em>cleaned</em> exception instead, after logging the original exception at error level with the logger for the throwing class.
- * <p/>
- * A <em>cleaned</em> exception, <code>cleaned(t)</code>, is a new {@link RuntimeException} with message that of <code>t</code> (prefixed with the
- * class name of <code>t</code>), with cause <code>cleaned(t.getCause())</code>, and with stack trace set to <code>t.getStackTrace()</code>.
- * <br/><em>Notice that this definition is recursive; <code>cleaned(<b>null</b>)</code> is defined to be <code><b>null</b></code>.</em>
+ * This is accomplished by throwing a <em>cleaned</em> exception instead, after logging the original exception at error
+ * level with the logger for the throwing class.
* <p/>
- * The {@link StackTraceElement StackTrace} from the original exception is attached to the new {@link RuntimeException} for information purposes.
+ * A <em>cleaned</em> exception, <code>cleaned(t)</code>, is a new {@link RuntimeException} with message that of
+ * <code>t</code> (prefixed with the class name of <code>t</code>), with cause <code>cleaned(t.getCause())</code>, and
+ * with stack trace set to <code>t.getStackTrace()</code>. <br/>
+ * <em>Notice that this definition is recursive; <code>cleaned(<b>null</b>)</code> is defined to be
+ * <code><b>null</b></code>.</em>
* <p/>
- * (Moved from <code>com.springsource.kernel.model.management.internal</code> package and enhanced to catch
+ * The {@link StackTraceElement StackTrace} from the original exception is attached to the new {@link RuntimeException}
+ * for information purposes.
+ * <p/>
+ * (Moved from <code>com.springsource.kernel.model.management.internal</code> package and enhanced to catch
* all @{@link MXBean} annotated interfaces.)
* <p/>
*
@@ -42,27 +46,24 @@
pointcut exposedViaJmx(Object o) : this(o) && execution(* (@MXBean *).*(..));
/**
- * Catch {@link Exception}s and clean them and the nested causes (if any).
- * {@link Throwable}s are trapped, so we can advise methods that do not declare a throws, but {@link Exception}s are filtered out.
+ * Catch {@link Exception}s and clean them and the nested causes (if any). {@link Throwable}s are trapped, so we can
+ * advise methods that do not declare a throws, but {@link Exception}s are filtered out.
*/
- after(Object o) throwing(Throwable t) : exposedViaJmx(o) {
- if (t instanceof Exception) {
- Exception e = (Exception) t;
- LoggerFactory.getLogger(o.getClass()).error("Exception filtered from JMX invocation", e);
- throw cleanException(e);
- }
+ after(Object o) throwing(Exception e) : exposedViaJmx(o) {
+ LoggerFactory.getLogger(o.getClass()).error("Exception filtered from JMX invocation", e);
+ throw cleanException(e);
}
-
+
private RuntimeException cleanException(Throwable throwable) {
Throwable cause = throwable.getCause();
RuntimeException cleanCause = null;
if (cause != null) {
cleanCause = cleanException(cause);
}
-
+
RuntimeException rte = new RuntimeException(throwable.getClass().getName() + ": " + throwable.getMessage(), cleanCause);
rte.setStackTrace(throwable.getStackTrace());
-
+
return rte;
}
}