You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/02/10 19:26:55 UTC
git commit: CB-4907 Close stream when we're finished with it
Updated Branches:
refs/heads/dev d3b21b35f -> 6f91ac3a3
CB-4907 Close stream when we're finished with it
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/6f91ac3a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/6f91ac3a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/6f91ac3a
Branch: refs/heads/dev
Commit: 6f91ac3a3068a12b7bffe3d03471943a1690941e
Parents: d3b21b3
Author: Bas Bosman <sb...@mindef.nl>
Authored: Sun Jan 26 22:40:23 2014 +0100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Feb 10 13:26:43 2014 -0500
----------------------------------------------------------------------
src/android/FileTransfer.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/6f91ac3a/src/android/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index 079cd91..6ad30dd 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -582,15 +582,19 @@ public class FileTransfer extends CordovaPlugin {
if(err != null)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(err, "UTF-8"));
- String line = reader.readLine();
- while(line != null)
- {
- bodyBuilder.append(line);
- line = reader.readLine();
- if(line != null)
- bodyBuilder.append('\n');
+ try {
+ String line = reader.readLine();
+ while(line != null) {
+ bodyBuilder.append(line);
+ line = reader.readLine();
+ if(line != null) {
+ bodyBuilder.append('\n');
+ }
+ }
+ body = bodyBuilder.toString();
+ } finally {
+ reader.close();
}
- body = bodyBuilder.toString();
}
}
// IOException can leave connection object in a bad state, so catch all exceptions.