Repository: cordova-plugin-file-transfer Updated Branches: refs/heads/master 3c36ee1fc -> c0c91d024
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/master Commit: 6f91ac3a3068a12b7bffe3d03471943a1690941e Parents: d3b21b3 Author: Bas Bosman <[email protected]> Authored: Sun Jan 26 22:40:23 2014 +0100 Committer: Andrew Grieve <[email protected]> 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.
