This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 26ca80c484 Default weblxml version should be current Servlet spec 
version
26ca80c484 is described below

commit 26ca80c484f746b2e74dc358b6959a557898187c
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jun 8 13:39:36 2026 +0100

    Default weblxml version should be current Servlet spec version
---
 .../apache/tomcat/util/descriptor/web/WebXml.java  |  2 +-
 .../tomcat/util/descriptor/web/TestWebXml.java     | 28 +++++++++++++++++++---
 webapps/docs/changelog.xml                         |  4 ++++
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/web/WebXml.java 
b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
index f726b6b44a..8f488da5e2 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebXml.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
@@ -389,7 +389,7 @@ public class WebXml extends XmlEncodingBase implements 
DocumentProperties.Charse
 
     // Derived major and minor version attributes
     private int majorVersion = 6;
-    private int minorVersion = 0;
+    private int minorVersion = 1;
 
     /**
      * Returns the major version number.
diff --git a/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java 
b/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
index 1109d81ad3..2a71b6aefb 100644
--- a/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
+++ b/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
@@ -48,7 +48,7 @@ public class TestWebXml {
 
         // Defaults
         Assert.assertEquals(6, webxml.getMajorVersion());
-        Assert.assertEquals(0, webxml.getMinorVersion());
+        Assert.assertEquals(1, webxml.getMinorVersion());
 
         // Both get changed
         webxml.setVersion("2.5");
@@ -193,7 +193,29 @@ public class TestWebXml {
         doTestValidateVersion("6.1");
     }
 
+    @Test
+    public void testValidateVersion62() throws IOException, SAXException {
+        /*
+         * Partly here to test behaviour on invalid versions. Partly here as a 
reminder to update the tests when adding
+         * support for a new Servlet version.
+         */
+        doTestValidateVersion("6.2", "6.1");
+    }
+
+    @Test
+    public void testValidateVersion70() throws IOException, SAXException {
+        /*
+         * Partly here to test behaviour on invalid versions. Partly here as a 
reminder to update the tests when adding
+         * support for a new Servlet version.
+         */
+        doTestValidateVersion("7.0", "6.1");
+    }
+
     private void doTestValidateVersion(String version) throws IOException, 
SAXException {
+        doTestValidateVersion(version, version);
+    }
+
+    private void doTestValidateVersion(String version, String expected) throws 
IOException, SAXException {
         WebXml webxml = new WebXml();
 
         // Special cases
@@ -225,8 +247,8 @@ public class TestWebXml {
         Assert.assertEquals(0, handler.getErrors().size());
         Assert.assertEquals(0, handler.getWarnings().size());
 
-        Assert.assertEquals(version, webxml.getVersion());
-        Assert.assertEquals(version, webxmlResult.getVersion());
+        Assert.assertEquals(expected, webxml.getVersion());
+        Assert.assertEquals(expected, webxmlResult.getVersion());
     }
 
     // A simplified copy of ContextConfig.getDefaultWebXmlFragment().
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 92c72237e9..af3540311e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -255,6 +255,10 @@
         mod_rewrite, which follows a purely sequential evaluation strategy.
         (remm)
       </fix>
+      <fix>
+        Update default web.xml version to match supported Servlet specification
+        version. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to