Path: blob/jdk8u272-b10-aarch32-20201026/jaxp/src/javax/xml/stream/XMLStreamException.java
48792 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* The base exception for unexpected processing errors. This Exception32* class is used to report well-formedness errors as well as unexpected33* processing conditions.34* @version 1.035* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.36* @since 1.637*/3839public class XMLStreamException extends Exception {4041protected Throwable nested;42protected Location location;4344/**45* Default constructor46*/47public XMLStreamException(){48super();49}5051/**52* Construct an exception with the assocated message.53*54* @param msg the message to report55*/56public XMLStreamException(String msg) {57super(msg);58}5960/**61* Construct an exception with the assocated exception62*63* @param th a nested exception64*/65public XMLStreamException(Throwable th) {66super(th);67nested = th;68}6970/**71* Construct an exception with the assocated message and exception72*73* @param th a nested exception74* @param msg the message to report75*/76public XMLStreamException(String msg, Throwable th) {77super(msg, th);78nested = th;79}8081/**82* Construct an exception with the assocated message, exception and location.83*84* @param th a nested exception85* @param msg the message to report86* @param location the location of the error87*/88public XMLStreamException(String msg, Location location, Throwable th) {89super("ParseError at [row,col]:["+location.getLineNumber()+","+90location.getColumnNumber()+"]\n"+91"Message: "+msg);92nested = th;93this.location = location;94}9596/**97* Construct an exception with the assocated message, exception and location.98*99* @param msg the message to report100* @param location the location of the error101*/102public XMLStreamException(String msg,103Location location) {104super("ParseError at [row,col]:["+location.getLineNumber()+","+105location.getColumnNumber()+"]\n"+106"Message: "+msg);107this.location = location;108}109110111/**112* Gets the nested exception.113*114* @return Nested exception115*/116public Throwable getNestedException() {117return nested;118}119120/**121* Gets the location of the exception122*123* @return the location of the exception, may be null if none is available124*/125public Location getLocation() {126return location;127}128129}130131132