01: package org.drools.objenesis;
02:
03: /**
04: * Exception thrown by Objenesis. It wraps any instantiation exceptions. Note that this exception is
05: * runtime to prevent having to catch it. It will do normal exception wrapping for JDK 1.4 and more
06: * and basic message wrapping for JDK 1.3.
07: *
08: * @author Henri Tremblay
09: */
10: public class ObjenesisException extends RuntimeException {
11:
12: private static final boolean jdk14 = (Double.parseDouble(System
13: .getProperty("java.specification.version")) > 1.3);
14:
15: /**
16: * @param msg Error message
17: */
18: public ObjenesisException(final String msg) {
19: super (msg);
20: }
21:
22: /**
23: * @param cause Wrapped exception. The message will be the one of the cause.
24: */
25: public ObjenesisException(final Throwable cause) {
26: super (cause == null ? null : cause.toString());
27: if (jdk14) {
28: initCause(cause);
29: }
30: }
31:
32: /**
33: * @param msg Error message
34: * @param cause Wrapped exception
35: */
36: public ObjenesisException(final String msg, final Throwable cause) {
37: super(msg);
38: if (jdk14) {
39: initCause(cause);
40: }
41: }
42: }
|