01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.exception;
05:
06: /**
07: * Exception helper for RuntimeException
08: */
09: public class RuntimeExceptionHelper implements ExceptionHelper {
10:
11: /**
12: * Accepts RuntimeException
13: * @param t Throwable
14: * @return True if instanceof RuntimeException
15: */
16: public boolean accepts(Throwable t) {
17: return t instanceof RuntimeException;
18: }
19:
20: /**
21: * Return chained exception
22: * @param t RuntimeException
23: * @return Cause of t
24: */
25: public Throwable getProximateCause(Throwable t) {
26: return (t instanceof RuntimeException && ((RuntimeException) t)
27: .getCause() != null) ? ((RuntimeException) t)
28: .getCause() : t;
29: }
30:
31: /**
32: * Always throws AssertiontError
33: * @param t Param ignored
34: * @return Always AssertionError
35: */
36: public Throwable getUltimateCause(Throwable t) {
37: throw new AssertionError();
38: }
39:
40: }
|