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

BugFix - NPE internalFolderSyncTimestamp & File Existence Check #13612

Merged
merged 8 commits into from
Oct 4, 2024

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Sep 24, 2024

  • Tests written, or not not needed

Changes

  1. Fix the NullPointerException (NPE) for internalFolderSyncTimestamp.
  2. Check for file existence in the InternalTwoWaySyncWork worker; otherwise, it will throw an exception.

During my tests, I wasn’t able to reproduce the issue; however, some users with version 3.30.0 Final have already experienced the crash. It means some OCFile already saved into the internal storage via null value.

Potential fix could be in this PR:

Changing following set function, but I’m not sure.

ocFile.setInternalFolderSyncTimestamp(fileEntity.getInternalTwoWaySync()); ->

ocFile.setInternalFolderSyncTimestamp(nullToZero(fileEntity.getInternalTwoWaySync()));

To prevent further crashes, I checked nullability of the Long object and return non-null object. Alternative solution can be we can convert the Long object to long primitive type.

@superzanti
Copy link

Thank you!

This fixed it for me.

@superzanti superzanti mentioned this pull request Sep 24, 2024
1 task
@alperozturk96 alperozturk96 marked this pull request as draft September 25, 2024 07:04
@alperozturk96 alperozturk96 changed the title BugFix - NPE internalFolderSyncTimestamp BugFix - NPE internalFolderSyncTimestamp & File Existence Check Sep 25, 2024
@alperozturk96 alperozturk96 marked this pull request as ready for review September 25, 2024 10:22
@alperozturk96 alperozturk96 marked this pull request as draft September 27, 2024 07:04
@tobiasKaminsky
Copy link
Member

Draft or ready to review? 🙈

@alperozturk96
Copy link
Collaborator Author

@tobiasKaminsky We have to test two-way sync properly before merge this PR, so it's a draft.

@alperozturk96 alperozturk96 marked this pull request as ready for review September 30, 2024 12:14
@alperozturk96 alperozturk96 marked this pull request as draft September 30, 2024 12:14
@alperozturk96 alperozturk96 force-pushed the bugfix/npe-isInternalFolderSync branch from 51fbb8f to f90daae Compare October 2, 2024 10:11
Signed-off-by: alperozturk <[email protected]>
Copy link

github-actions bot commented Oct 2, 2024

Codacy

Lint

TypemasterPR
Warnings5959
Errors33

SpotBugs

CategoryBaseNew
Bad practice6464
Correctness6363
Dodgy code296296
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness66
Performance5353
Security1818
Total509509

@miltuss
Copy link

miltuss commented Oct 2, 2024

Hello, can you publish this fix as quickly as possible in the Fdroid repository via an update?

How long will the waiting time be?

@tobiasKaminsky
Copy link
Member

/backport to stable-3.30

@tobiasKaminsky tobiasKaminsky merged commit 6d996f1 into master Oct 4, 2024
21 checks passed
@tobiasKaminsky tobiasKaminsky deleted the bugfix/npe-isInternalFolderSync branch October 4, 2024 05:51
@miltuss
Copy link

miltuss commented Oct 5, 2024

/backport to stable-3.30

Is this fix now available on Fdroid?

@callmemagnus
Copy link

Can we expect information updates on the release of this fix to the production app?

Currently the fdroid version is 3.30.0 so I guess the fix is not there. Gplay version is 3.29.x so I don't know if it has the issue.

I know how these kinds of questions are annoying but the issue is rendering the app pretty difficult to use.

@joshtrichards joshtrichards added this to the Nextcloud App 3.31.0 milestone Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants