[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2-5' - android/lib
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 3 21:15:05 UTC 2020
android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 16 ++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 922e043d946c84179008bdac9e4f8683a07f7f37
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jul 3 22:38:23 2020 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Jul 3 23:14:46 2020 +0200
android: Fallback to "w" mode, "wt" is not supported by Google Drive.
Would be cool to consolidate these two places actually to a common
method at some stage...
Change-Id: I5ff3aed134066f26bb058223b972ef11600fa887
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97901
Tested-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index 8465ff5e1..d6d9f804b 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -483,7 +483,13 @@ public class LOActivity extends AppCompatActivity {
inputStream = new FileInputStream(mTempFile);
Uri uri = getIntent().getData();
- outputStream = contentResolver.openOutputStream(uri, "wt");
+ try {
+ outputStream = contentResolver.openOutputStream(uri, "wt");
+ }
+ catch (FileNotFoundException e) {
+ Log.i(TAG, "failed with the 'wt' mode, trying without: " + e.getMessage());
+ outputStream = contentResolver.openOutputStream(uri);
+ }
byte[] buffer = new byte[1024];
int length;
@@ -582,7 +588,13 @@ public class LOActivity extends AppCompatActivity {
LOActivity.this.saveAs(tempFile.toURI().toString(), format);
inputStream = new FileInputStream(tempFile);
- outputStream = getContentResolver().openOutputStream(intent.getData(), "wt");
+ try {
+ outputStream = getContentResolver().openOutputStream(intent.getData(), "wt");
+ }
+ catch (FileNotFoundException e) {
+ Log.i(TAG, "failed with the 'wt' mode, trying without: " + e.getMessage());
+ outputStream = getContentResolver().openOutputStream(intent.getData());
+ }
byte[] buffer = new byte[4096];
int len;
More information about the Libreoffice-commits
mailing list