Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fc71360 authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

OPP: Close InputStream properly

Use case :
1. Select many files and sent to remote device.
2. Donot accept the files on remote device and let
   it timeout.

Failure:
Client didn`t close the input stream.

Root Cause:
While closing output stream, I/O Error occurs because of
timeout which in turn leads remote device to close transport
and thereby preventing DUT from closing the FD.

Fix:
Catch Exception in closing OutputStream, and proceed with closing
File Info to prevent leak.

Test: Tried to send file and check if file is closed properly
during timeout exception preventing any FD leak.

Bug: 37838688
Change-Id: I0499e95e010814a3de49f16de8ce563c5515e991
parent f78c6651
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -561,9 +561,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    if (outputStream != null) {
                        outputStream.close();
                    }
                } catch (IOException e) {
                    Log.e(TAG, "Error when closing output stream after send");
                }

                // Close InputStream and remove SendFileInfo from map
                BluetoothOppUtility.closeSendFileInfo(mInfo.mUri);
                try {
                    if (!error) {
                        responseCode = putOperation.getResponseCode();
                        if (responseCode != -1) {