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

Commit 57f69dce authored by jruesga's avatar jruesga
Browse files

Fix getFileInfo calls. The return of this function must be checked

parent 288ca4ca
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1227,6 +1227,9 @@ public class NavigationActivity extends Activity
        FileSystemObject fso = null;
        FileSystemObject fso = null;
        try {
        try {
            fso = CommandHelper.getFileInfo(this, path, false, null);
            fso = CommandHelper.getFileInfo(this, path, false, null);
            if (fso == null) {
                throw new NoSuchFileOrDirectory(path);
            }


        } catch (Exception e) {
        } catch (Exception e) {
            // Notify the user
            // Notify the user
+3 −0
Original line number Original line Diff line number Diff line
@@ -856,6 +856,9 @@ public class SearchActivity extends Activity
        FileSystemObject fso = null;
        FileSystemObject fso = null;
        try {
        try {
            fso = CommandHelper.getFileInfo(this, item.getFullPath(), false, null);
            fso = CommandHelper.getFileInfo(this, item.getFullPath(), false, null);
            if (fso == null) {
                throw new NoSuchFileOrDirectory(item.getFullPath());
            }


        } catch (Exception e) {
        } catch (Exception e) {
            // Notify the user
            // Notify the user
+21 −12
Original line number Original line Diff line number Diff line
@@ -406,16 +406,20 @@ public final class CompressActionPolicy extends ActionsPolicy {
                    throw this.mListener.mCause;
                    throw this.mListener.mCause;
                }
                }


                // Check that the operation was completed retrieving the extracted file or folder
                // Check that the operation was completed retrieving the compressed file or folder
                boolean failed = true;
                boolean failed = false;
                try {
                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
                    // Operation complete successfully
                    failed = false;


                } catch (Throwable e) {
                } catch (Throwable e) {
                    // Operation complete successfully
                    // Failed. The file or folder not exists
                    failed = true;
                }
                }
                if (failed) {
                if (failed) {
                    throw new ExecutionException(
                    throw new ExecutionException(
@@ -655,16 +659,21 @@ public final class CompressActionPolicy extends ActionsPolicy {
                    throw this.mListener.mCause;
                    throw this.mListener.mCause;
                }
                }


                // Check that the operation was completed retrieving the extracted file or folder
                // Check that the operation was completed retrieving the uncompressed
                boolean failed = true;
                // file or folder
                boolean failed = false;
                try {
                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
                    // Operation complete successfully
                    failed = false;


                } catch (Throwable e) {
                } catch (Throwable e) {
                    // Operation complete successfully
                    // Failed. The file or folder not exists
                    failed = true;
                }
                }
                if (failed) {
                if (failed) {
                    throw new ExecutionException(
                    throw new ExecutionException(
+6 −1
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import android.text.Html;
import android.text.Spanned;
import android.text.Spanned;


import com.cyanogenmod.explorer.R;
import com.cyanogenmod.explorer.R;
import com.cyanogenmod.explorer.console.NoSuchFileOrDirectory;
import com.cyanogenmod.explorer.console.RelaunchableException;
import com.cyanogenmod.explorer.console.RelaunchableException;
import com.cyanogenmod.explorer.listeners.OnRequestRefreshListener;
import com.cyanogenmod.explorer.listeners.OnRequestRefreshListener;
import com.cyanogenmod.explorer.listeners.OnSelectionListener;
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
                // Check that the operation was completed retrieving the fso modified
                FileSystemObject fso =
                        CommandHelper.getFileInfo(ctx, dst.getAbsolutePath(), false, null);
                        CommandHelper.getFileInfo(ctx, dst.getAbsolutePath(), false, null);
                if (fso == null) {
                    throw new NoSuchFileOrDirectory(dst.getAbsolutePath());
                }
            }
            }
        };
        };
        final BackgroundAsyncTask task = new BackgroundAsyncTask(ctx, callable);
        final BackgroundAsyncTask task = new BackgroundAsyncTask(ctx, callable);
+6 −3
Original line number Original line Diff line number Diff line
@@ -262,9 +262,12 @@ public final class DeleteActionPolicy extends ActionsPolicy {
                boolean failed = false;
                boolean failed = false;
                try {
                try {
                    CommandHelper.getFileInfo(ctx, fso.getFullPath(), false, null);
                    CommandHelper.getFileInfo(ctx, fso.getFullPath(), false, null);

                    FileSystemObject fso2 =
                            CommandHelper.getFileInfo(ctx, fso.getFullPath(), false, null);
                    if (fso2 != null) {
                        // Failed. The file still exists
                        // Failed. The file still exists
                        failed = true;
                        failed = true;
                    }


                } catch (Throwable e) {
                } catch (Throwable e) {
                    // Operation complete successfully
                    // Operation complete successfully
Loading