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

commit 45584364950080dab0b6b66f3de44541f203a490
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Oct 19 20:26:52 2026 +0100

    Follow-on to "Skip parsing a context configuration file ..."
    
    Fix the same problem parsing web.xml files
---
 java/org/apache/catalina/startup/ContextConfig.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 7861e65fe4..2bb8b694bb 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2067,8 +2067,12 @@ public class ContextConfig implements LifecycleListener {
 
         try {
             stream = webXmlResource.getInputStream();
-            source = new InputSource(webXmlResource.getURI().toString());
             if (stream != null) {
+                // Only create the input source if the stream is available so
+                // that a source without a byte stream is never returned. The
+                // parser would otherwise try to resolve the URI itself and
+                // report the same problem a second time.
+                source = new InputSource(webXmlResource.getURI().toString());
                 source.setByteStream(stream);
             }
         } catch (Exception e) {


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

Reply via email to