You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/26 10:58:17 UTC

[tomcat] branch master updated: Correct regression that prevented loading config files from class path

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

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


The following commit(s) were added to refs/heads/master by this push:
     new e22624f  Correct regression that prevented loading config files from class path
e22624f is described below

commit e22624f976fe653bd9acb2ab3c14285f1c301d59
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 26 11:56:26 2019 +0100

    Correct regression that prevented loading config files from class path
---
 .../catalina/startup/CatalinaBaseConfigurationSource.java | 15 +++++++++------
 webapps/docs/changelog.xml                                |  8 ++++++++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
index 9c3e208..51b3b85 100644
--- a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
+++ b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
@@ -89,14 +89,17 @@ public class CatalinaBaseConfigurationSource implements ConfigurationSource {
         }
 
         // Try classloader
-        try(InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) {
-            if (stream != null) {
+        InputStream stream = getClass().getClassLoader().getResourceAsStream(name);
+        if (stream != null) {
+            try {
                 return new Resource(stream, getClass().getClassLoader().getResource(name).toURI());
+            } catch (InvalidPathException e) {
+                // Ignore. Some valid file URIs can trigger this.
+                stream.close();
+            } catch (URISyntaxException e) {
+                stream.close();
+                throw new IOException(sm.getString("catalinaConfigurationSource.cannotObtainURL", name), e);
             }
-        } catch (InvalidPathException e) {
-            // Ignore. Some valid file URIs can trigger this.
-        } catch (URISyntaxException e) {
-            throw new IOException(sm.getString("catalinaConfigurationSource.cannotObtainURL", name), e);
         }
 
         // Then try URI.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 63e4b12..840fecf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,6 +45,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.27 (markt)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Correct a regression introduced in 9.0.25 that prevented configuration
+        files from being loaded from the class path. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Coyote">
     <changelog>
       <fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org