Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return false if remove failed #1028

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public void saveFolder(


public boolean removeFile(OCFile file, boolean removeDBData, boolean removeLocalCopy) {
boolean success = true;
boolean success = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry to say this change breaks the condition in line 497 for input parameters file != null && !file.isFolder() , removeDBData == false.

I'd say the easiest way to achieve what you want is with adding an else block in line 509.

if (file != null) {
if (file.isFolder()) {
success = removeFolder(file, removeDBData, removeLocalCopy);
Expand Down Expand Up @@ -512,7 +512,7 @@ public boolean removeFile(OCFile file, boolean removeDBData, boolean removeLocal


public boolean removeFolder(OCFile folder, boolean removeDBData, boolean removeLocalContent) {
boolean success = true;
boolean success = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, this breaks the condition in line 520 for input parameters folder != null && folder.isFolder(), removeDBData == false.

Once again, I'd go with an else block in line 523.

if (folder != null && folder.isFolder()) {
if (removeDBData && folder.getFileId() != -1) {
success = removeFolderInDb(folder);
Expand Down