mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-02-02 00:00:05 +08:00
CB-4907 Close stream when we're finished with it
This commit is contained in:
committed by
Andrew Grieve
parent
d3b21b35fc
commit
6f91ac3a30
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user