You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/03/07 03:27:54 UTC

[1/2] android commit: Add NOTICE file

Repository: cordova-android
Updated Branches:
  refs/heads/master a2f8c9c75 -> 9a00ccdac


Add NOTICE file


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

Branch: refs/heads/master
Commit: e8d48e1f43db6548d8f3a2df166399c77f08aa27
Parents: a2f8c9c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Feb 27 15:36:30 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Feb 27 15:36:30 2014 -0500

----------------------------------------------------------------------
 NOTICE | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e8d48e1f/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 40c5e74..8ec56a5 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,17 +1,5 @@
 Apache Cordova
-Copyright 2014 The Apache Software Foundation
+Copyright 2012 The Apache Software Foundation
 
 This product includes software developed at
-The Apache Software Foundation (http://www.apache.org)
-
-=========================================================================
-==  NOTICE file corresponding to the section 4 d of                    ==
-==  the Apache License, Version 2.0,                                   ==
-==  in this case for the Android-specific code.                        ==
-=========================================================================
-
-This product includes software developed as part of
-The Android Open Source Project (http://source.android.com).
-
-This software includes software developed at Square, Inc.
-Copyright (C) 2013 Square, Inc.
+The Apache Software Foundation (http://www.apache.org/).


[2/2] android commit: Catch uncaught exceptions in from plugins and turn them into error responses.

Posted by ag...@apache.org.
Catch uncaught exceptions in from plugins and turn them into error responses.

When a plugin throws an unchecked exception, we're not catching it
anywhere and so the error callback is not being called.

This change adds a try/catch to catch such exceptions.


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

Branch: refs/heads/master
Commit: 9a00ccdaccf940348d88c4e5ccd771299311043c
Parents: e8d48e1
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 6 21:25:48 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 6 21:27:44 2014 -0500

----------------------------------------------------------------------
 framework/src/org/apache/cordova/PluginManager.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9a00ccda/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index e9795e8..f095722 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -236,22 +236,25 @@ public class PluginManager {
             app.sendPluginResult(cr, callbackId);
             return;
         }
+        CallbackContext callbackContext = new CallbackContext(callbackId, app);
         try {
-            CallbackContext callbackContext = new CallbackContext(callbackId, app);
             long pluginStartTime = System.currentTimeMillis();
             boolean wasValidAction = plugin.execute(action, rawArgs, callbackContext);
             long duration = System.currentTimeMillis() - pluginStartTime;
-            
+
             if (duration > SLOW_EXEC_WARNING_THRESHOLD) {
                 Log.w(TAG, "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool().");
             }
             if (!wasValidAction) {
                 PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
-                app.sendPluginResult(cr, callbackId);
+                callbackContext.sendPluginResult(cr);
             }
         } catch (JSONException e) {
             PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
-            app.sendPluginResult(cr, callbackId);
+            callbackContext.sendPluginResult(cr);
+        } catch (Exception e) {
+            Log.e(TAG, "Uncaught exception from plugin", e);
+            callbackContext.error(e.getMessage());
         }
     }