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

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new e933605  Improve error reporting for resource lookup problems
e933605 is described below

commit e933605414f55ecffba43c174926e1c0759e1a40
Author: remm <r...@apache.org>
AuthorDate: Fri Feb 12 11:00:48 2021 +0100

    Improve error reporting for resource lookup problems
---
 java/org/apache/tomcat/util/file/ConfigFileLoader.java   | 7 ++++++-
 java/org/apache/tomcat/util/file/LocalStrings.properties | 2 +-
 webapps/docs/changelog.xml                               | 3 +++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/file/ConfigFileLoader.java 
b/java/org/apache/tomcat/util/file/ConfigFileLoader.java
index 54631b2..d9c1cb0 100644
--- a/java/org/apache/tomcat/util/file/ConfigFileLoader.java
+++ b/java/org/apache/tomcat/util/file/ConfigFileLoader.java
@@ -85,7 +85,12 @@ public class ConfigFileLoader {
         }
 
         // File didn't work so try URI.
-        URI uri = getURI(location);
+        URI uri = null;
+        try {
+            uri = getURI(location);
+        } catch (IllegalArgumentException e) {
+            throw new 
IOException(sm.getString("configFileLoader.cannotObtainURL", location));
+        }
 
         // Obtain the input stream we need
         try {
diff --git a/java/org/apache/tomcat/util/file/LocalStrings.properties 
b/java/org/apache/tomcat/util/file/LocalStrings.properties
index 2bf0002..84e0646 100644
--- a/java/org/apache/tomcat/util/file/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/file/LocalStrings.properties
@@ -13,4 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-configFileLoader.cannotObtainURL=Cannot obtain URL for the relative path 
[{0}]. Check that catalina.base is set.
+configFileLoader.cannotObtainURL=Cannot obtain resource for specified location 
[{0}]: no readable file or this is not a resolvable URI
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f313899..5ca59d6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -122,6 +122,9 @@
         Avoid NullPointerException when a secure channel is closed before the
         SSL engine was initialized. (remm)
       </fix>
+      <fix>
+        Improve error message for failed ConfigFileLoader lookups. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">


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

Reply via email to