diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java index 23f4beda1..cd98c0339 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java @@ -93,8 +93,11 @@ public class TarFormat implements ArchiveCommand.Format { } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); - loader.copyTo(out); - out.closeArchiveEntry(); + try { + loader.copyTo(out); + } finally { + out.closeArchiveEntry(); + } } public Iterable suffixes() { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java index 00c962bc9..be7264bd8 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java @@ -82,8 +82,11 @@ public class ZipFormat implements ArchiveCommand.Format { } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); - loader.copyTo(out); - out.closeArchiveEntry(); + try { + loader.copyTo(out); + } finally { + out.closeArchiveEntry(); + } } public Iterable suffixes() {