Skip to content

Commit

Permalink
RuntimeException
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Crockford committed Feb 19, 2013
1 parent 50c3afb commit 0759465
Showing 1 changed file with 38 additions and 28 deletions.
66 changes: 38 additions & 28 deletions JSONException.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
package org.json;

/**
* The JSONException is thrown by the JSON.org classes when things are amiss.
* @author JSON.org
* @version 2010-12-24
*/
public class JSONException extends Exception {
private static final long serialVersionUID = 0;
private Throwable cause;

/**
* Constructs a JSONException with an explanatory message.
* @param message Detail about the reason for the exception.
*/
public JSONException(String message) {
super(message);
}

public JSONException(Throwable cause) {
super(cause.getMessage());
this.cause = cause;
}

public Throwable getCause() {
return this.cause;
}
}
package org.json;

/**
* The JSONException is thrown by the JSON.org classes when things are amiss.
*
* @author JSON.org
* @version 2013-02-10
*/
public class JSONException extends RuntimeException {

This comment has been minimized.

Copy link
@user454322

user454322 Dec 16, 2014

yeah!

RuntimeException ftw!

private static final long serialVersionUID = 0;
private Throwable cause;

/**
* Constructs a JSONException with an explanatory message.
*
* @param message
* Detail about the reason for the exception.
*/
public JSONException(String message) {
super(message);
}

/**
* Constructs a new JSONException with the specified cause.
*/
public JSONException(Throwable cause) {
super(cause.getMessage());
this.cause = cause;
}

/**
* Returns the cause of this throwable or null if the cause is nonexistent or unknown.
* @returns the cause of this throwable or null if the cause is nonexistent or unknown.
*/
public Throwable getCause() {
return this.cause;
}
}

4 comments on commit 0759465

@douglascrockford
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuntimeException

@DanielRuf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it seems you just changed some unnecessary comment lines for the java docs, am I right?
Because the commit message is very unclear (and some more) =(

A commit message like changed comments and whitespaces for Java Docwould be much better. Just a suggestion =)

I often think that there are changes on the API or sourcecode but int he end there are just whitespace and comment changes and I am very confused then if there is any real change and if I would need to update my JSON java files.

@johnjaylward
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-public class JSONException extends Exception {
+public class JSONException extends RuntimeException {

@demoth
Copy link

@demoth demoth commented on 0759465 Apr 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is my favorite commit ever, no Exception mess anymore!

Please sign in to comment.