01: package javax.xml.stream;
02:
03: /**
04: * The base exception for unexpected processing errors. This Exception
05: * class is used to report well-formedness errors as well as unexpected
06: * processing conditions.
07: * @version 1.0
08: * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
09: */
10: public class XMLStreamException extends Exception {
11:
12: protected Throwable nested;
13: protected Location location;
14:
15: /**
16: * Default constructor
17: */
18: public XMLStreamException() {
19: super ();
20: }
21:
22: /**
23: * Construct an exception with the assocated message.
24: *
25: * @param msg the message to report
26: */
27: public XMLStreamException(String msg) {
28: super (msg);
29: }
30:
31: /**
32: * Construct an exception with the assocated exception
33: *
34: * @param th a nested exception
35: */
36: public XMLStreamException(Throwable th) {
37: nested = th;
38: }
39:
40: /**
41: * Construct an exception with the assocated message and exception
42: *
43: * @param th a nested exception
44: * @param msg the message to report
45: */
46: public XMLStreamException(String msg, Throwable th) {
47: super (msg);
48: nested = th;
49: }
50:
51: /**
52: * Construct an exception with the assocated message, exception and location.
53: *
54: * @param th a nested exception
55: * @param msg the message to report
56: * @param location the location of the error
57: */
58: public XMLStreamException(String msg, Location location,
59: Throwable th) {
60: super ("ParseError at [row,col]:[" + location.getLineNumber()
61: + "," + location.getColumnNumber() + "]\n"
62: + "Message: " + msg);
63: nested = th;
64: this .location = location;
65: }
66:
67: /**
68: * Construct an exception with the assocated message, exception and location.
69: *
70: * @param msg the message to report
71: * @param location the location of the error
72: */
73: public XMLStreamException(String msg, Location location) {
74: super ("ParseError at [row,col]:[" + location.getLineNumber()
75: + "," + location.getColumnNumber() + "]\n"
76: + "Message: " + msg);
77: this .location = location;
78: }
79:
80: /**
81: * Gets the nested exception.
82: *
83: * @return Nested exception
84: */
85: public Throwable getNestedException() {
86: return nested;
87: }
88:
89: /**
90: * Gets the location of the exception
91: *
92: * @return the location of the exception, may be null if none is available
93: */
94: public Location getLocation() {
95: return location;
96: }
97:
98: }
|