[platform] better diagnostics for corrupted patch files (IDEA-247985)

GitOrigin-RevId: be0f30e29af50b5ecc7b7be56371c442539562d6
This commit is contained in:
Roman Shevchenko
2020-08-13 17:16:32 +00:00
committed by intellij-monorepo-bot
parent 00d58f3986
commit 8a25349b55
@@ -23,6 +23,7 @@ import java.io.IOException
import java.net.URL
import java.nio.file.Files
import java.nio.file.Paths
import java.util.zip.ZipException
import java.util.zip.ZipFile
import javax.swing.JComponent
import javax.swing.UIManager
@@ -61,11 +62,16 @@ internal object UpdateInstaller {
}
}
HttpRequests.request(url).gzip(false).saveToFile(patchFile, partIndicator)
ZipFile(patchFile).use {
if (it.getEntry(PATCH_FILE_NAME) == null || it.getEntry(UPDATER_ENTRY) == null) {
throw IOException("Corrupted patch file: ${patchFile.name}")
try {
ZipFile(patchFile).use {
if (it.getEntry(PATCH_FILE_NAME) == null || it.getEntry(UPDATER_ENTRY) == null) {
throw IOException("Corrupted patch file: ${patchFile.name}")
}
}
}
catch (e: ZipException) {
throw IOException("Corrupted patch file: ${patchFile.name}", e)
}
files += patchFile
}