Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/stream/FactoryConfigurationError.java
48534 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.26*/2728package javax.xml.stream;2930/**31* An error class for reporting factory configuration errors.32*33* @version 1.034* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.35* @since 1.636*/37public class FactoryConfigurationError extends Error {38private static final long serialVersionUID = -2994412584589975744L;3940Exception nested;4142/**43* Default constructor44*/45public FactoryConfigurationError(){}4647/**48* Construct an exception with a nested inner exception49*50* @param e the exception to nest51*/52public FactoryConfigurationError(java.lang.Exception e){53nested = e;54}5556/**57* Construct an exception with a nested inner exception58* and a message59*60* @param e the exception to nest61* @param msg the message to report62*/63public FactoryConfigurationError(java.lang.Exception e, java.lang.String msg){64super(msg);65nested = e;66}6768/**69* Construct an exception with a nested inner exception70* and a message71*72* @param msg the message to report73* @param e the exception to nest74*/75public FactoryConfigurationError(java.lang.String msg, java.lang.Exception e){76super(msg);77nested = e;78}7980/**81* Construct an exception with associated message82*83* @param msg the message to report84*/85public FactoryConfigurationError(java.lang.String msg) {86super(msg);87}8889/**90* Return the nested exception (if any)91*92* @return the nested exception or null93*/94public Exception getException() {95return nested;96}97/**98* use the exception chaining mechanism of JDK1.499*/100@Override101public Throwable getCause() {102return nested;103}104105/**106* Report the message associated with this error107*108* @return the string value of the message109*/110public String getMessage() {111String msg = super.getMessage();112if(msg != null)113return msg;114if(nested != null){115msg = nested.getMessage();116if(msg == null)117msg = nested.getClass().toString();118}119return msg;120}121122123124}125126127