01: /*
02: * SdpFactoryException.java
03: *
04: * Created on January 9, 2002, 6:44 PM
05: */
06:
07: package javax.sdp;
08:
09: /** The SdpFactoryException encapsulates the information thrown when a problem
10: * with configuration with the
11: * SdpFactory exists.
12: *
13: * Please refer to IETF RFC 2327 for a description of SDP.
14: *
15: * @author deruelle
16: * @version 1.0
17: */
18: public class SdpFactoryException extends SdpException {
19:
20: /** Chained exception.
21: */
22: protected Exception ex;
23:
24: /** Creates new SdpFactoryException */
25: public SdpFactoryException() {
26: super ();
27: }
28:
29: /** Create a new FactoryConfigurationException with the String specified as
30: * an error message.
31: * @param msg msg - the detail message
32: */
33: public SdpFactoryException(String msg) {
34: super (msg);
35: }
36:
37: /** Create a new FactoryConfigurationException with a given Exception base
38: * cause of the error.
39: * @param ex ex - the "chained" exception
40: */
41: public SdpFactoryException(Exception ex) {
42: super (ex.getMessage());
43: this .ex = ex;
44: }
45:
46: /** Create a new FactoryConfigurationException with the given Exception base
47: * cause and detail message.
48: * @param msg msg - the detail message
49: * @param ex ex - the "chained" exception
50: */
51: public SdpFactoryException(String msg, Exception ex) {
52: super (msg);
53: this .ex = ex;
54: }
55:
56: /** Return the message (if any) for this error. If there is no message for
57: * the exception and there is an encapsulated
58: * exception then the message of that exception will be returned.
59: * @return the error message
60: */
61: public String getMessage() {
62: if (super .getMessage() != null)
63: return super .getMessage();
64: else if (ex != null)
65: return ex.getMessage();
66: else
67: return null;
68: }
69:
70: /** Return the actual exception (if any) that caused this exception to be thrown.
71: * @return the encapsulated exception, or null if there is none
72: */
73: public Exception getException() {
74: return ex;
75: }
76: }
|