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

Fixed Null Pointer Exception when downloading a drive doc/sheet that … #26

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

brettbatie
Copy link
Contributor

…exists on the local machine.

It appears that remote Google docs and sheet return a file size of 0. So, when comparing the sizes the local (converted to Open Office) document will always have a different size than the local copy. This causes the performChecksumCheck() to return null on the remote file, throws an exception and then skips the file. Since we don't know for sure if the remote file is different than the local file, I think it would be better to download the file again.

Another enhancement could be an additional parameter --only-check-last-modified so that the file size and checksum are not also validated. This would prevent downloading files that have the same modification date (but could potentially be different).

Here is the stack trace that this commit fixes:

2018-07-24 09:32:01 FINE jdrivesync.sync.Synchronization$2 processRemoteChildFound(): Skipping file '/MyFile because reading local file attributes failed: null
java.lang.NullPointerException
	at jdrivesync.sync.Synchronization$2.performChecksumCheck(Synchronization.java:493)
	at jdrivesync.sync.Synchronization$2.processRemoteChildFound(Synchronization.java:463)
	at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:337)
	at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
	at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
	at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
	at jdrivesync.App.sync(App.java:89)
	at jdrivesync.App.run(App.java:54)
	at jdrivesync.App.main(App.java:27)

@siom79 siom79 merged commit 0da301a into siom79:master Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants