Close unfinished archive entries on error
Otherwise the underlying error is hidden by an "IOException: This archives contains unclosed entries." when jgit tries to close the archive. Reported-by: Dave Borowitz <dborowitz@google.com> Change-Id: I594dcdf366200b802e13e5a645fe06597feb7bb4 Signed-off-by: Jonathan Nieder <jrn@google.com>
This commit is contained in:
parent
459fd7d4bb
commit
75d9b31f14
|
@ -93,8 +93,11 @@ public void putEntry(ArchiveOutputStream out,
|
||||||
}
|
}
|
||||||
entry.setSize(loader.getSize());
|
entry.setSize(loader.getSize());
|
||||||
out.putArchiveEntry(entry);
|
out.putArchiveEntry(entry);
|
||||||
loader.copyTo(out);
|
try {
|
||||||
out.closeArchiveEntry();
|
loader.copyTo(out);
|
||||||
|
} finally {
|
||||||
|
out.closeArchiveEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<String> suffixes() {
|
public Iterable<String> suffixes() {
|
||||||
|
|
|
@ -82,8 +82,11 @@ public void putEntry(ArchiveOutputStream out,
|
||||||
}
|
}
|
||||||
entry.setSize(loader.getSize());
|
entry.setSize(loader.getSize());
|
||||||
out.putArchiveEntry(entry);
|
out.putArchiveEntry(entry);
|
||||||
loader.copyTo(out);
|
try {
|
||||||
out.closeArchiveEntry();
|
loader.copyTo(out);
|
||||||
|
} finally {
|
||||||
|
out.closeArchiveEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<String> suffixes() {
|
public Iterable<String> suffixes() {
|
||||||
|
|
Loading…
Reference in New Issue