Author: nbelaevski
Date: 2008-12-02 19:10:47 -0500 (Tue, 02 Dec 2008)
New Revision: 11501
Added:
trunk/framework/impl/src/test/java/org/richfaces/json/
Modified:
trunk/framework/impl/src/main/java/org/richfaces/json/JSONArray.java
trunk/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java
trunk/framework/impl/src/main/java/org/richfaces/json/JSONException.java
trunk/framework/impl/src/main/java/org/richfaces/json/JSONMap.java
trunk/framework/impl/src/main/java/org/richfaces/json/JSONObject.java
Log:
https://jira.jboss.org/jira/browse/RF-5040
Modified: trunk/framework/impl/src/main/java/org/richfaces/json/JSONArray.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/json/JSONArray.java 2008-12-02
19:29:06 UTC (rev 11500)
+++ trunk/framework/impl/src/main/java/org/richfaces/json/JSONArray.java 2008-12-03
00:10:47 UTC (rev 11501)
@@ -25,6 +25,7 @@
*/
import java.io.IOException;
+import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
@@ -80,10 +81,14 @@
* @author
JSON.org
* @version 2
*/
-public class JSONArray {
+public class JSONArray implements Serializable {
-
/**
+ *
+ */
+ private static final long serialVersionUID = -5128849901663778859L;
+
+ /**
* The arrayList where the JSONArray's properties are kept.
*/
private ArrayList myArrayList;
Modified: trunk/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java 2008-12-02
19:29:06 UTC (rev 11500)
+++ trunk/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java 2008-12-03
00:10:47 UTC (rev 11501)
@@ -21,6 +21,7 @@
package org.richfaces.json;
+import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Iterator;
@@ -30,8 +31,13 @@
* created 15.12.2006
*
*/
-public class JSONCollection extends AbstractCollection {
+public class JSONCollection extends AbstractCollection implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3192118108278773579L;
+
private JSONArray array;
public JSONCollection() throws JSONException {
Modified: trunk/framework/impl/src/main/java/org/richfaces/json/JSONException.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/json/JSONException.java 2008-12-02
19:29:06 UTC (rev 11500)
+++ trunk/framework/impl/src/main/java/org/richfaces/json/JSONException.java 2008-12-03
00:10:47 UTC (rev 11501)
@@ -27,8 +27,17 @@
* @version 2
*/
public class JSONException extends Exception {
- private Throwable cause;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2464742309018240317L;
+
+ private Throwable cause;
+ public JSONException() {
+ super();
+ }
+
/**
* Constructs a JSONException with an explanatory message.
* @param message Detail about the reason for the exception.
Modified: trunk/framework/impl/src/main/java/org/richfaces/json/JSONMap.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/json/JSONMap.java 2008-12-02 19:29:06
UTC (rev 11500)
+++ trunk/framework/impl/src/main/java/org/richfaces/json/JSONMap.java 2008-12-03 00:10:47
UTC (rev 11501)
@@ -21,6 +21,7 @@
package org.richfaces.json;
+import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
@@ -32,10 +33,15 @@
* created 15.12.2006
*
*/
-public class JSONMap extends AbstractMap {
+public class JSONMap extends AbstractMap implements Serializable {
- final private JSONObject jsonObject;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2898468948832273123L;
+ private JSONObject jsonObject;
+
public JSONMap() throws JSONException {
super();
Modified: trunk/framework/impl/src/main/java/org/richfaces/json/JSONObject.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/json/JSONObject.java 2008-12-02
19:29:06 UTC (rev 11500)
+++ trunk/framework/impl/src/main/java/org/richfaces/json/JSONObject.java 2008-12-03
00:10:47 UTC (rev 11501)
@@ -25,6 +25,8 @@
*/
import java.io.IOException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
import java.io.Writer;
import java.lang.reflect.Field;
import java.util.Collection;
@@ -85,16 +87,30 @@
* @author
JSON.org
* @version 2
*/
-public class JSONObject {
+public class JSONObject implements Serializable {
/**
+ *
+ */
+ private static final long serialVersionUID = -3779657348977645510L;
+
+ /**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
* undefined.
*/
- private static final class Null {
+ private static final class Null implements Serializable {
/**
+ *
+ */
+ private static final long serialVersionUID = -1155578668810010644L;
+
+ protected Null() {
+ super();
+ }
+
+ /**
* There is only intended to be a single instance of the NULL object,
* so the clone method returns itself.
* @return NULL.
@@ -122,6 +138,11 @@
public String toString() {
return "null";
}
+
+ private Object readResolve() throws ObjectStreamException {
+ return NULL;
+ }
+
}