View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   package com.octo.captcha.module;
8   
9   /***
10   * <p><ul><li></li></ul></p>
11   *
12   * @author <a href="mailto:mag@jcaptcha.net">Marc-Antoine Garrigue</a>
13   * @version 1.0
14   */
15  public class CaptchaModuleException extends RuntimeException {
16  
17      private Throwable cause;
18  
19      /***
20       * Constructs a new runtime exception with <code>null</code> as its detail message.
21       */
22      public CaptchaModuleException() {
23          super();
24      }
25  
26      /***
27       * Constructs a new runtime exception with the specified detail message.
28       *
29       * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()}
30       *                method.
31       */
32      public CaptchaModuleException(String message) {
33          super(message);
34      }
35  
36      /***
37       * Constructs a new runtime exception with the specified cause and a detail message of <tt>(cause==null ? null :
38       * cause.toString())</tt> (which typically contains the class and detail message of <tt>cause</tt>).  This
39       * constructor is useful for runtime exceptions that are little more than wrappers for other throwables.
40       *
41       * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).  (A <tt>null</tt>
42       *              value is permitted, and indicates that the cause is nonexistent or unknown.)
43       *
44       * @since 1.4
45       */
46      public CaptchaModuleException(Throwable cause) {
47          super(cause.getMessage());
48          this.cause = cause;
49      }
50  
51      /***
52       * Constructs a new runtime exception with the specified detail message and cause.  <p>Note that the detail message
53       * associated with <code>cause</code> is <i>not</i> automatically incorporated in this runtime exception's detail
54       * message.
55       *
56       * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
57       * @param cause   the cause (which is saved for later retrieval by the {@link #getCause()} method).  (A
58       *                <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.)
59       *
60       * @since 1.4
61       */
62      public CaptchaModuleException(String message, Throwable cause) {
63          super(message);
64          this.cause = cause;
65      }
66  
67      /***
68       * @return the root thowable that construct this exception, null if none
69       */
70      public Throwable getCause() {
71          return cause;
72      }
73  }