You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/08/23 08:08:27 UTC

cordova-plugin-file-transfer git commit: CB-9022 Fix exception thrown by call to remapApi on main thread

Repository: cordova-plugin-file-transfer
Updated Branches:
  refs/heads/master 13d5cfe4d -> 2b6b6d933


CB-9022 Fix exception thrown by call to remapApi on main thread

When reamapApi was being called for device file it was performing IO on
the WebCore thread and throwing an IllegalState exception.  This seems
to have only been a problem when local URL corresponded to a video file.

Moved calls to remapApi for device URLs within new thread context so
that IO is performed on background thread.

This is the same fix as 3ccf9f8 but for `download` operation

This closes #124


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

Branch: refs/heads/master
Commit: 2b6b6d9333848beb05a6128242701261467b5d69
Parents: 13d5cfe
Author: Adam Nemitoff <ad...@teamnemitoff.com>
Authored: Thu Jan 7 11:43:28 2016 -0500
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Tue Aug 23 11:07:50 2016 +0300

----------------------------------------------------------------------
 src/android/FileTransfer.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/2b6b6d93/src/android/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index 590ee99..f9c2037 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -741,11 +741,6 @@ public class FileTransfer extends CordovaPlugin {
         final JSONObject headers = args.optJSONObject(4);
 
         final Uri sourceUri = resourceApi.remapUri(Uri.parse(source));
-        // Accept a path or a URI for the source.
-        Uri tmpTarget = Uri.parse(target);
-        final Uri targetUri = resourceApi.remapUri(
-            tmpTarget.getScheme() != null ? tmpTarget : Uri.fromFile(new File(target)));
-
         int uriType = CordovaResourceApi.getUriType(sourceUri);
         final boolean useHttps = uriType == CordovaResourceApi.URI_TYPE_HTTPS;
         final boolean isLocalTransfer = !useHttps && uriType != CordovaResourceApi.URI_TYPE_HTTP;
@@ -805,6 +800,11 @@ public class FileTransfer extends CordovaPlugin {
                 if (context.aborted) {
                     return;
                 }
+
+                // Accept a path or a URI for the source.
+                Uri tmpTarget = Uri.parse(target);
+                Uri targetUri = resourceApi.remapUri(
+                        tmpTarget.getScheme() != null ? tmpTarget : Uri.fromFile(new File(target)));
                 HttpURLConnection connection = null;
                 HostnameVerifier oldHostnameVerifier = null;
                 SSLSocketFactory oldSocketFactory = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org