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

Commit 2ce242db authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Catch all exceptions while trying to send a file.

While trying to share pictures, some applications might
not have given the adequate permissions.

DrNo:Jsh
Bug:2284822
parent c74939f0
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -571,13 +571,21 @@ public class BluetoothOppService extends Service {
        if (info.isReadyToStart()) {
            if (info.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
                /* check if the file exists */
                InputStream i;
                try {
                    InputStream i = getContentResolver().openInputStream(Uri.parse(info.mUri));
                    i.close();
                    i = getContentResolver().openInputStream(Uri.parse(info.mUri));
                } catch (FileNotFoundException e) {
                    Log.e(TAG, "Can't open file for OUTBOUND info " + info.mId);
                    Constants.updateShareStatus(this, info.mId, BluetoothShare.STATUS_BAD_REQUEST);
                    return;
                } catch (SecurityException e) {
                    Log.e(TAG, "Exception:" + e.toString() + " for OUTBOUND info " + info.mId);
                    Constants.updateShareStatus(this, info.mId, BluetoothShare.STATUS_BAD_REQUEST);
                    return;
                }

                try {
                    i.close();
                } catch (IOException ex) {
                    Log.e(TAG, "IO error when close file for OUTBOUND info " + info.mId);
                    return;