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 2020/05/21 09:32:53 UTC
[tomcat] branch 9.0.x updated: Correct regression in loading of
config files via URIs on Windows.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 3756bc6 Correct regression in loading of config files via URIs on Windows.
3756bc6 is described below
commit 3756bc6a90576f06802669fd5454b21412a88809
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu May 21 10:32:10 2020 +0100
Correct regression in loading of config files via URIs on Windows.
---
.../startup/CatalinaBaseConfigurationSource.java | 20 ++++++++++++--------
webapps/docs/changelog.xml | 4 ++++
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
index 53fb91f..51615bb 100644
--- a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
+++ b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
@@ -90,17 +90,21 @@ public class CatalinaBaseConfigurationSource implements ConfigurationSource {
}
// Try classloader
- InputStream stream = getClass().getClassLoader().getResourceAsStream(name);
- if (stream != null) {
- try {
+ InputStream stream = null;
+ try {
+ stream = getClass().getClassLoader().getResourceAsStream(name);
+ if (stream != null) {
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) {
+ }
+ } catch (InvalidPathException e) {
+ // Ignore. Some valid file URIs can trigger this.
+ // Stream should be null here but check to be on the safe side.
+ if (stream != null) {
stream.close();
- throw new IOException(sm.getString("catalinaConfigurationSource.cannotObtainURL", name), e);
}
+ } catch (URISyntaxException e) {
+ stream.close();
+ 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 7011281..d7a6873 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -60,6 +60,10 @@
Add the special internal rewrite maps for case modification and
escaping. (remm/fschumacher)
</update>
+ <fix>
+ Correct a regression in an earlier fix that broke the loading of
+ configuration files such as keystores via URIs on Windows. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org