From a5eb6d055738bfcd4a393d630f46613d7ef0f425 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 27 Jul 2018 18:40:30 +0200 Subject: [PATCH] Cleanup (inlines single-use method) --- updater/src/com/intellij/updater/BaseUpdateAction.java | 7 ------- updater/src/com/intellij/updater/UpdateAction.java | 5 ++++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/updater/src/com/intellij/updater/BaseUpdateAction.java b/updater/src/com/intellij/updater/BaseUpdateAction.java index 846a2f8dd934..58f8c8e811a9 100644 --- a/updater/src/com/intellij/updater/BaseUpdateAction.java +++ b/updater/src/com/intellij/updater/BaseUpdateAction.java @@ -120,13 +120,6 @@ public abstract class BaseUpdateAction extends PatchAction { } } - protected void writeDiff(File olderFile, File newerFile, OutputStream patchOutput) throws IOException { - try (BufferedInputStream olderFileIn = new BufferedInputStream(Utils.newFileInputStream(olderFile, myPatch.isNormalized())); - BufferedInputStream newerFileIn = new BufferedInputStream(new FileInputStream(newerFile))) { - writeDiff(olderFileIn, newerFileIn, patchOutput); - } - } - protected void writeDiff(InputStream olderFileIn, InputStream newerFileIn, OutputStream patchOutput) throws IOException { Runner.logger().info("writing diff"); ByteArrayOutputStream diffOutput = new OpenByteArrayOutputStream(); diff --git a/updater/src/com/intellij/updater/UpdateAction.java b/updater/src/com/intellij/updater/UpdateAction.java index 02905b4ada1f..b7770109e323 100644 --- a/updater/src/com/intellij/updater/UpdateAction.java +++ b/updater/src/com/intellij/updater/UpdateAction.java @@ -27,7 +27,10 @@ public class UpdateAction extends BaseUpdateAction { FileType type = getFileType(newerFile); if (type == FileType.SYMLINK) throw new IOException("Unexpected symlink: " + newerFile); writeFileType(patchOutput, type); - writeDiff(olderFile, newerFile, patchOutput); + try (BufferedInputStream olderFileIn = new BufferedInputStream(Utils.newFileInputStream(olderFile, myPatch.isNormalized())); + BufferedInputStream newerFileIn = new BufferedInputStream(new FileInputStream(newerFile))) { + writeDiff(olderFileIn, newerFileIn, patchOutput); + } patchOutput.closeEntry(); }