[updater] diagnostics; protection against accidental overwriting of patches

GitOrigin-RevId: a490be7c73db7fe0082825b5a873955e768cabeb
This commit is contained in:
Roman Shevchenko
2022-07-11 13:09:23 +02:00
committed by intellij-monorepo-bot
parent bcbabd5a90
commit 3e2ee4a590

View File

@@ -112,6 +112,9 @@ public class Runner {
jarFile = resolveJarFile();
}
LOG.info("args: " + Arrays.toString(args));
LOG.info(".jar: " + jarFile);
if (args.length >= 6 && "create".equals(args[0])) {
String oldVersionDesc = args[1];
String newVersionDesc = args[2];
@@ -121,7 +124,6 @@ public class Runner {
checkCaseSensitivity(newFolder);
LOG.info("args: " + Arrays.toString(args));
LOG.info("case-sensitive: " + ourCaseSensitiveFs);
boolean binary = hasArgument(args, "zip_as_binary");
@@ -182,7 +184,6 @@ public class Runner {
checkCaseSensitivity(destDirectory.toString());
LOG.info("args: " + Arrays.toString(args));
LOG.info("destination: " + destPath + " (" + destDirectory + "), case-sensitive: " + ourCaseSensitiveFs);
UpdaterUI ui;
@@ -213,6 +214,7 @@ public class Runner {
}
else {
printUsage();
System.exit(1);
}
}
@@ -312,7 +314,7 @@ public class Runner {
LOG.info("Packing JAR file: " + spec.getPatchFile());
ui.startProcess("Packing JAR file '" + spec.getPatchFile() + "'...");
try (ZipOutputWrapper out = new ZipOutputWrapper(Files.newOutputStream(Paths.get(spec.getPatchFile())));
try (ZipOutputWrapper out = new ZipOutputWrapper(Files.newOutputStream(Paths.get(spec.getPatchFile()), StandardOpenOption.CREATE_NEW));
ZipInputStream in = new ZipInputStream(Files.newInputStream(Paths.get(spec.getJarFile())))) {
ZipEntry e;
while ((e = in.getNextEntry()) != null) {