You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/12/16 23:35:33 UTC
[tomcat] branch master updated: Expand temporary default source to
cover URIs
This is an automated email from the ASF dual-hosted git repository.
remm 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 0f60790 Expand temporary default source to cover URIs
0f60790 is described below
commit 0f607902e82557bc9007a70e858b33014f7f96c3
Author: remm <re...@apache.org>
AuthorDate: Tue Dec 17 00:35:15 2019 +0100
Expand temporary default source to cover URIs
The memory DB actually used a URL.
---
java/org/apache/tomcat/util/file/ConfigurationSource.java | 13 ++++++++++++-
test/org/apache/catalina/users/MemoryUserDatabaseTests.java | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/tomcat/util/file/ConfigurationSource.java b/java/org/apache/tomcat/util/file/ConfigurationSource.java
index 43d5a25..38228f9 100644
--- a/java/org/apache/tomcat/util/file/ConfigurationSource.java
+++ b/java/org/apache/tomcat/util/file/ConfigurationSource.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
/**
* Abstracts configuration file storage. Allows Tomcat embedding using the regular
@@ -44,7 +45,17 @@ public interface ConfigurationSource {
}
if (f.isFile()) {
return new Resource(new FileInputStream(f), f.toURI());
- } else {
+ }
+ URI uri = null;
+ try {
+ uri = getURI(name);
+ } catch (IllegalArgumentException e) {
+ throw new FileNotFoundException(name);
+ }
+ try {
+ URL url = uri.toURL();
+ return new Resource(url.openConnection().getInputStream(), uri);
+ } catch (MalformedURLException e) {
throw new FileNotFoundException(name);
}
}
diff --git a/test/org/apache/catalina/users/MemoryUserDatabaseTests.java b/test/org/apache/catalina/users/MemoryUserDatabaseTests.java
index 97ec3fa..4e6de01 100644
--- a/test/org/apache/catalina/users/MemoryUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/MemoryUserDatabaseTests.java
@@ -53,7 +53,7 @@ public class MemoryUserDatabaseTests {
}
db = new MemoryUserDatabase();
- db.setPathname(TEST_FILE.getAbsolutePath());
+ db.setPathname(TEST_FILE.toURI().toURL().toString());
db.open();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org