001    /*
002     * Copyright 2004 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.apache.commons.net.ftp.parser;
017    
018    /**
019     * This class encapsulates all errors that may be thrown by
020     * the process of an FTPFileEntryParserFactory creating and
021     * instantiating an FTPFileEntryParser.
022     */
023    public class ParserInitializationException extends RuntimeException {
024    
025        /**
026         * Root exception that caused this to be thrown
027         */
028        private final Throwable rootCause;
029    
030        /**
031         * Constucts a ParserInitializationException with just a message
032         *
033         * @param message Exception message
034         */
035        public ParserInitializationException(String message) {
036            super(message);
037            this.rootCause = null;
038        }
039    
040        /**
041         * Constucts a ParserInitializationException with a message
042         * and a root cause.
043         *
044         * @param message   Exception message
045         * @param rootCause root cause throwable that caused
046         * this to be thrown
047         */
048        public ParserInitializationException(String message, Throwable rootCause) {
049            super(message);
050            this.rootCause = rootCause;
051        }
052    
053        /**
054         * returns the root cause of this exception or null
055         * if no root cause was specified.
056         *
057         * @return the root cause of this exception being thrown
058         */
059        public Throwable getRootCause() {
060            return this.rootCause;
061        }
062    
063    }