diff --git a/android/Pubnub-Android-3.5.4.jar b/android/Pubnub-Android-3.5.4.jar index 618b56d4c..7a12c436d 100644 Binary files a/android/Pubnub-Android-3.5.4.jar and b/android/Pubnub-Android-3.5.4.jar differ diff --git a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.4.jar b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.4.jar index 618b56d4c..7a12c436d 100644 Binary files a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.4.jar and b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.4.jar differ diff --git a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.4.jar b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.4.jar index 618b56d4c..7a12c436d 100644 Binary files a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.4.jar and b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.4.jar differ diff --git a/blackberry/Pubnub-BlackBerry-3.5.4.jar b/blackberry/Pubnub-BlackBerry-3.5.4.jar index ea24b61a9..5405b7c8d 100644 Binary files a/blackberry/Pubnub-BlackBerry-3.5.4.jar and b/blackberry/Pubnub-BlackBerry-3.5.4.jar differ diff --git a/codenameone/pubnub-codenameone-3.5.4.cn1lib b/codenameone/pubnub-codenameone-3.5.4.cn1lib index 1993c0299..2c5ec08ce 100644 Binary files a/codenameone/pubnub-codenameone-3.5.4.cn1lib and b/codenameone/pubnub-codenameone-3.5.4.cn1lib differ diff --git a/j2me/Pubnub-MicroEdition-3.5.4.jar b/j2me/Pubnub-MicroEdition-3.5.4.jar index 5f536ed59..1f9657394 100644 Binary files a/j2me/Pubnub-MicroEdition-3.5.4.jar and b/j2me/Pubnub-MicroEdition-3.5.4.jar differ diff --git a/java/Pubnub-StandardEdition-3.5.4.jar b/java/Pubnub-StandardEdition-3.5.4.jar index 7f7882506..63b99bf7f 100644 Binary files a/java/Pubnub-StandardEdition-3.5.4.jar and b/java/Pubnub-StandardEdition-3.5.4.jar differ diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index 0ea1dcc6d..addbca06e 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -2,12 +2,12 @@ - + All Classes - + diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html index 60db9a87b..c6842bf11 100644 --- a/java/doc/allclasses-noframe.html +++ b/java/doc/allclasses-noframe.html @@ -2,12 +2,12 @@ - + All Classes - + diff --git a/java/doc/com/pubnub/api/Callback.html b/java/doc/com/pubnub/api/Callback.html index 18a87b58a..0253c7e7e 100644 --- a/java/doc/com/pubnub/api/Callback.html +++ b/java/doc/com/pubnub/api/Callback.html @@ -2,12 +2,12 @@ - + Callback - + diff --git a/java/doc/com/pubnub/api/HttpUtil.html b/java/doc/com/pubnub/api/HttpUtil.html index b58eb97ad..46307aa4c 100644 --- a/java/doc/com/pubnub/api/HttpUtil.html +++ b/java/doc/com/pubnub/api/HttpUtil.html @@ -2,12 +2,12 @@ - + HttpUtil - + diff --git a/java/doc/com/pubnub/api/Pubnub.html b/java/doc/com/pubnub/api/Pubnub.html index 82ffb2d51..97b0f6d84 100644 --- a/java/doc/com/pubnub/api/Pubnub.html +++ b/java/doc/com/pubnub/api/Pubnub.html @@ -2,12 +2,12 @@ - + Pubnub - + diff --git a/java/doc/com/pubnub/api/PubnubError.html b/java/doc/com/pubnub/api/PubnubError.html index 3320548b9..f5965ef14 100644 --- a/java/doc/com/pubnub/api/PubnubError.html +++ b/java/doc/com/pubnub/api/PubnubError.html @@ -2,12 +2,12 @@ - + PubnubError - + diff --git a/java/doc/com/pubnub/api/PubnubException.html b/java/doc/com/pubnub/api/PubnubException.html index 9b0d99b44..df5a461ad 100644 --- a/java/doc/com/pubnub/api/PubnubException.html +++ b/java/doc/com/pubnub/api/PubnubException.html @@ -2,12 +2,12 @@ - + PubnubException - + diff --git a/java/doc/com/pubnub/api/PubnubUtil.html b/java/doc/com/pubnub/api/PubnubUtil.html index f9c7855c6..d4206af78 100644 --- a/java/doc/com/pubnub/api/PubnubUtil.html +++ b/java/doc/com/pubnub/api/PubnubUtil.html @@ -2,12 +2,12 @@ - + PubnubUtil - + diff --git a/java/doc/com/pubnub/api/package-frame.html b/java/doc/com/pubnub/api/package-frame.html index 7a9ce08b6..d678e9398 100644 --- a/java/doc/com/pubnub/api/package-frame.html +++ b/java/doc/com/pubnub/api/package-frame.html @@ -2,12 +2,12 @@ - + com.pubnub.api - + diff --git a/java/doc/com/pubnub/api/package-summary.html b/java/doc/com/pubnub/api/package-summary.html index 4268389f4..b839f44cf 100644 --- a/java/doc/com/pubnub/api/package-summary.html +++ b/java/doc/com/pubnub/api/package-summary.html @@ -2,12 +2,12 @@ - + com.pubnub.api - + diff --git a/java/doc/com/pubnub/api/package-tree.html b/java/doc/com/pubnub/api/package-tree.html index 77e7086a0..5c28e0250 100644 --- a/java/doc/com/pubnub/api/package-tree.html +++ b/java/doc/com/pubnub/api/package-tree.html @@ -2,12 +2,12 @@ - + com.pubnub.api Class Hierarchy - + diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html index 07a0f0975..a73aff8d6 100644 --- a/java/doc/constant-values.html +++ b/java/doc/constant-values.html @@ -2,12 +2,12 @@ - + Constant Field Values - + diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index 99645b4ff..2c8e92d71 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -2,12 +2,12 @@ - + Deprecated List - + diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html index 28f8e7648..e23f40f07 100644 --- a/java/doc/help-doc.html +++ b/java/doc/help-doc.html @@ -2,12 +2,12 @@ - + API Help - + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index 980ff62ab..48bea0f92 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -2,12 +2,12 @@ - + Index - + diff --git a/java/doc/index.html b/java/doc/index.html index cea17a207..730531a8b 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index f9a81ffaa..873042cd7 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -2,12 +2,12 @@ - + Class Hierarchy - + diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html index c664d89c2..24e8659c7 100644 --- a/java/doc/serialized-form.html +++ b/java/doc/serialized-form.html @@ -2,12 +2,12 @@ - + Serialized Form - + diff --git a/java/jars/Pubnub-UnitTests-3.5.4.jar b/java/jars/Pubnub-UnitTests-3.5.4.jar index acba62032..21524646a 100644 Binary files a/java/jars/Pubnub-UnitTests-3.5.4.jar and b/java/jars/Pubnub-UnitTests-3.5.4.jar differ diff --git a/java/jars/PubnubDemoConsole.jar b/java/jars/PubnubDemoConsole.jar index d0b54cb5f..3ab18b4b2 100644 Binary files a/java/jars/PubnubDemoConsole.jar and b/java/jars/PubnubDemoConsole.jar differ diff --git a/java/jars/PubnubExample.jar b/java/jars/PubnubExample.jar index 03f251d93..0cf29f7d1 100644 Binary files a/java/jars/PubnubExample.jar and b/java/jars/PubnubExample.jar differ diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java index 0c352433e..c16ae9a50 100644 --- a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java +++ b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java @@ -512,6 +512,9 @@ public void publish(Hashtable args) { // Encrypt Message PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY, this.IV); try { + if (message instanceof String) { + msgStr = "\"" + msgStr + "\""; + } msgStr = "\"" + pc.encrypt(msgStr) + "\""; } catch (DataLengthException e) { callback.errorCallback(channel, @@ -1342,7 +1345,7 @@ public void handleResponse(HttpRequest hreq, String response) { if (!isWorkerDead(hreq)) _channel.callback .successCallback( _channel.name, - PubnubUtil.stringToJSON(message)); + PubnubUtil.parseJSON(PubnubUtil.stringToJSON(message))); } catch (DataLengthException e) { if (!isWorkerDead(hreq)) _channel.callback .errorCallback( @@ -1384,7 +1387,7 @@ public void handleResponse(HttpRequest hreq, String response) { } else { if (!isWorkerDead(hreq)) _channel.callback.successCallback( _channel.name, - messages.get(i)); + PubnubUtil.parseJSON(messages.get(i))); } } } @@ -1412,7 +1415,7 @@ public void handleResponse(HttpRequest hreq, String response) { if (!isWorkerDead(hreq)) _channel.callback .successCallback( _channel.name, - PubnubUtil.stringToJSON(message)); + PubnubUtil.parseJSON(PubnubUtil.stringToJSON(message))); } catch (DataLengthException e) { if (!isWorkerDead(hreq)) _channel.callback .errorCallback( @@ -1452,7 +1455,7 @@ public void handleResponse(HttpRequest hreq, String response) { } else { if (!isWorkerDead(hreq)) _channel.callback.successCallback( _channel.name, - messages.get(i)); + PubnubUtil.parseJSON(messages.get(i))); } } diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java index 36db0ff3c..62fe4eee7 100644 --- a/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java +++ b/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java @@ -189,4 +189,19 @@ static Hashtable hashtableMerge(Hashtable dst, Hashtable src) { } return dst; } + /** + * Parse Json, change json string to string + * + * @param obj + * JSON data in string format + * + * @return JSONArray or JSONObject or String + */ + static Object parseJSON(Object obj) { + if (obj instanceof String) { + if (((String) obj).endsWith("\"") && ((String) obj).startsWith("\"")) + obj = ((String) obj).substring(1, ((String) obj).length() -1); + } + return obj; + } } \ No newline at end of file