KickJava   Java API By Example, From Geeks To Geeks.

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


1 package javax.xml.stream;
2
3 /**
4  * An error class for reporting factory configuration errors.
5  *
6  * @version 1.0
7  * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
8  * @since 1.6
9  */

10 public class FactoryConfigurationError extends Error JavaDoc {
11
12   Exception JavaDoc nested;
13
14   /**
15    * Default constructor
16    */

17   public FactoryConfigurationError(){}
18
19   /**
20    * Construct an exception with a nested inner exception
21    *
22    * @param e the exception to nest
23    */

24   public FactoryConfigurationError(java.lang.Exception JavaDoc e){
25     nested = e;
26   }
27
28   /**
29    * Construct an exception with a nested inner exception
30    * and a message
31    *
32    * @param e the exception to nest
33    * @param msg the message to report
34    */

35   public FactoryConfigurationError(java.lang.Exception JavaDoc e, java.lang.String JavaDoc msg){
36     super(msg);
37     nested = e;
38   }
39
40   /**
41    * Construct an exception with a nested inner exception
42    * and a message
43    *
44    * @param msg the message to report
45    * @param e the exception to nest
46    */

47   public FactoryConfigurationError(java.lang.String JavaDoc msg, java.lang.Exception JavaDoc e){
48     super(msg);
49     nested = e;
50   }
51
52   /**
53    * Construct an exception with associated message
54    *
55    * @param msg the message to report
56    */

57   public FactoryConfigurationError(java.lang.String JavaDoc msg) {
58     super(msg);
59   }
60
61   /**
62    * Return the nested exception (if any)
63    *
64    * @return the nested exception or null
65    */

66   public Exception JavaDoc getException() {
67     return nested;
68   }
69   
70
71   /**
72    * Report the message associated with this error
73    *
74    * @return the string value of the message
75    */

76   public String JavaDoc getMessage() {
77     String JavaDoc msg = super.getMessage();
78     if(msg != null)
79       return msg;
80     if(nested != null){
81       msg = nested.getMessage();
82       if(msg == null)
83         msg = nested.getClass().toString();
84     }
85     return msg;
86   }
87   
88
89   
90 }
91
92
Popular Tags