1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.archive.crawler.framework.exceptions;
23
24 import org.archive.crawler.framework.exceptions.InitializationException;
25
26 /*** ConfigurationExceptions should be thrown when a configuration file
27 * is missing data, or contains uninterpretable data, at runtime. Fatal
28 * errors (that should cause the program to exit) should be thrown as
29 * FatalConfigurationExceptions.
30 *
31 * You may optionally note the
32 *
33 * @author Parker Thompson
34 *
35 */
36 public class ConfigurationException extends InitializationException {
37
38 private static final long serialVersionUID = -9078913414698851380L;
39
40
41
42 protected String file = null;
43 protected String element = null;
44
45 /***
46 * default constructor
47 */
48 public ConfigurationException() {
49 super();
50 }
51
52 /*** Create a ConfigurationException
53 * @param message
54 */
55 public ConfigurationException(String message) {
56 super(message);
57 }
58
59 /***
60 * @param message
61 * @param cause
62 */
63 public ConfigurationException(String message, Throwable cause) {
64 super(message, cause);
65
66 }
67
68 /*** Create a ConfigurationException
69 * @param cause
70 */
71 public ConfigurationException(Throwable cause) {
72 super(cause);
73 }
74
75 /*** Create ConfigurationException
76 * @param message
77 * @param filename
78 * @param elementname
79 */
80 public ConfigurationException(String message, String filename, String elementname){
81 super(message);
82 file = filename;
83 element = elementname;
84 }
85
86 /*** Create ConfigurationException
87 * @param message
88 * @param cause
89 * @param filename
90 * @param elementname
91 */
92 public ConfigurationException(String message, Throwable cause, String filename, String elementname){
93 super(message, cause);
94 file = filename;
95 element = elementname;
96 }
97
98 /*** Create ConfigurationException
99 * @param cause
100 * @param filename
101 * @param elementname
102 */
103 public ConfigurationException(Throwable cause, String filename, String elementname){
104 super(cause);
105 file = filename;
106 element = elementname;
107 }
108
109 /*** Store the name of the configuration file that was being parsed
110 * when this exception occured.
111 * @param name
112 */
113 public void setFile(String name){
114 file = name;
115 }
116
117 /***
118 * @return name of configuration file being parsed when this exception occurred
119 */
120 public String getFile(){
121 return file;
122 }
123
124 /*** Set the name of the element that was being parsed
125 * when this exception occured.
126 * @param target
127 */
128 public void setElement(String target){
129 element = target;
130 }
131 /***
132 * @return name of the element being parsed when this exception occurred
133 */
134 public String getElement(){
135 return element;
136 }
137
138 }