KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > stream > XMLStreamException


1 package javax.xml.stream;
2
3 /**
4  * The base exception for unexpected processing errors. This Exception
5  * class is used to report well-formedness errors as well as unexpected
6  * processing conditions.
7  * @version 1.0
8  * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
9  * @since 1.6
10  */

11 public class XMLStreamException extends Exception JavaDoc {
12
13   protected Throwable JavaDoc nested;
14   protected Location location;
15   
16   /**
17    * Default constructor
18    */

19   public XMLStreamException(){
20     super();
21   }
22
23   /**
24    * Construct an exception with the assocated message.
25    *
26    * @param msg the message to report
27    */

28   public XMLStreamException(String JavaDoc msg) {
29     super(msg);
30   }
31
32   /**
33    * Construct an exception with the assocated exception
34    *
35    * @param th a nested exception
36    */

37   public XMLStreamException(Throwable JavaDoc th) {
38       super(th);
39     nested = th;
40   }
41
42   /**
43    * Construct an exception with the assocated message and exception
44    *
45    * @param th a nested exception
46    * @param msg the message to report
47    */

48   public XMLStreamException(String JavaDoc msg, Throwable JavaDoc th) {
49     super(msg, th);
50     nested = th;
51   }
52
53   /**
54    * Construct an exception with the assocated message, exception and location.
55    *
56    * @param th a nested exception
57    * @param msg the message to report
58    * @param location the location of the error
59    */

60   public XMLStreamException(String JavaDoc msg, Location location, Throwable JavaDoc th) {
61     super("ParseError at [row,col]:["+location.getLineNumber()+","+
62           location.getColumnNumber()+"]\n"+
63           "Message: "+msg);
64     nested = th;
65     this.location = location;
66   }
67
68   /**
69    * Construct an exception with the assocated message, exception and location.
70    *
71    * @param msg the message to report
72    * @param location the location of the error
73    */

74   public XMLStreamException(String JavaDoc msg,
75                             Location location) {
76     super("ParseError at [row,col]:["+location.getLineNumber()+","+
77           location.getColumnNumber()+"]\n"+
78           "Message: "+msg);
79     this.location = location;
80   }
81   
82
83   /**
84    * Gets the nested exception.
85    *
86    * @return Nested exception
87    */

88   public Throwable JavaDoc getNestedException() {
89     return nested;
90   }
91
92   /**
93    * Gets the location of the exception
94    *
95    * @return the location of the exception, may be null if none is available
96    */

97   public Location getLocation() {
98     return location;
99   }
100
101 }
102
103
104
105
106
107
108
Popular Tags