fix: extract Classic server zip after download completes#239
Closed
bouclem wants to merge 2 commits into
Closed
Conversation
Extraction was attempted in the constructor right after only queueing the download, so the zip didn't exist yet on disk and a NoSuchFileException was thrown and silently swallowed. Move the extract step to run at the end of performDownload, once the zip has actually been written. Fixes MCPHackers#221
623eaae to
f210471
Compare
f210471 to
9b860b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #221
Problem
When setting up a Classic server version,
DownloadData's constructor callsFileUtil.extractByExtension(...)onminecraft_server.zipimmediately afterqueueDownload(...). ButqueueDownloadonly adds the entry to a queue - the actual download happens later, whenperformDownload(...)is called fromTaskSetup/TaskUpdateLibraries.So the extraction runs against a file that does not exist yet and throws
NoSuchFileException. The exception is swallowed byprintStackTrace, the constructor finishes, the zip later gets downloaded, but nothing ever extracts it. The user has to runcleanupand re-setup to get a working server.Fix
.zipserver artifact is detected.extractByExtension+Files.movestep to run at the end ofperformDownload(...), after the zip has actually been written to disk.printStackTrace; theIOExceptionnow propagates like every other error inperformDownload.Behavior for non-Classic versions (where
serverArtifact.urldoes not end with.zip) is unchanged.Testing
gradlew compileJava- clean build, no new warnings.