mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-08-01 00:01:32 +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)
|
if(err != null)
|
||||||
{
|
{
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(err, "UTF-8"));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(err, "UTF-8"));
|
||||||
String line = reader.readLine();
|
try {
|
||||||
while(line != null)
|
String line = reader.readLine();
|
||||||
{
|
while(line != null) {
|
||||||
bodyBuilder.append(line);
|
bodyBuilder.append(line);
|
||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
if(line != null)
|
if(line != null) {
|
||||||
bodyBuilder.append('\n');
|
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.
|
// IOException can leave connection object in a bad state, so catch all exceptions.
|
||||||
|
|||||||
Reference in New Issue
Block a user