aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/cyanogenmod/explorer/activities/NavigationActivity.java3
-rw-r--r--src/com/cyanogenmod/explorer/activities/SearchActivity.java3
-rw-r--r--src/com/cyanogenmod/explorer/ui/policy/CompressActionPolicy.java33
-rw-r--r--src/com/cyanogenmod/explorer/ui/policy/CopyMoveActionPolicy.java7
-rw-r--r--src/com/cyanogenmod/explorer/ui/policy/DeleteActionPolicy.java9
-rw-r--r--src/com/cyanogenmod/explorer/ui/policy/NewActionPolicy.java15
-rw-r--r--tests/src/com/cyanogenmod/explorer/commands/shell/LinkCommandTest.java1
7 files changed, 44 insertions, 27 deletions
diff --git a/src/com/cyanogenmod/explorer/activities/NavigationActivity.java b/src/com/cyanogenmod/explorer/activities/NavigationActivity.java
index 0f5c3cd2..e106baa3 100644
--- a/src/com/cyanogenmod/explorer/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/explorer/activities/NavigationActivity.java
@@ -1227,6 +1227,9 @@ public class NavigationActivity extends Activity
FileSystemObject fso = null;
try {
fso = CommandHelper.getFileInfo(this, path, false, null);
+ if (fso == null) {
+ throw new NoSuchFileOrDirectory(path);
+ }
} catch (Exception e) {
// Notify the user
diff --git a/src/com/cyanogenmod/explorer/activities/SearchActivity.java b/src/com/cyanogenmod/explorer/activities/SearchActivity.java
index ad7f4f0e..32aeb9a6 100644
--- a/src/com/cyanogenmod/explorer/activities/SearchActivity.java
+++ b/src/com/cyanogenmod/explorer/activities/SearchActivity.java
@@ -856,6 +856,9 @@ public class SearchActivity extends Activity
FileSystemObject fso = null;
try {
fso = CommandHelper.getFileInfo(this, item.getFullPath(), false, null);
+ if (fso == null) {
+ throw new NoSuchFileOrDirectory(item.getFullPath());
+ }
} catch (Exception e) {
// Notify the user
diff --git a/src/com/cyanogenmod/explorer/ui/policy/CompressActionPolicy.java b/src/com/cyanogenmod/explorer/ui/policy/CompressActionPolicy.java
index 54fe653c..345bcd47 100644
--- a/src/com/cyanogenmod/explorer/ui/policy/CompressActionPolicy.java
+++ b/src/com/cyanogenmod/explorer/ui/policy/CompressActionPolicy.java
@@ -406,16 +406,20 @@ public final class CompressActionPolicy extends ActionsPolicy {
throw this.mListener.mCause;
}
- // Check that the operation was completed retrieving the extracted file or folder
- boolean failed = true;
+ // Check that the operation was completed retrieving the compressed file or folder
+ boolean failed = false;
try {
- CommandHelper.getFileInfo(ctx, out, false, null);
+ FileSystemObject fso = CommandHelper.getFileInfo(ctx, out, false, null);
+ if (fso == null) {
+ // Failed. The file or folder not exists
+ failed = true;
+ }
- // Failed. The file exists
- failed = false;
+ // Operation complete successfully
} catch (Throwable e) {
- // Operation complete successfully
+ // Failed. The file or folder not exists
+ failed = true;
}
if (failed) {
throw new ExecutionException(
@@ -655,16 +659,21 @@ public final class CompressActionPolicy extends ActionsPolicy {
throw this.mListener.mCause;
}
- // Check that the operation was completed retrieving the extracted file or folder
- boolean failed = true;
+ // Check that the operation was completed retrieving the uncompressed
+ // file or folder
+ boolean failed = false;
try {
- CommandHelper.getFileInfo(ctx, out, false, null);
+ FileSystemObject fso2 = CommandHelper.getFileInfo(ctx, out, false, null);
+ if (fso2 == null) {
+ // Failed. The file or folder not exists
+ failed = true;
+ }
- // Failed. The file exists
- failed = false;
+ // Operation complete successfully
} catch (Throwable e) {
- // Operation complete successfully
+ // Failed. The file or folder not exists
+ failed = true;
}
if (failed) {
throw new ExecutionException(
diff --git a/src/com/cyanogenmod/explorer/ui/policy/CopyMoveActionPolicy.java b/src/com/cyanogenmod/explorer/ui/policy/CopyMoveActionPolicy.java
index b8de1163..2c1fa254 100644
--- a/src/com/cyanogenmod/explorer/ui/policy/CopyMoveActionPolicy.java
+++ b/src/com/cyanogenmod/explorer/ui/policy/CopyMoveActionPolicy.java
@@ -23,6 +23,7 @@ import android.text.Html;
import android.text.Spanned;
import com.cyanogenmod.explorer.R;
+import com.cyanogenmod.explorer.console.NoSuchFileOrDirectory;
import com.cyanogenmod.explorer.console.RelaunchableException;
import com.cyanogenmod.explorer.listeners.OnRequestRefreshListener;
import com.cyanogenmod.explorer.listeners.OnSelectionListener;
@@ -405,7 +406,11 @@ public final class CopyMoveActionPolicy extends ActionsPolicy {
}
// Check that the operation was completed retrieving the fso modified
- CommandHelper.getFileInfo(ctx, dst.getAbsolutePath(), false, null);
+ FileSystemObject fso =
+ CommandHelper.getFileInfo(ctx, dst.getAbsolutePath(), false, null);
+ if (fso == null) {
+ throw new NoSuchFileOrDirectory(dst.getAbsolutePath());
+ }
}
};
final BackgroundAsyncTask task = new BackgroundAsyncTask(ctx, callable);
diff --git a/src/com/cyanogenmod/explorer/ui/policy/DeleteActionPolicy.java b/src/com/cyanogenmod/explorer/ui/policy/DeleteActionPolicy.java
index 8e0aa36f..39d1a329 100644
--- a/src/com/cyanogenmod/explorer/ui/policy/DeleteActionPolicy.java
+++ b/src/com/cyanogenmod/explorer/ui/policy/DeleteActionPolicy.java
@@ -262,9 +262,12 @@ public final class DeleteActionPolicy extends ActionsPolicy {
boolean failed = false;
try {
CommandHelper.getFileInfo(ctx, fso.getFullPath(), false, null);
-
- // Failed. The file still exists
- failed = true;
+ FileSystemObject fso2 =
+ CommandHelper.getFileInfo(ctx, fso.getFullPath(), false, null);
+ if (fso2 != null) {
+ // Failed. The file still exists
+ failed = true;
+ }
} catch (Throwable e) {
// Operation complete successfully
diff --git a/src/com/cyanogenmod/explorer/ui/policy/NewActionPolicy.java b/src/com/cyanogenmod/explorer/ui/policy/NewActionPolicy.java
index fd29fbe8..d92681ee 100644
--- a/src/com/cyanogenmod/explorer/ui/policy/NewActionPolicy.java
+++ b/src/com/cyanogenmod/explorer/ui/policy/NewActionPolicy.java
@@ -109,9 +109,7 @@ public final class NewActionPolicy extends ActionsPolicy {
FileSystemObject fso = null;
try {
fso = CommandHelper.getFileInfo(ctx, newName, false, null);
- } catch (Throwable ex2) {
- /**NON BLOCK**/
- }
+ } catch (Throwable ex2) {/**NON BLOCK**/}
onRequestRefreshListener.onRequestRefresh(fso);
}
showOperationSuccessMsg(ctx);
@@ -129,11 +127,8 @@ public final class NewActionPolicy extends ActionsPolicy {
if (onRequestRefreshListener != null) {
FileSystemObject fso = null;
try {
- fso =
- CommandHelper.getFileInfo(ctx, newName, false, null);
- } catch (Throwable ex2) {
- /**NON BLOCK**/
- }
+ fso = CommandHelper.getFileInfo(ctx, newName, false, null);
+ } catch (Throwable ex2) {/**NON BLOCK**/}
onRequestRefreshListener.onRequestRefresh(fso);
}
return Boolean.TRUE;
@@ -208,9 +203,7 @@ public final class NewActionPolicy extends ActionsPolicy {
FileSystemObject fso = null;
try {
fso = CommandHelper.getFileInfo(ctx, link, false, null);
- } catch (Throwable ex2) {
- /**NON BLOCK**/
- }
+ } catch (Throwable ex2) {/**NON BLOCK**/}
onRequestRefreshListener.onRequestRefresh(fso);
}
return Boolean.TRUE;
diff --git a/tests/src/com/cyanogenmod/explorer/commands/shell/LinkCommandTest.java b/tests/src/com/cyanogenmod/explorer/commands/shell/LinkCommandTest.java
index 2e0281bf..cf7e8a63 100644
--- a/tests/src/com/cyanogenmod/explorer/commands/shell/LinkCommandTest.java
+++ b/tests/src/com/cyanogenmod/explorer/commands/shell/LinkCommandTest.java
@@ -64,6 +64,7 @@ public class LinkCommandTest extends AbstractConsoleTest {
FileSystemObject fso =
CommandHelper.getFileInfo(getContext(), PATH_LINK_OK, false, getConsole());
assertTrue("response==false", ret); //$NON-NLS-1$
+ assertNotNull("fso==null", fso); //$NON-NLS-1$
assertTrue("fso not is Symlink", fso instanceof Symlink); //$NON-NLS-1$
} finally {
try {