cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/4] git commit: CB-4504: Updating FileUtils.java to compensate for Java porting failures in the Android SDK. This fails because Java knows nothing about android_asset not being an actual filesystem
Date Thu, 10 Oct 2013 17:56:03 GMT
Updated Branches:
  refs/heads/master 0e2ce7be5 -> 27288cd5c


CB-4504: Updating FileUtils.java to compensate for Java porting failures in the Android SDK.
This fails because Java knows nothing about android_asset not being an actual filesystem


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/963f8b8b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/963f8b8b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/963f8b8b

Branch: refs/heads/master
Commit: 963f8b8b12f613a654e39c2bc113dade23098b7b
Parents: 0e2ce7b
Author: Joe Bowser <bowserj@apache.org>
Authored: Thu Sep 26 12:03:46 2013 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Thu Sep 26 12:04:11 2013 -0700

----------------------------------------------------------------------
 src/android/FileUtils.java | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/963f8b8b/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index 405eb83..e42c5af 100755
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -1016,12 +1016,21 @@ public class FileUtils extends CordovaPlugin {
             rawData = data.getBytes();
         }
         ByteArrayInputStream in = new ByteArrayInputStream(rawData);
-        FileOutputStream out = new FileOutputStream(filename, append);
-        byte buff[] = new byte[rawData.length];
-        in.read(buff, 0, buff.length);
-        out.write(buff, 0, rawData.length);
-        out.flush();
-        out.close();
+        try
+        {
+            FileOutputStream out = new FileOutputStream(filename, append);
+            byte buff[] = new byte[rawData.length];
+            in.read(buff, 0, buff.length);
+            out.write(buff, 0, rawData.length);
+            out.flush();
+            out.close();
+        }
+        catch (NullPointerException e)
+        {
+            // This is a bug in the Android implementation of the Java Stack
+            NoModificationAllowedException realException = new NoModificationAllowedException(filename);
+            throw realException;
+        }
 
         return rawData.length;
     }


Mime
View raw message