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

Commit e1fac533 authored by Matt Garnes's avatar Matt Garnes
Browse files

Fix improper exception handling during copy operation.

- Do not cast ClosedByInterruptException to CancelledOperationException;
  return a new CancelledOperationException instead.

Change-Id: I41cb0c605c55fc896a3e483cb5b1f1fcc913676e
(cherry picked from commit 2444ef32)
parent 81d466c7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1184,10 +1184,14 @@ public final class FileHelper {
            if (e.getCause() instanceof ErrnoException
                        && ((ErrnoException)e.getCause()).errno == OsConstants.ENOSPC) {
                throw new ExecutionException(R.string.msgs_no_disk_space);
            } else if ((e instanceof CancelledOperationException)
                    || (e instanceof ClosedByInterruptException)) {
            } else if (e instanceof CancelledOperationException) {
                // If the user cancelled this operation, let it through.
                throw (CancelledOperationException)e;
            } else if (e instanceof ClosedByInterruptException) {
                // The thread running this operation was interrupted.
                // This is likely because the user cancelled the operation,
                // which cancelled the AsyncTask.
                throw new CancelledOperationException();
            }
            return false;
        } finally {