Skip to content

Commit

Permalink
fixing double quotes issue when sending/receiving string to/from js d…
Browse files Browse the repository at this point in the history
…ev console
  • Loading branch information
Devendra committed Aug 23, 2013
1 parent ef1b00c commit 79f571a
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 39 deletions.
Binary file modified android/Pubnub-Android-3.5.4.jar
Binary file not shown.
Binary file modified android/examples/PubnubExample/libs/Pubnub-Android-3.5.4.jar
Binary file not shown.
Binary file modified android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.4.jar
Binary file not shown.
Binary file modified blackberry/Pubnub-BlackBerry-3.5.4.jar
Binary file not shown.
Binary file modified codenameone/pubnub-codenameone-3.5.4.cn1lib
Binary file not shown.
Binary file modified j2me/Pubnub-MicroEdition-3.5.4.jar
Binary file not shown.
Binary file modified java/Pubnub-StandardEdition-3.5.4.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions java/doc/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:16 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
All Classes
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:16 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
All Classes
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/Callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:14 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:23 IST 2013 -->
<TITLE>
Callback
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/HttpUtil.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:14 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:23 IST 2013 -->
<TITLE>
HttpUtil
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/Pubnub.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:14 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:23 IST 2013 -->
<TITLE>
Pubnub
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubError.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
PubnubError
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubException.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
PubnubException
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubUtil.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
PubnubUtil
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
com.pubnub.api
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
com.pubnub.api
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
com.pubnub.api Class Hierarchy
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/constant-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
Constant Field Values
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/deprecated-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:16 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
Deprecated List
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/help-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:16 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
API Help
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/index-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
Index
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">

Expand Down
2 changes: 1 addition & 1 deletion java/doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Tue Aug 20 15:34:16 IST 2013-->
<!-- Generated by javadoc on Fri Aug 23 22:55:24 IST 2013-->
<TITLE>
Generated Documentation (Untitled)
</TITLE>
Expand Down
4 changes: 2 additions & 2 deletions java/doc/overview-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
Class Hierarchy
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/serialized-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Tue Aug 20 15:34:15 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Fri Aug 23 22:55:24 IST 2013 -->
<TITLE>
Serialized Form
</TITLE>

<META NAME="date" CONTENT="2013-08-20">
<META NAME="date" CONTENT="2013-08-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
Binary file modified java/jars/Pubnub-UnitTests-3.5.4.jar
Binary file not shown.
Binary file modified java/jars/PubnubDemoConsole.jar
Binary file not shown.
Binary file modified java/jars/PubnubExample.jar
Binary file not shown.
11 changes: 7 additions & 4 deletions java/srcPubnubApi/com/pubnub/api/PubnubCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)));
}
}
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)));
}

}
Expand Down
15 changes: 15 additions & 0 deletions java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 79f571a

Please sign in to comment.