Skip to content

Commit 4e77383

Browse files
author
John J. Aylward
committed
Properly overrides the Exception class.
1 parent b0191a6 commit 4e77383

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

JSONException.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,25 @@
88
*/
99
public class JSONException extends RuntimeException {
1010
private static final long serialVersionUID = 0;
11-
private Throwable cause;
1211

1312
/**
1413
* Constructs a JSONException with an explanatory message.
1514
*
1615
* @param message
1716
* Detail about the reason for the exception.
1817
*/
19-
public JSONException(String message) {
20-
super(message);
18+
public JSONException(final String message) {
19+
super(message);
2120
}
2221

2322
/**
2423
* Constructs a new JSONException with the specified cause.
25-
* @param cause The cause.
24+
*
25+
* @param cause
26+
* The cause.
2627
*/
27-
public JSONException(Throwable cause) {
28-
super(cause.getMessage());
29-
this.cause = cause;
28+
public JSONException(final Throwable cause) {
29+
super(cause.getMessage(), cause);
3030
}
3131

32-
/**
33-
* Returns the cause of this exception or null if the cause is nonexistent
34-
* or unknown.
35-
*
36-
* @return the cause of this exception or null if the cause is nonexistent
37-
* or unknown.
38-
*/
39-
@Override
40-
public Throwable getCause() {
41-
return this.cause;
42-
}
4332
}

0 commit comments

Comments
 (0)