diff options
author | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-08 04:02:26 +0000 |
---|---|---|
committer | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-08 04:02:26 +0000 |
commit | 4afc05d60e11878b7391eb9eda10a1cb5dff85c9 (patch) | |
tree | 1bdfc316cc1bcd7ffc52a4adce4a4b33f9adb404 /sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime | |
parent | 5e52a072abe41981e2baa9a8237b87b00cf7090b (diff) |
Add test to demonstrate data conversion to/from JSON. Fix bug in the JSON array parser. Refactor salutes test.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1144149 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 5 insertions, 2 deletions
diff --git a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java index 30a14dd8bb..e21a2402b1 100644 --- a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java +++ b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java @@ -49,6 +49,7 @@ public class JSONUtil { List<String> objects = new ArrayList<String>(); int bracketNum = 0; int parNum = 0; + int quoteNum = 0; int startPos = 1; for (int i = 0; i < jsonArray.length(); i++) { switch (jsonArray.charAt(i)) { @@ -64,8 +65,11 @@ public class JSONUtil { case ']': parNum--; break; + case '\"': + quoteNum++; + break; case ',': - if ((bracketNum == 0) && (parNum == 1)) { + if ((bracketNum == 0) && (parNum == 1) && quoteNum % 2 == 0) { objects.add(jsonArray.substring(startPos, i)); startPos = i + 1; } diff --git a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java index efab714e5c..461b364b2f 100644 --- a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java +++ b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java @@ -85,7 +85,6 @@ public class WebsocketServiceBindingProvider implements ServiceBindingProvider { }
}
websocketServers.clear();
- websocketServers = null;
}
}
|