You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/11/24 04:37:37 UTC
svn commit: r1038460 - in /pivot/trunk/core:
src/org/apache/pivot/json/JSONSerializer.java
test/org/apache/pivot/json/test/TestBean2.java
test/org/apache/pivot/json/test/list.json
test/org/apache/pivot/json/test/map.json
Author: gbrown
Date: Wed Nov 24 03:37:36 2010
New Revision: 1038460
URL: http://svn.apache.org/viewvc?rev=1038460&view=rev
Log:
Fix minor issue in JSONSerializer#readStringValue().
Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2.java
pivot/trunk/core/test/org/apache/pivot/json/test/list.json
pivot/trunk/core/test/org/apache/pivot/json/test/map.json
Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1038460&r1=1038459&r2=1038460&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Wed Nov 24 03:37:36 2010
@@ -385,10 +385,6 @@ public class JSONSerializer implements S
private String readString(Reader reader)
throws IOException, SerializationException {
- if (!(type instanceof Class<?>)) {
- throw new SerializationException("Cannot convert string to " + type + ".");
- }
-
StringBuilder stringBuilder = new StringBuilder();
// Use the same delimiter to close the string
@@ -450,6 +446,10 @@ public class JSONSerializer implements S
private Object readStringValue(Reader reader, Type type)
throws IOException, SerializationException {
+ if (!(type instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert string to " + type + ".");
+ }
+
String string = readString(reader);
// Notify the listeners
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2.java?rev=1038460&r1=1038459&r2=1038460&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2.java Wed Nov 24 03:37:36 2010
@@ -19,7 +19,7 @@ package org.apache.pivot.json.test;
public class TestBean2 {
private int a = 0;
private int b = 0;
- private int c = 0;
+ private String c = null;
public int getA() {
return a;
@@ -37,11 +37,11 @@ public class TestBean2 {
this.b = b;
}
- public int getC() {
+ public String getC() {
return c;
}
- public void setC(int c) {
+ public void setC(String c) {
this.c = c;
}
}
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/list.json
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/list.json?rev=1038460&r1=1038459&r2=1038460&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/list.json (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/list.json Wed Nov 24 03:37:36 2010
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-[ {a:1, b:2, c:3},
- {a:10, b:20, c:30},
- {a:100, b:200, c:300}
+[ {a:1, b:2, c:"3"},
+ {a:10, b:20, c:"30"},
+ {a:100, b:200, c:"300"}
]
\ No newline at end of file
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/map.json
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/map.json?rev=1038460&r1=1038459&r2=1038460&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/map.json (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/map.json Wed Nov 24 03:37:36 2010
@@ -22,8 +22,8 @@
"i": { a: 200, b: "Goodbye", c: true},
j: 200,
k: [
- {a:1, b:2, c:3},
- {a:10, b:20, c:30},
- {a:100, b:200, c:300}
+ {a:1, b:2, c:"3"},
+ {a:10, b:20, c:"30"},
+ {a:100, b:200, c:"300"}
]
}