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 2012/07/06 23:39:37 UTC

android commit: Modify PluginResult(status) so it generates a JSON string that works with JSON.parse()

Updated Branches:
  refs/heads/master eb0348d47 -> 401c2f42f


Modify PluginResult(status) so it generates a JSON string that works with JSON.parse()


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/401c2f42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/401c2f42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/401c2f42

Branch: refs/heads/master
Commit: 401c2f42f998d5a001bb982a5199958671d63fce
Parents: eb0348d
Author: macdonst <si...@gmail.com>
Authored: Fri Jul 6 17:39:04 2012 -0400
Committer: macdonst <si...@gmail.com>
Committed: Fri Jul 6 17:39:04 2012 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/api/PluginResult.java   |   22 +++++++-------
 1 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/401c2f42/framework/src/org/apache/cordova/api/PluginResult.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginResult.java b/framework/src/org/apache/cordova/api/PluginResult.java
index 9ec24d9..b5ae304 100755
--- a/framework/src/org/apache/cordova/api/PluginResult.java
+++ b/framework/src/org/apache/cordova/api/PluginResult.java
@@ -25,13 +25,13 @@ public class PluginResult {
     private final int status;
     private final String message;
     private boolean keepCallback = false;
-    
+
 
     public PluginResult(Status status) {
         this.status = status.ordinal();
-        this.message = "'" + PluginResult.StatusMessages[this.status] + "'";
+        this.message = "\"" + PluginResult.StatusMessages[this.status] + "\"";
     }
-    
+
     public PluginResult(Status status, String message) {
         this.status = status.ordinal();
         this.message = JSONObject.quote(message);
@@ -61,11 +61,11 @@ public class PluginResult {
         this.status = status.ordinal();
         this.message = ""+b;
     }
-    
+
     public void setKeepCallback(boolean b) {
         this.keepCallback = b;
     }
-    
+
     public int getStatus() {
         return status;
     }
@@ -73,23 +73,23 @@ public class PluginResult {
     public String getMessage() {
         return message;
     }
-    
+
     public boolean getKeepCallback() {
         return this.keepCallback;
     }
-    
+
     public String getJSONString() {
         return "{\"status\":" + this.status + ",\"message\":" + this.message + ",\"keepCallback\":" + this.keepCallback + "}";
     }
-    
+
     public String toSuccessCallbackString(String callbackId) {
         return "cordova.callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
     }
-    
+
     public String toErrorCallbackString(String callbackId) {
         return "cordova.callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
     }
-    
+
     public static String[] StatusMessages = new String[] {
         "No result",
         "OK",
@@ -102,7 +102,7 @@ public class PluginResult {
         "JSON error",
         "Error"
     };
-    
+
     public enum Status {
         NO_RESULT,
         OK,