Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/parsers/FactoryConfigurationError.java
48527 views
/*1* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.parsers;2627/**28* Thrown when a problem with configuration with the Parser Factories29* exists. This error will typically be thrown when the class of a30* parser factory specified in the system properties cannot be found31* or instantiated.32*33* @author <a href="mailto:[email protected]">Jeff Suttor</a>34* @version $Revision: 1.7 $, $Date: 2010-11-01 04:36:09 $35*/3637public class FactoryConfigurationError extends Error {38private static final long serialVersionUID = -827108682472263355L;3940/**41*<code>Exception</code> that represents the error.42*/43private Exception exception;4445/**46* Create a new <code>FactoryConfigurationError</code> with no47* detail mesage.48*/4950public FactoryConfigurationError() {51super();52this.exception = null;53}5455/**56* Create a new <code>FactoryConfigurationError</code> with57* the <code>String </code> specified as an error message.58*59* @param msg The error message for the exception.60*/6162public FactoryConfigurationError(String msg) {63super(msg);64this.exception = null;65}666768/**69* Create a new <code>FactoryConfigurationError</code> with a70* given <code>Exception</code> base cause of the error.71*72* @param e The exception to be encapsulated in a73* FactoryConfigurationError.74*/7576public FactoryConfigurationError(Exception e) {77super(e.toString());78this.exception = e;79}8081/**82* Create a new <code>FactoryConfigurationError</code> with the83* given <code>Exception</code> base cause and detail message.84*85* @param e The exception to be encapsulated in a86* FactoryConfigurationError87* @param msg The detail message.88*/8990public FactoryConfigurationError(Exception e, String msg) {91super(msg);92this.exception = e;93}949596/**97* Return the message (if any) for this error . If there is no98* message for the exception and there is an encapsulated99* exception then the message of that exception, if it exists will be100* returned. Else the name of the encapsulated exception will be101* returned.102*103* @return The error message.104*/105106public String getMessage () {107String message = super.getMessage ();108109if (message == null && exception != null) {110return exception.getMessage();111}112113return message;114}115116/**117* Return the actual exception (if any) that caused this exception to118* be raised.119*120* @return The encapsulated exception, or null if there is none.121*/122123public Exception getException () {124return exception;125}126127/**128* use the exception chaining mechanism of JDK1.4129*/130@Override131public Throwable getCause() {132return exception;133}134}135136137