You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2013/04/04 19:59:43 UTC
android commit: [CB-2666] Added check for null arguments.
Updated Branches:
refs/heads/master b42c91897 -> 1fa63300a
[CB-2666] Added check for null arguments.
If null arguments are received, send an error and an explanation.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/1fa63300
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/1fa63300
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/1fa63300
Branch: refs/heads/master
Commit: 1fa63300aa9783e4664d43c745df7b9013653602
Parents: b42c918
Author: Max Woghiren <ma...@gmail.com>
Authored: Wed Mar 27 12:09:17 2013 -0400
Committer: Max Woghiren <ma...@gmail.com>
Committed: Tue Apr 2 11:51:25 2013 -0400
----------------------------------------------------------------------
framework/src/org/apache/cordova/ExposedJsApi.java | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1fa63300/framework/src/org/apache/cordova/ExposedJsApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java
index 48e7102..7702d35 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -20,6 +20,7 @@ package org.apache.cordova;
import android.webkit.JavascriptInterface;
import org.apache.cordova.api.PluginManager;
+import org.apache.cordova.api.PluginResult;
import org.json.JSONException;
/**
@@ -39,6 +40,12 @@ import org.json.JSONException;
@JavascriptInterface
public String exec(String service, String action, String callbackId, String arguments) throws JSONException {
+ // If the arguments weren't received, send a message back to JS. It will switch bridge modes and try again. See CB-2666.
+ // We send a message meant specifically for this case. It starts with "@" so no other message can be encoded into the same string.
+ if (arguments == null) {
+ return "@Null arguments.";
+ }
+
jsMessageQueue.setPaused(true);
try {
boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);