Source code: org/apache/commons/net/ftp/parser/ParserInitializationException.java
1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.net.ftp.parser;
17
18 /**
19 * This class encapsulates all errors that may be thrown by
20 * the process of an FTPFileEntryParserFactory creating and
21 * instantiating an FTPFileEntryParser.
22 */
23 public class ParserInitializationException extends RuntimeException {
24
25 /**
26 * Root exception that caused this to be thrown
27 */
28 private final Throwable rootCause;
29
30 /**
31 * Constucts a ParserInitializationException with just a message
32 *
33 * @param message Exception message
34 */
35 public ParserInitializationException(String message) {
36 super(message);
37 this.rootCause = null;
38 }
39
40 /**
41 * Constucts a ParserInitializationException with a message
42 * and a root cause.
43 *
44 * @param message Exception message
45 * @param rootCause root cause throwable that caused
46 * this to be thrown
47 */
48 public ParserInitializationException(String message, Throwable rootCause) {
49 super(message);
50 this.rootCause = rootCause;
51 }
52
53 /**
54 * returns the root cause of this exception or null
55 * if no root cause was specified.
56 *
57 * @return the root cause of this exception being thrown
58 */
59 public Throwable getRootCause() {
60 return this.rootCause;
61 }
62
63 }