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/22 07:19:47 UTC
cordova-plugin-file-transfer git commit: CB-9022 Resolve source URI
on background thread
Repository: cordova-plugin-file-transfer
Updated Branches:
refs/heads/master 9dc41bd4e -> 3ccf9f846
CB-9022 Resolve source URI on background thread
We should call remapUri on background thread otherwise it
throws IllegalStateException when trying to remap 'cdvfile://localhost/content/...' URIs via ContentFilesystem
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/3ccf9f84
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/3ccf9f84
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/3ccf9f84
Branch: refs/heads/master
Commit: 3ccf9f8462c1de61c15c3841f77010b25fd6de58
Parents: 9dc41bd
Author: Vladimir Kotikov <ko...@gmail.com>
Authored: Thu Aug 18 16:30:19 2016 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Thu Aug 18 16:34:18 2016 +0300
----------------------------------------------------------------------
src/android/FileTransfer.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/3ccf9f84/src/android/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index 86176a2..6c5b883 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -305,10 +305,6 @@ public class FileTransfer extends CordovaPlugin {
Log.d(LOG_TAG, "httpMethod: " + httpMethod);
final Uri targetUri = resourceApi.remapUri(Uri.parse(target));
- // Accept a path or a URI for the source.
- Uri tmpSrc = Uri.parse(source);
- final Uri sourceUri = resourceApi.remapUri(
- tmpSrc.getScheme() != null ? tmpSrc : Uri.fromFile(new File(source)));
int uriType = CordovaResourceApi.getUriType(targetUri);
final boolean useHttps = uriType == CordovaResourceApi.URI_TYPE_HTTPS;
@@ -329,6 +325,14 @@ public class FileTransfer extends CordovaPlugin {
if (context.aborted) {
return;
}
+
+ // We should call remapUri on background thread otherwise it throws
+ // IllegalStateException when trying to remap 'cdvfile://localhost/content/...' URIs
+ // via ContentFilesystem (see https://issues.apache.org/jira/browse/CB-9022)
+ Uri tmpSrc = Uri.parse(source);
+ final Uri sourceUri = resourceApi.remapUri(
+ tmpSrc.getScheme() != null ? tmpSrc : Uri.fromFile(new File(source)));
+
HttpURLConnection conn = null;
HostnameVerifier oldHostnameVerifier = null;
SSLSocketFactory oldSocketFactory = null;
@@ -686,7 +690,7 @@ public class FileTransfer extends CordovaPlugin {
if(body != null)
{
error.put("body", body);
- }
+ }
if (httpStatus != null) {
error.put("http_status", httpStatus);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org