tgxn / Backup

A Backup plugin for the Bukkit Server API.
http://bukkitbackup.com
GNU General Public License v3.0
23 stars 14 forks source link

NullPointer exception after each backup #28

Closed iarspider closed 13 years ago

iarspider commented 13 years ago

Backup 1.8.3-dev on Bukkit 1337:


00:26:54 [INFO] java.lang.NullPointerException
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.cleanFold
er(BackupTask.java:381)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.deleteOld
Backups(BackupTask.java:364)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.backup(Ba
ckupTask.java:300)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.run(Backu
pTask.java:87)
00:26:54 [INFO]         at org.bukkit.craftbukkit.scheduler.CraftWorker.run(Craf
tWorker.java:34)
00:26:54 [INFO]         at java.lang.Thread.run(Unknown Source)
00:26:54 [INFO] java.lang.NullPointerException
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.cleanFold
er(BackupTask.java:381)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.deleteOld
Backups(BackupTask.java:364)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.backup(Ba
ckupTask.java:300)
00:26:54 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.run(Backu
pTask.java:87)
00:26:54 [INFO]         at org.bukkit.craftbukkit.scheduler.CraftWorker.run(Craf
tWorker.java:34)
00:26:54 [INFO]         at java.lang.Thread.run(Unknown Source)
tgxn commented 13 years ago

Thanks for the report.

Can you provide your config file, thanks. :)

tgxn commented 13 years ago

I Have added a catch exception to this class, should fix the issue.

I could not reproduce it, but give the latest build a go: http://ci.tgxn.net/job/dev-Backup/18/

iarspider commented 13 years ago

Config file: http://pastebin.com/410bVi5M The error is still there


11:21:38 [INFO] java.lang.NullPointerException
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.cleanFolder(BackupTask.java:416)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.deleteOldBackups(BackupTask.java:381)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.backup(BackupTask.java:308)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.run(BackupTask.java:83)
11:21:38 [INFO]         at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
11:21:38 [INFO] java.lang.NullPointerException
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.cleanFolder(BackupTask.java:416)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.deleteOldBackups(BackupTask.java:381)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.backup(BackupTask.java:308)
11:21:38 [INFO]         at net.tgxn.bukkit.backup.threading.BackupTask.run(BackupTask.java:83)
11:21:38 [INFO]         at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
11:21:38 [INFO]         at java.lang.Thread.run(Unknown Source)
lycano commented 13 years ago
        // Store all backup files in an array.
        File[] filesList = backupDir.listFiles();

        // If the amount of files exceeds the max backups to keep.
        if (filesList.length > maxBackups) {

This is from L416 in BackupTask.java

"Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs."

Throws: SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the directory

To fix this we have to throw a custom Exception after checking fileList against null.

if (fileList == null) throw new BackupInvalidDirectory("Directory not found or I/O Error occured)

something like that =)

iarspider commented 13 years ago

I have checked the folder, and backups are indeed performed fine (and temporary folder is removed correctly). Only the backup cleanup is not performed correctly. I have "Full control" over the backup folder. So, probably the path to backup dir is different in creation and removal code?

lycano commented 13 years ago

@iarspider (according to your config file you do use v1.8. [..]) Edit: okay i was wrong about auto version update sry ;) Have to open an issue about this and implement an update manager ^^

iarspider commented 13 years ago

1.8.3-dev (as fetched by CraftBukkitUpToDate)

lycano commented 13 years ago

Thanks, we have to check that ... also i dont get the throws Exception declaration in the methods signature and in body of cleanFolder() ... anysways should be fixed soon.

tgxn commented 13 years ago

Cheers lycano! Ill try to push a fix tonight.

tgxn commented 13 years ago

Fixed.