This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
commit 984be4b2878386d8a4f3f3111683b864f782daeb Author: Mark Thomas <[email protected]> AuthorDate: Wed Nov 12 12:14:21 2025 +0000 When converting a file in an archive, update the last modified time Based on PR #78 by Semiao Marco --- CHANGES.md | 1 + src/main/java/org/apache/tomcat/jakartaee/Migration.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f9e8912..e83616e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## 1.0.10 - When migrating files in place, don't replace the original file if no conversion has taken place. Based on PR[#78] by Semiao Marco. +- When converting a file in an archive, update the last modified time for that archive entry. Based on PR[#78] by Semiao Marco. ## 1.0.9 - Update the JaCoCo Maven plugin to 0.8.12. (dependabot/markt) diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java index 2242453..00fa3eb 100644 --- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java +++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java @@ -24,6 +24,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.attribute.FileTime; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; @@ -333,6 +334,9 @@ public class Migration { destZipEntry.setName(destName); destZipEntry.setSize(tempBuffer.size()); destZipEntry.setCrc(crc32.getValue()); + if (convertedStream) { + destZipEntry.setLastModifiedTime(FileTime.fromMillis(System.currentTimeMillis())); + } destZipStream.putArchiveEntry(destZipEntry); tempBuffer.writeTo(destZipStream); destZipStream.closeArchiveEntry(); @@ -342,6 +346,9 @@ public class Migration { destZipEntry.setName(destName); destZipStream.putArchiveEntry(destZipEntry); convertedStream = migrateStream(srcName, srcZipStream, destZipStream); + if (convertedStream) { + destZipEntry.setLastModifiedTime(FileTime.fromMillis(System.currentTimeMillis())); + } destZipStream.closeArchiveEntry(); } convertedArchive = convertedArchive || convertedStream; @@ -376,8 +383,11 @@ public class Migration { destZipEntry.setName(destName); destZipStream.putArchiveEntry(destZipEntry); boolean convertedStream = migrateStream(srcName, srcZipFile.getInputStream(srcZipEntry), destZipStream); - convertedArchive = convertedArchive || convertedStream; + if (convertedStream) { + destZipEntry.setLastModifiedTime(FileTime.fromMillis(System.currentTimeMillis())); + } destZipStream.closeArchiveEntry(); + convertedArchive = convertedArchive || convertedStream; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
