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 2013/01/17 15:56:41 UTC

android commit: CB-2208 Fix crash on File mobile-spec tests

Updated Branches:
  refs/heads/master 29230d031 -> 0311f0db3


CB-2208 Fix crash on File mobile-spec tests

Crash seems to not happen on every platform, but was showin up on the
x86 4.0.3 emulator.


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

Branch: refs/heads/master
Commit: 0311f0db38849bf1e61f1ae721ba2c52521bdd71
Parents: 29230d0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jan 17 09:55:37 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jan 17 09:55:37 2013 -0500

----------------------------------------------------------------------
 framework/src/org/apache/cordova/FileUtils.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/0311f0db/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index 35496e7..554458b 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -239,9 +239,15 @@ public class FileUtils extends CordovaPlugin {
      */
     private void notifyDelete(String filePath) {
         String newFilePath = stripFileProtocol(filePath);
-        this.cordova.getActivity().getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
-            MediaStore.Images.Media.DATA + " = ?",
-            new String[] { newFilePath });
+        try {
+            this.cordova.getActivity().getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+                MediaStore.Images.Media.DATA + " = ?",
+                new String[] { newFilePath });
+        } catch (UnsupportedOperationException t) {
+            // Was seeing this on the File mobile-spec tests on 4.0.3 x86 emulator.
+            // The ContentResolver applies only when the file was registered in the
+            // first case, which is generally only the case with images.
+        }
     }
 
     /**