From 4e77383472c055b08c919356fed276e2d78cceb3 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 12 Oct 2015 12:11:30 -0400 Subject: [PATCH 1/5] Properly overrides the Exception class. --- JSONException.java | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/JSONException.java b/JSONException.java index 6fef519..41e85ae 100755 --- a/JSONException.java +++ b/JSONException.java @@ -8,7 +8,6 @@ package org.json; */ public class JSONException extends RuntimeException { private static final long serialVersionUID = 0; - private Throwable cause; /** * Constructs a JSONException with an explanatory message. @@ -16,28 +15,18 @@ public class JSONException extends RuntimeException { * @param message * Detail about the reason for the exception. */ - public JSONException(String message) { - super(message); + public JSONException(final String message) { + super(message); } /** * Constructs a new JSONException with the specified cause. - * @param cause The cause. + * + * @param cause + * The cause. */ - public JSONException(Throwable cause) { - super(cause.getMessage()); - this.cause = cause; + public JSONException(final Throwable cause) { + super(cause.getMessage(), cause); } - /** - * Returns the cause of this exception or null if the cause is nonexistent - * or unknown. - * - * @return the cause of this exception or null if the cause is nonexistent - * or unknown. - */ - @Override - public Throwable getCause() { - return this.cause; - } } From e239e1967ac8230cd23ea7906c6d6b90f489d601 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 12 Oct 2015 14:52:17 -0400 Subject: [PATCH 2/5] Allows a custom message to be passed with a cause. --- JSONException.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/JSONException.java b/JSONException.java index 41e85ae..086bac8 100755 --- a/JSONException.java +++ b/JSONException.java @@ -7,6 +7,7 @@ package org.json; * @version 2014-05-03 */ public class JSONException extends RuntimeException { + /** Serialization ID */ private static final long serialVersionUID = 0; /** @@ -19,6 +20,16 @@ public class JSONException extends RuntimeException { super(message); } + /** + * @param message + * Detail about the reason for the exception. + * @param cause + * The cause. + */ + public JSONException(String message, Throwable cause) { + super(message, cause); + } + /** * Constructs a new JSONException with the specified cause. * From 0e132415289c0306d028a5df560c75a0ee975493 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 12 Oct 2015 14:53:03 -0400 Subject: [PATCH 3/5] Expands javadoc --- JSONException.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/JSONException.java b/JSONException.java index 086bac8..9ac810b 100755 --- a/JSONException.java +++ b/JSONException.java @@ -21,6 +21,8 @@ public class JSONException extends RuntimeException { } /** + * Constructs a JSONException with an explanatory message and cause. + * * @param message * Detail about the reason for the exception. * @param cause From 1b06a802cf134bd781d2bf3f4ce4e01bff92a612 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 12 Oct 2015 14:54:30 -0400 Subject: [PATCH 4/5] makes params final --- JSONException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONException.java b/JSONException.java index 9ac810b..2463d96 100755 --- a/JSONException.java +++ b/JSONException.java @@ -28,7 +28,7 @@ public class JSONException extends RuntimeException { * @param cause * The cause. */ - public JSONException(String message, Throwable cause) { + public JSONException(final String message, final Throwable cause) { super(message, cause); } From 1448163981d7d81aacae15ddb2ff164947def02d Mon Sep 17 00:00:00 2001 From: John Aylward Date: Wed, 14 Oct 2015 00:41:38 -0400 Subject: [PATCH 5/5] fixes file date --- JSONException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONException.java b/JSONException.java index 2463d96..8503e35 100755 --- a/JSONException.java +++ b/JSONException.java @@ -4,7 +4,7 @@ package org.json; * The JSONException is thrown by the JSON.org classes when things are amiss. * * @author JSON.org - * @version 2014-05-03 + * @version 2015-10-14 */ public class JSONException extends RuntimeException { /** Serialization ID */