InvalidValueException.java
01 /*
02  *  InvalidValueException.java
03  *
04  *  Niraj Aswani, 09/March/07
05  *
06  *  $Id: InvalidValueException.html,v 1.0 2007/03/09 16:13:01 niraj Exp $
07  */
08 package gate.creole.ontology;
09 
10 import gate.util.GateException;
11 
12 /**
13  * This exception should be thrown when a property value is not
14  * compatible with the property. e.g. boolean value for the integer
15  * datatype, invalid instance for an object property.
16  
17  @author Niraj Aswani
18  
19  */
20 public class InvalidValueException extends GateException {
21   private static final long serialVersionUID = 3833465093706036789L;
22 
23   /** Debug flag */
24   private static final boolean DEBUG = false;
25 
26   /**
27    * Constructor
28    */
29   public InvalidValueException() {
30     super();
31   }
32 
33   /**
34    * Constructor
35    
36    @param s Message that should be printed along with the Exception
37    *          trace
38    */
39   public InvalidValueException(String s) {
40     super(s);
41   }
42 
43   /**
44    * Constructor - behaves like a wrapper to the provided exception
45    
46    @param e
47    */
48   public InvalidValueException(Exception e) {
49     this.exception = e;
50   }
51 
52   /**
53    * Overriden so we can print the enclosed exception's stacktrace too.
54    */
55   public void printStackTrace() {
56     printStackTrace(System.err);
57   }
58 
59   /**
60    * Overriden so we can print the enclosed exception's stacktrace too.
61    */
62   public void printStackTrace(java.io.PrintStream s) {
63     s.flush();
64     super.printStackTrace(s);
65     s.print("  Caused by:\n");
66     if(exception != nullexception.printStackTrace(s);
67   }
68 
69   /**
70    * Overriden so we can print the enclosed exception's stacktrace too.
71    */
72   public void printStackTrace(java.io.PrintWriter s) {
73     s.flush();
74     super.printStackTrace(s);
75     s.print("  Caused by:\n");
76     if(exception != nullexception.printStackTrace(s);
77   }
78 
79   /**
80    * Internal object of exception, for which the instance behaves like a
81    * wrapper
82    */
83   Exception exception;
84 }