diff options
author | Matt Garnes <matt@cyngn.com> | 2015-08-13 08:14:52 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-08-13 09:54:04 -0700 |
commit | 2444ef323fc5920588f45c96a36533a969ab6be2 (patch) | |
tree | 30560426cbb4ccd6d0cda8ac73cd2c5fb58f8c60 | |
parent | 21560d809d52fbba94d55b1e6b8eb091c885b9fa (diff) | |
download | android_packages_apps_CMFileManager-2444ef323fc5920588f45c96a36533a969ab6be2.tar.gz android_packages_apps_CMFileManager-2444ef323fc5920588f45c96a36533a969ab6be2.tar.bz2 android_packages_apps_CMFileManager-2444ef323fc5920588f45c96a36533a969ab6be2.zip |
Fix improper exception handling during copy operation.
- Do not cast ClosedByInterruptException to CancelledOperationException;
return a new CancelledOperationException instead.
Change-Id: I41cb0c605c55fc896a3e483cb5b1f1fcc913676e
-rw-r--r-- | src/com/cyanogenmod/filemanager/util/FileHelper.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/filemanager/util/FileHelper.java b/src/com/cyanogenmod/filemanager/util/FileHelper.java index 15649e52..f8e89d51 100644 --- a/src/com/cyanogenmod/filemanager/util/FileHelper.java +++ b/src/com/cyanogenmod/filemanager/util/FileHelper.java @@ -1203,10 +1203,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 { |