Thread Crash on upload only config
zachthedev opened this issue ยท 4 comments
First off, thanks for adding SFTP.
Here is the relevant part of my config, I don't think anything else really matters for this error.
- path: "world"
format: "'Backup-world-'yyyy-M-d--HH-mm'.zip'"
create: false
I am using a scheduled backup and the interval backup, and it goes to SFTP. I wan't to skip the local backup and just upload it. So I made the 'create' false. Once I did that, the console started throwing a thread exception: "NullPointerException".
I am not great with java, so I couldn't nail down why it was null, but I did some poking around in the code.
Looking at your code in file "UploadThread.java". It skips the 'create' config if statement, since it is false. So it should be going to the next statement, which is below.
try {
if (Config.isGoogleEnabled()) {
MessageUtil.sendConsoleMessage("Uploading file to Google Drive");
timer.start();
googleDriveUploader.uploadFile(file, type);
timer.end();
MessageUtil.sendConsoleMessage(timer.getUploadTimeMessage(file));
}
if (Config.isOnedriveEnabled()) {
MessageUtil.sendConsoleMessage("Uploading file to OneDrive");
timer.start();
oneDriveUploader.uploadFile(file, type);
timer.end();
MessageUtil.sendConsoleMessage(timer.getUploadTimeMessage(file));
}
if (Config.isFtpEnabled()) {
MessageUtil.sendConsoleMessage("Uploading file to FTP");
timer.start();
FTPUploader.uploadFile(file, type);
timer.end();
MessageUtil.sendConsoleMessage(timer.getUploadTimeMessage(file));
}
FileUtil.deleteFiles(type, format);
} catch (Exception e) {
MessageUtil.sendConsoleException(e);
}
Looking at that, it looks like the check for FTP is missing the line STFPUploader.uploadFile(file, type);
Since I am not using SFTP, but SFTP.
I guess I am way off base, since there is a check for that in the FTPUploader.java
if (Config.isFtpSftp()) {
SFTPUploader.uploadFile(file, type);
return;
}
I have gotten a backup to work when "create" was set to true. It uploaded to the remote server and deleted the local copy. But looking at your config notes, it should be able to skip the local backup and just upload it straight away.
Any help would be greatly appreciated.
Another thing to note, there seems to be a bug when not using GDrive or OneDrive.
[13:19:01 WARN]: Unexpected token END OF FILE at position 0.
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:257)
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:81)
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:75)
[13:19:01 WARN]: at ratismal.drivebackup.googledrive.GoogleDriveUploader.setRefreshTokenFromStoredValue(GoogleDriveUploader.java:158)
[13:19:01 WARN]: at ratismal.drivebackup.googledrive.GoogleDriveUploader.<init>(GoogleDriveUploader.java:143)
[13:19:01 WARN]: at ratismal.drivebackup.UploadThread.run(UploadThread.java:55)
[13:19:01 WARN]: at java.lang.Thread.run(Thread.java:748)
[13:19:01 WARN]: Unexpected token END OF FILE at position 0.
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:257)
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:81)
[13:19:01 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:75)
[13:19:01 WARN]: at ratismal.drivebackup.onedrive.OneDriveUploader.setRefreshTokenFromStoredValue(OneDriveUploader.java:142)
[13:19:01 WARN]: at ratismal.drivebackup.onedrive.OneDriveUploader.<init>(OneDriveUploader.java:126)
[13:19:01 WARN]: at ratismal.drivebackup.UploadThread.run(UploadThread.java:56)
[13:19:01 WARN]: at java.lang.Thread.run(Thread.java:748)
It goes away when "suppress-errors" is true, but that might also be something to fix.
Hi!
Setting create
to false tells the plugin to not create a backup for that path, and instead back up a zip backup created by another plugin in the "backup-folder
/path
" folder. Since there isn't a zip file at that location, a NullPointerException
is thrown.
By default, after a backup is uploaded, it is deleted locally, but you can change this with the local-keep-count
setting.
The documentation still is a little confusing, I'll try to improve it in future versions. I also need to add more error messages so people won't have to dig through the code to see what they did wrong.
Let me know if this helps!
Ah ok, that makes sense.
Yeah, a clarification on the documentation would be helpful. Even something using the built-in GitHub wiki that explains each setting more in detail than the yml file.
As to the other error you were experiencing, it was supposed to have been fixed in the 1.1.0 release but obviously wasn't.
I just committed a fix that should be in the next release.
@MaxMaeder Sweet, you rock! Thanks man