tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject [8/8] git commit: TAP5-2098: Maintain JSONObject keys & values in the order they were added
Date Mon, 04 Nov 2013 21:29:39 GMT
TAP5-2098: Maintain JSONObject keys & values in the order they were added


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/dd6fa7bc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/dd6fa7bc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/dd6fa7bc

Branch: refs/heads/master
Commit: dd6fa7bc617e197d4298b1b3a8adb0a70b8e6933
Parents: 55fe56a
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Mon Nov 4 13:29:22 2013 -0800
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Mon Nov 4 13:29:22 2013 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/tapestry5/json/JSONObject.java  | 2 +-
 .../src/test/groovy/json/specs/JSONObjectSpec.groovy         | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dd6fa7bc/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
----------------------------------------------------------------------
diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
index 575d1ea..c8ac282 100644
--- a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
+++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
@@ -133,7 +133,7 @@ public final class JSONObject extends JSONCollection
     /**
      * The map where the JSONObject's properties are kept.
      */
-    private final Map<String, Object> properties = new HashMap<String, Object>();
+    private final Map<String, Object> properties = new LinkedHashMap<String, Object>();
 
     /**
      * It is sometimes more convenient and less ambiguous to have a <code>NULL</code>
object than to use Java's

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dd6fa7bc/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy
----------------------------------------------------------------------
diff --git a/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy b/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy
index 4cdd50b..9258598 100644
--- a/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy
+++ b/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy
@@ -680,14 +680,14 @@ class JSONObjectSpec extends Specification {
   "outer" : {
     "inner" : "here"
   },
-  "otherwise" : "a quoted string",
-  "boolean" : true,
   "number" : 22.7,
   "array" : [
     1,
     2,
     3
-  ]
+  ],
+  "boolean" : true,
+  "otherwise" : "a quoted string"
 }'''
     }
 
@@ -809,7 +809,7 @@ class JSONObjectSpec extends Specification {
         then:
 
         result.is object
-        object.toCompactString() == /{"wilma":"flintstone","fred":"flintstone","barney":"rubble"}/
+        object.toCompactString() == /{"fred":"flintstone","barney":"rubble","wilma":"flintstone"}/
     }
 
     def "in() where the value is not JSONObject is an exception"() {


Mime
View raw message