Skip to content

Commit 2c6bf76

Browse files
committed
Merge branch 'hotfix'
2 parents 11f198a + abf78cf commit 2c6bf76

File tree

8 files changed

+17
-33
lines changed

8 files changed

+17
-33
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
## Change Log
2+
#### 0.11.1
3+
* fixed the bug that was not be done unescape when sending a message (thanks to @shilder)
4+
* fixed the bug that became unable to send a message when was created an instance many times
5+
* temporarily disabled `AndroidLogger`
6+
27
#### 0.11.0
38
* permessage-deflate support
49
* deleted unused code (further shrank about 20%)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-websocket",
3-
"version": "0.11.0",
3+
"version": "0.11.1",
44
"description": "Cordova WebSocket Plugin for Android",
55
"cordova": {
66
"id": "cordova-plugin-websocket",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
44
xmlns:android="http://schemas.android.com/apk/res/android"
55
id="cordova-plugin-websocket"
6-
version="0.11.0">
6+
version="0.11.1">
77
<name>WebSocket for Android</name>
88
<description>Cordova WebSocket Plugin for Android</description>
99
<license>Apache 2.0</license>

src/android/com/knowledgecode/cordova/websocket/ConnectionTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void execute(String rawArgs, CallbackContext ctx) {
9595
WebSocketClient client = _factory.newWebSocketClient();
9696

9797
JSONArray args = new JSONArray(rawArgs);
98-
int id = Integer.parseInt(args.getString(0), 16);
98+
int id = args.getInt(0);
9999
URI uri = new URI(args.getString(1));
100100
String protocol = args.getString(2);
101101
JSONObject options = args.getJSONObject(5);

src/android/com/knowledgecode/cordova/websocket/SendingTask.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.cordova.PluginResult;
2323
import org.apache.cordova.PluginResult.Status;
2424
import org.eclipse.jetty.websocket.WebSocket.Connection;
25+
import org.json.JSONArray;
2526

2627
import com.knowledgecode.cordova.websocket.TaskRunner.Task;
2728

@@ -47,16 +48,17 @@ public SendingTask(SparseArray<Connection> map) {
4748
@Override
4849
public void execute(String rawArgs, CallbackContext ctx) {
4950
try {
50-
Connection conn = _map.get(Integer.parseInt(rawArgs.substring(2, 10), 16));
51+
String args = new JSONArray(rawArgs).getString(0);
52+
Connection conn = _map.get(Integer.parseInt(args.substring(0, 8), 16));
5153

5254
if (conn != null) {
53-
if (rawArgs.charAt(10) == '1') {
54-
byte[] binary = Base64.decode(rawArgs.substring(rawArgs.indexOf(',') + 1, rawArgs.length() - 2),
55-
Base64.NO_WRAP);
55+
if (args.charAt(8) == '1') {
56+
byte[] binary = Base64.decode(args.substring(args.indexOf(',') + 1), Base64.NO_WRAP);
5657
conn.sendMessage(binary, 0, binary.length);
5758
} else {
58-
conn.sendMessage(rawArgs.substring(11, rawArgs.length() - 2));
59+
conn.sendMessage(args.substring(9));
5960
}
61+
} else {
6062
}
6163
} catch (Exception e) {
6264
if (!ctx.isFinished()) {

src/android/com/knowledgecode/cordova/websocket/WebSocket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* This plugin is using Jetty under the terms of the Apache License v2.0.
3737
*
3838
* @author KNOWLEDGECODE <knowledgecode@gmail.com>
39-
* @version 0.11.0
39+
* @version 0.11.1
4040
*/
4141
public class WebSocket extends CordovaPlugin {
4242

src/android/org/eclipse/jetty/util/log/Log.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,29 +104,6 @@ public void ignore(Throwable ignored)
104104
}
105105
};
106106

107-
static
108-
{
109-
ClassLoader loader = Thread.currentThread().getContextClassLoader();
110-
try
111-
{
112-
@SuppressWarnings("unchecked")
113-
Class<Logger> clazz = (Class<Logger>) loader.loadClass("org.eclipse.jetty.util.log.AndroidLogger");
114-
LOG = clazz.newInstance();
115-
}
116-
catch (ClassNotFoundException e)
117-
{
118-
}
119-
catch (IllegalAccessException e)
120-
{
121-
}
122-
catch (IllegalArgumentException e)
123-
{
124-
}
125-
catch (InstantiationException e)
126-
{
127-
}
128-
}
129-
130107
/**
131108
* Obtain a named Logger based on the fully qualified class name.
132109
*

www/websocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Cordova WebSocket Plugin for Android
2121
* @author KNOWLEDGECODE <knowledgecode@gmail.com>
22-
* @version 0.11.0
22+
* @version 0.11.1
2323
*/
2424
(function (window) {
2525
'use strict';

0 commit comments

Comments
 (0)