mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Updater: do not create a patch file in the temp dir until it is not fully downloaded (IDEA-82564) (cherry picked from commit caa341f)
This commit is contained in:
+8
-15
@@ -613,13 +613,13 @@ public final class UpdateChecker {
|
||||
OutputStream out = null;
|
||||
|
||||
String platform = PlatformUtils.getPlatformPrefix();
|
||||
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
|
||||
File patchFile = new File(FileUtil.getTempDirectory(), patchFileName);
|
||||
|
||||
File tempFile = FileUtil.createTempFile(platform, "patch", true);
|
||||
|
||||
try {
|
||||
connection = new URL(new URL(getPatchesUrl()), fileName).openConnection();
|
||||
in = UrlConnectionUtil.getConnectionInputStreamWithException(connection, i);
|
||||
out = new BufferedOutputStream(new FileOutputStream(patchFile));
|
||||
out = new BufferedOutputStream(new FileOutputStream(tempFile));
|
||||
|
||||
i.setIndeterminate(false);
|
||||
|
||||
@@ -636,23 +636,16 @@ public final class UpdateChecker {
|
||||
i.setText2((read / 1024) + "/" + (total / 1024) + " KB");
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
patchFile.delete();
|
||||
throw e;
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
patchFile.delete();
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
patchFile.delete();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally {
|
||||
if (out != null) out.close();
|
||||
if (in != null) in.close();
|
||||
if (connection instanceof HttpURLConnection) ((HttpURLConnection)connection).disconnect();
|
||||
}
|
||||
|
||||
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
|
||||
File patchFile = new File(FileUtil.getTempDirectory(), patchFileName);
|
||||
FileUtil.copy(tempFile, patchFile);
|
||||
FileUtil.delete(tempFile);
|
||||
}
|
||||
|
||||
public static Set<String> getDisabledToUpdatePlugins() {
|
||||
|
||||
Reference in New Issue
Block a user