gravitylow / Updater

Easy automatic updates for Bukkit
MIT License
35 stars 41 forks source link

java.util.zip.ZipException: error in opening zip file #11

Open lycano opened 10 years ago

lycano commented 10 years ago

Full Stacktrace and references as i the code lines do not match (logic still is the same)

23:51:50 [WARNING] [xAuth] The auto-updater tried to unzip a new update file, but was unsuccessful.
23:51:50 [SEVERE] java.util.zip.ZipException: error in opening zip file
23:51:50 [SEVERE]       at java.util.zip.ZipFile.open(Native Method)
23:51:50 [SEVERE]       at java.util.zip.ZipFile.<init>(ZipFile.java:127)
23:51:51 [SEVERE]       at de.luricos.bukkit.xAuth.updater.Updater.unzip(Updater.java:471)
23:51:51 [SEVERE]       at de.luricos.bukkit.xAuth.updater.Updater.saveFile(Updater.java:362)
23:51:51 [SEVERE]       at de.luricos.bukkit.xAuth.updater.Updater.access$1000(Updater.java:66)
23:51:51 [SEVERE]       at de.luricos.bukkit.xAuth.updater.Updater$UpdateRunnable.run(Updater.java:688)
23:51:51 [SEVERE]       at java.lang.Thread.run(Thread.java:662)

de.luricos.bukkit.xAuth.updater.Updater$UpdateRunnable.run(Updater.java:688)
Updater.this.saveFile(new File(Updater.this.plugin.getDataFolder().getParent(), Updater.this.updateFolder), name, Updater.this.versionLink);

de.luricos.bukkit.xAuth.updater.Updater.access$1000(Updater.java:66)
public class Updater {

de.luricos.bukkit.xAuth.updater.Updater.saveFile(Updater.java:362)
this.unzip(dFile.getCanonicalPath());

de.luricos.bukkit.xAuth.updater.Updater.unzip(Updater.java:471)
ZipFile zipFile = new ZipFile(fSourceZip);
or
ZipFile zipFile = new ZipFile(fSourceZip, ZipFile.OPEN_READ);

OS: Linux Debian

When downloading the file from DBO the file will be deleted before it can be unzipped.

To fix this you need to move the cleanup code block to the top.

As my pull request does include more fixes and additions no pull request attached to this bug.