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

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


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

commit b7d5b268c491467ea043e95f5542d70298a650dd
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     | 26 ++++++++++++++++++++--
 webapps/docs/changelog.xml                         |  4 ++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/web/WebXml.java 
b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
index 2c69dd8192..a599b8bf16 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebXml.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
@@ -393,7 +393,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 = 2;
 
     /**
      * 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 4acb244fa0..fa45383d1f 100644
--- a/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
+++ b/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
@@ -198,7 +198,29 @@ public class TestWebXml {
         doTestValidateVersion("6.2");
     }
 
+    @Test
+    public void testValidateVersion63() 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.3", "6.2");
+    }
+
+    @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.2");
+    }
+
     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
@@ -230,8 +252,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 8adc909999..e40692ae48 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -351,6 +351,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