This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 91fe2d762e3694b7ff2bd5f651f0d4e40c8c41ea Author: opencode <[email protected]> AuthorDate: Tue Oct 20 13:27:44 2026 +0200 Close the per-entry stream when normalising archive timestamps ZipFile.getInputStream() returns a new stream for every entry and each stream holds an Inflater until it is closed or the ZipFile is closed. The entry copy loop never closed the per-entry stream, so these native resources accumulated for the lifetime of the archive rewrite. Copy each entry inside a try-with-resources block so the stream is released as soon as the entry has been written. --- java/org/apache/tomcat/buildutil/RepeatableArchive.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/org/apache/tomcat/buildutil/RepeatableArchive.java b/java/org/apache/tomcat/buildutil/RepeatableArchive.java index 761976d165..81c36b2059 100644 --- a/java/org/apache/tomcat/buildutil/RepeatableArchive.java +++ b/java/org/apache/tomcat/buildutil/RepeatableArchive.java @@ -127,11 +127,11 @@ public class RepeatableArchive extends Task { zipOut.putNextEntry(entry); - InputStream is = oldZipFile.getInputStream(oldEntry); - - int numRead; - while ((numRead = is.read(buf)) >= 0) { - zipOut.write(buf, 0, numRead); + try (InputStream is = oldZipFile.getInputStream(oldEntry)) { + int numRead; + while ((numRead = is.read(buf)) >= 0) { + zipOut.write(buf, 0, numRead); + } } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
