001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.jxpath;
019
020/**
021 * Thrown when a problem with configuration with the {@link JXPathContextFactory JXPathContextFactories} exists. This error will typically be thrown when the
022 * class of a factory specified in the system properties cannot be found or instantiated.
023 */
024public class JXPathContextFactoryConfigurationError extends Error {
025
026    private static final long serialVersionUID = 2L;
027
028    /**
029     * Constructs a new {@code JXPathContextFactoryConfigurationError} with no detail mesage.
030     */
031    public JXPathContextFactoryConfigurationError() {
032    }
033
034    /**
035     * Constructs a new {@code JXPathContextFactoryConfigurationError} with a given {@code Exception} base cause of the error.
036     *
037     * @param cause The exception to be encapsulated in a JXPathContextFactoryConfigurationError.
038     */
039    public JXPathContextFactoryConfigurationError(final Exception cause) {
040        super(cause);
041    }
042
043    /**
044     * Constructs a new {@code JXPathContextFactoryConfigurationError} with the given {@code Exception} base cause and detail message.
045     *
046     * @param cause   The exception to be encapsulated in a JXPathContextFactoryConfigurationError
047     * @param msg The detail message.
048     */
049    public JXPathContextFactoryConfigurationError(final Exception cause, final String msg) {
050        super(msg, cause);
051    }
052
053    /**
054     * Constructs a new {@code JXPathContextFactoryConfigurationError} with the {@code String } specified as an error message.
055     *
056     * @param msg The error message for the exception.
057     */
058    public JXPathContextFactoryConfigurationError(final String msg) {
059        super(msg);
060    }
061
062    /**
063     * Gets the actual exception (if any) that caused this exception to be raised.
064     *
065     * @return The encapsulated exception, or null if there is none.
066     */
067    public Exception getException() {
068        return (Exception) super.getCause();
069    }
070
071}