This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 2cdbe31ae7 Review "Restore the original archive when normalising the
timestamps..."
2cdbe31ae7 is described below
commit 2cdbe31ae7a24a25506439e3fb893fd19415da22
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 18:16:05 2026 +0000
Review "Restore the original archive when normalising the timestamps..."
Extend the restore to unchecked exception path
---
java/org/apache/tomcat/buildutil/RepeatableArchive.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/buildutil/RepeatableArchive.java
b/java/org/apache/tomcat/buildutil/RepeatableArchive.java
index 81c36b2059..57012136de 100644
--- a/java/org/apache/tomcat/buildutil/RepeatableArchive.java
+++ b/java/org/apache/tomcat/buildutil/RepeatableArchive.java
@@ -140,8 +140,9 @@ public class RepeatableArchive extends Task {
throw new BuildException("setLastModified failed for
[" + archive.getAbsolutePath() + "]");
}
Files.delete(oldArchive.toPath());
- } catch (IOException ioe) {
- // The task did not run to completion for this archive. If
the original was
+ } catch (IOException | RuntimeException e) {
+ // The task did not run to completion for this archive.
This includes the
+ // BuildException thrown when the timestamp cannot be set.
If the original was
// renamed, restore it rather than leaving the archive in
its current, possibly
// truncated, state together with a stray ".old".
try {
@@ -150,9 +151,12 @@ public class RepeatableArchive extends Task {
StandardCopyOption.ATOMIC_MOVE);
}
} catch (IOException restoreException) {
- ioe.addSuppressed(restoreException);
+ e.addSuppressed(restoreException);
}
- throw new BuildException(ioe);
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ }
+ throw new BuildException(e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]