You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/09/26 21:04:27 UTC
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
Updated Branches:
refs/heads/dev 0e2ce7be5 -> 963f8b8b1
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/dev
Commit: 963f8b8b12f613a654e39c2bc113dade23098b7b
Parents: 0e2ce7b
Author: Joe Bowser <bo...@apache.org>
Authored: Thu Sep 26 12:03:46 2013 -0700
Committer: Joe Bowser <bo...@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;
}