KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > module > core > InvalidDataException


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.module.core;
11
12
13 /**
14  * This exception gets thrown when a node contains invalid data.
15  *
16  * @author Pierre van Rooden
17  * @version $Id: InvalidDataException.java,v 1.8 2005/10/05 10:00:54 michiel Exp $
18  */

19 public class InvalidDataException extends Exception JavaDoc {
20
21     // Name of the field that caused the exception
22
private String JavaDoc invalidField = null;
23
24     //javadoc is inherited
25
public InvalidDataException () {
26         super();
27     }
28
29     //javadoc is inherited
30
public InvalidDataException(String JavaDoc message) {
31         super(message);
32     }
33
34     //javadoc is inherited
35
public InvalidDataException(Throwable JavaDoc cause) {
36         super(cause);
37     }
38
39     //javadoc is inherited
40
public InvalidDataException(String JavaDoc message, Throwable JavaDoc cause) {
41         super(message, cause);
42     }
43
44     /**
45      * Create the exception.
46      * @param message a description of the exception
47      * @param fieldName the name of the field that caused the exception
48      */

49     public InvalidDataException (String JavaDoc message, String JavaDoc fieldName) {
50         super(message);
51         invalidField = fieldName;
52     }
53
54     /**
55      * Create the exception.
56      * The cause can be retrieved with getCause().
57      *
58      * @param cause Throwable the cause of the exception
59      * @param fieldName the name of the field that caused the exception
60      * @since MMBase-1.7
61      */

62     public InvalidDataException (Throwable JavaDoc cause, String JavaDoc fieldName) {
63         super(cause);
64         invalidField = fieldName;
65     }
66
67     /**
68      * Retrieved the name of the field that caused the exception
69      * @return the field name as a String
70      */

71     public String JavaDoc getInvalidFieldName() {
72         return invalidField;
73     }
74 }
75
Popular Tags