01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.module.core;
11:
12: /**
13: * This exception gets thrown when a node contains invalid data.
14: *
15: * @author Pierre van Rooden
16: * @version $Id: InvalidDataException.java,v 1.8 2005/10/05 10:00:54 michiel Exp $
17: */
18: public class InvalidDataException extends Exception {
19:
20: // Name of the field that caused the exception
21: private String invalidField = null;
22:
23: //javadoc is inherited
24: public InvalidDataException() {
25: super ();
26: }
27:
28: //javadoc is inherited
29: public InvalidDataException(String message) {
30: super (message);
31: }
32:
33: //javadoc is inherited
34: public InvalidDataException(Throwable cause) {
35: super (cause);
36: }
37:
38: //javadoc is inherited
39: public InvalidDataException(String message, Throwable cause) {
40: super (message, cause);
41: }
42:
43: /**
44: * Create the exception.
45: * @param message a description of the exception
46: * @param fieldName the name of the field that caused the exception
47: */
48: public InvalidDataException(String message, String fieldName) {
49: super (message);
50: invalidField = fieldName;
51: }
52:
53: /**
54: * Create the exception.
55: * The cause can be retrieved with getCause().
56: *
57: * @param cause Throwable the cause of the exception
58: * @param fieldName the name of the field that caused the exception
59: * @since MMBase-1.7
60: */
61: public InvalidDataException(Throwable cause, String fieldName) {
62: super (cause);
63: invalidField = fieldName;
64: }
65:
66: /**
67: * Retrieved the name of the field that caused the exception
68: * @return the field name as a String
69: */
70: public String getInvalidFieldName() {
71: return invalidField;
72: }
73: }
|