1 package org.ocltf.model.repository;
2
3 import java.lang.reflect.Method;
4
5 /***
6 * An exception thrown whenever an error is encountered while parsing meta data.
7 */
8 public final class RepositoryException extends RuntimeException {
9
10 /***
11 * Constructor for the MetaDataReadException object
12 */
13 public RepositoryException() {
14 super();
15 }
16
17 /***
18 * Constructor for the MetaDataReadException object
19 *
20 *@param message describes cause of the exception
21 */
22 public RepositoryException(String message) {
23 super(message);
24 }
25
26 /***
27 * Constructor for the MetaDataReadException object
28 *
29 *@param message describes cause of the exception
30 *@param cause original exception that caused this exception
31 */
32 public RepositoryException(String message, Throwable cause) {
33 super(message + ": " + cause.getMessage());
34 myInitCause(cause);
35 }
36
37 /***
38 * Description of the Method
39 *
40 *@param cause chained this exception to the original cause
41 */
42 private void myInitCause(Throwable cause) {
43 if (null != initCauseMethod) {
44 try {
45 initCauseMethod.invoke(this, new Object[] { cause });
46 } catch (Exception ex) {
47
48
49 }
50 }
51 }
52
53 private static Method initCauseMethod = null;
54
55 static {
56 try {
57 Class myClass = RepositoryException.class;
58 initCauseMethod =
59 myClass.getMethod("initCause", new Class[] { Throwable.class });
60 } catch (Exception ex) {
61
62
63 }
64 }
65 }