This is an automated email from the ASF dual-hosted git repository.
dsoumis 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 6f6c134c53 Replace text blocks and pattern matching, they are not
supported in Java 11
6f6c134c53 is described below
commit 6f6c134c53e3bb46a1af84e3d259b9d793edbb87
Author: Dimitris Soumis <[email protected]>
AuthorDate: Tue Sep 2 16:17:26 2025 +0300
Replace text blocks and pattern matching, they are not supported in Java 11
---
.../TestStrictServletComplianceAttributes.java | 3 ++-
.../startup/TestXmlValidationUsingContext.java | 24 +++++++++-------------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git
a/test/org/apache/catalina/startup/TestStrictServletComplianceAttributes.java
b/test/org/apache/catalina/startup/TestStrictServletComplianceAttributes.java
index e8ad97aef3..40d780f78a 100644
---
a/test/org/apache/catalina/startup/TestStrictServletComplianceAttributes.java
+++
b/test/org/apache/catalina/startup/TestStrictServletComplianceAttributes.java
@@ -67,7 +67,8 @@ public class TestStrictServletComplianceAttributes extends
TomcatBaseTest {
Assert.assertFalse("All extension mapped servlets should be checked
against welcome files under STRICT_SERVLET_COMPLIANCE.",
ctx.isResourceOnlyServlet("jsp"));
Manager manager = ctx.getManager();
- if (manager instanceof ManagerBase managerBase) {
+ if (manager instanceof ManagerBase) {
+ ManagerBase managerBase = (ManagerBase) manager;
Assert.assertTrue("ManagerBase.sessionActivityCheck should be true
under STRICT", managerBase.getSessionActivityCheck());
Assert.assertTrue("ManagerBase.sessionLastAccessAtStart should be
true under STRICT", managerBase.getSessionLastAccessAtStart());
}
diff --git
a/test/org/apache/catalina/startup/TestXmlValidationUsingContext.java
b/test/org/apache/catalina/startup/TestXmlValidationUsingContext.java
index d55b9ff51f..3d0f1cf0ca 100644
--- a/test/org/apache/catalina/startup/TestXmlValidationUsingContext.java
+++ b/test/org/apache/catalina/startup/TestXmlValidationUsingContext.java
@@ -63,25 +63,21 @@ public class TestXmlValidationUsingContext extends
TomcatBaseTest {
private void writeValidXml(File webXml) throws IOException {
try (FileWriter fw = new FileWriter(webXml)) {
fw.write(
- """
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
-
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
- version="6.0">
- </web-app>
- """);
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<web-app
xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n" +
+ "
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+ "
xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee " +
+
"http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd\"\n" +
+ " version=\"4.0\">\n" +
+ "</web-app>");
}
}
private void writeInvalidXml(File webXml) throws IOException {
try (FileWriter fw = new FileWriter(webXml)) {
fw.write(
- """
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app>
- </web-app>
- """);
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<web-app>\n" +
+ "</web-app>");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]