This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 88cf076988 Fix failing test on Windows
88cf076988 is described below
commit 88cf0769884a79028d0ede8fc8a7c147826cf2d9
Author: Mark Thomas <[email protected]>
AuthorDate: Sat Nov 7 15:00:53 2026 +0000
Fix failing test on Windows
Co-authored by: Claude / Sonnet 5.5
---
test/org/apache/jasper/servlet/TestJspCServletContext.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/org/apache/jasper/servlet/TestJspCServletContext.java
b/test/org/apache/jasper/servlet/TestJspCServletContext.java
index 5e8bb425f3..9a747ff3f2 100644
--- a/test/org/apache/jasper/servlet/TestJspCServletContext.java
+++ b/test/org/apache/jasper/servlet/TestJspCServletContext.java
@@ -18,6 +18,7 @@ package org.apache.jasper.servlet;
import java.io.File;
import java.io.InputStream;
+import java.net.JarURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -25,6 +26,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import jakarta.servlet.descriptor.JspConfigDescriptor;
@@ -223,7 +225,11 @@ public class TestJspCServletContext {
URL url = context.getResource("/my file.jsp");
Assert.assertNotNull(url);
- try (InputStream is = url.openStream()) {
+ // The JarURLConnection caches the JarFile. Close it once finished
else, on Windows, the open file prevents
+ // the JAR being deleted during clean-up.
+ JarURLConnection connection = (JarURLConnection)
url.openConnection();
+ try (JarFile jarFile = connection.getJarFile(); InputStream is =
connection.getInputStream()) {
+ Assert.assertNotNull(jarFile);
Assert.assertEquals("<jsp/>",
new String(is.readAllBytes(), StandardCharsets.UTF_8));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]