19
19
*/
20
20
public class CSSException extends RuntimeException {
21
21
22
- /** Enum for error codes. */
22
+ /**
23
+ * Enum for error codes.
24
+ *
25
+ * @deprecated as of version 4.4.0
26
+ */
27
+ @ Deprecated
23
28
protected enum ErrorCode {
24
29
/** Unspecified. */
25
30
UNSPECIFIED_ERR ,
@@ -34,14 +39,20 @@ protected enum ErrorCode {
34
39
35
40
/**
36
41
* Creates a new CSSException.
42
+ *
43
+ * @deprecated as of version 4.4.0; use {@link CSSException#CSSException(String, Exception)} instead
37
44
*/
45
+ @ Deprecated
38
46
public CSSException () {
39
47
}
40
48
41
49
/**
42
50
* Creates a new CSSException.
43
51
* @param message the message
52
+ *
53
+ * @deprecated as of version 4.4.0; use {@link CSSException#CSSException(String, Exception)} instead
44
54
*/
55
+ @ Deprecated
45
56
public CSSException (final String message ) {
46
57
code_ = ErrorCode .UNSPECIFIED_ERR ;
47
58
message_ = message ;
@@ -50,7 +61,10 @@ public CSSException(final String message) {
50
61
/**
51
62
* Creates a new CSSException with an embeded exception.
52
63
* @param e the embeded exception.
64
+ *
65
+ * @deprecated as of version 4.4.0; use {@link CSSException#CSSException(String, Exception)} instead
53
66
*/
67
+ @ Deprecated
54
68
public CSSException (final Exception e ) {
55
69
code_ = ErrorCode .UNSPECIFIED_ERR ;
56
70
initCause (e );
@@ -59,7 +73,10 @@ public CSSException(final Exception e) {
59
73
/**
60
74
* Creates a new CSSException with a specific code.
61
75
* @param code a the embeded exception.
76
+ *
77
+ * @deprecated as of version 4.4.0; use {@link CSSException#CSSException(String, Exception)} instead
62
78
*/
79
+ @ Deprecated
63
80
public CSSException (final ErrorCode code ) {
64
81
code_ = code ;
65
82
}
@@ -70,13 +87,27 @@ public CSSException(final ErrorCode code) {
70
87
* @param code the specified code
71
88
* @param message the message
72
89
* @param e the embeded exception
90
+ *
91
+ * @deprecated as of version 4.4.0; use {@link CSSException#CSSException(String, Exception)} instead
73
92
*/
93
+ @ Deprecated
74
94
public CSSException (final ErrorCode code , final String message , final Exception e ) {
75
95
code_ = code ;
76
96
message_ = message ;
77
97
initCause (e );
78
98
}
79
99
100
+ /**
101
+ * Creates a new CSSException with an embeded exception and a specified
102
+ * message.
103
+ * @param message the message
104
+ * @param e the cause
105
+ */
106
+ public CSSException (final String message , final Exception e ) {
107
+ message_ = message ;
108
+ initCause (e );
109
+ }
110
+
80
111
/**
81
112
* {@inheritDoc}
82
113
*
@@ -95,24 +126,6 @@ public String getMessage() {
95
126
return getCause ().getMessage ();
96
127
}
97
128
98
- switch (code_ ) {
99
- case UNSPECIFIED_ERR :
100
- return "unknown error" ;
101
- case NOT_SUPPORTED_ERR :
102
- return "not supported" ;
103
- case SYNTAX_ERR :
104
- return "syntax error" ;
105
- default :
106
- return null ;
107
- }
108
- }
109
-
110
- /**
111
- * <p>getCode.</p>
112
- *
113
- * @return the error code for this exception.
114
- */
115
- public ErrorCode getCode () {
116
- return code_ ;
129
+ return "syntax error" ;
117
130
}
118
131
}
0 commit comments