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 53931c7ceb Fix missing IllegalArgumentException 53931c7ceb is described below commit 53931c7ceb05ad13dd4d2acd77a14e525150963d Author: remm <r...@apache.org> AuthorDate: Tue Apr 18 17:05:04 2023 +0200 Fix missing IllegalArgumentException Regression when the Tomcat code was converted to using URI instead of URL. Only a few items really need it, but be somewhat cautious. Other instances of use seem fine. --- java/org/apache/catalina/connector/Response.java | 2 +- java/org/apache/catalina/core/NamingContextListener.java | 4 ++-- java/org/apache/catalina/startup/ContextConfig.java | 4 ++-- java/org/apache/catalina/valves/ProxyErrorReportValve.java | 2 +- .../org/apache/catalina/webresources/AbstractArchiveResource.java | 2 +- java/org/apache/catalina/webresources/JarResourceRoot.java | 2 +- webapps/docs/changelog.xml | 8 ++++++++ 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java index c76a9d4144..0e01cc05f0 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -1531,7 +1531,7 @@ public class Response implements HttpServletResponse { try { URI uri = new URI(location); url = uri.toURL(); - } catch (MalformedURLException | URISyntaxException e) { + } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { return false; } diff --git a/java/org/apache/catalina/core/NamingContextListener.java b/java/org/apache/catalina/core/NamingContextListener.java index d8b5c3cdbb..deff7e8252 100644 --- a/java/org/apache/catalina/core/NamingContextListener.java +++ b/java/org/apache/catalina/core/NamingContextListener.java @@ -831,7 +831,7 @@ public class NamingContextListener implements LifecycleListener, ContainerListen try { URI wsdlURI = new URI(service.getWsdlfile()); wsdlURL = wsdlURI.toURL(); - } catch (MalformedURLException | URISyntaxException e) { + } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { // Ignore and carry on } if (wsdlURL == null) { @@ -862,7 +862,7 @@ public class NamingContextListener implements LifecycleListener, ContainerListen try { URI jaxrpcURI = new URI(service.getJaxrpcmappingfile()); jaxrpcURL = jaxrpcURI.toURL(); - } catch (MalformedURLException | URISyntaxException e) { + } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { // Ignore and carry on } if (jaxrpcURL == null) { diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index f9e3c83c0d..fd9b594e0e 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -1433,7 +1433,7 @@ public class ContextConfig implements LifecycleListener { URL url = uri.toURL(); uc = url.openConnection(); globalTimeStamp = uc.getLastModified(); - } catch (IOException | URISyntaxException e) { + } catch (IOException | URISyntaxException | IllegalArgumentException e) { globalTimeStamp = -1; } finally { if (uc != null) { @@ -1454,7 +1454,7 @@ public class ContextConfig implements LifecycleListener { URL url = uri.toURL(); uc = url.openConnection(); hostTimeStamp = uc.getLastModified(); - } catch (IOException | URISyntaxException e) { + } catch (IOException | URISyntaxException | IllegalArgumentException e) { hostTimeStamp = -1; } finally { if (uc != null) { diff --git a/java/org/apache/catalina/valves/ProxyErrorReportValve.java b/java/org/apache/catalina/valves/ProxyErrorReportValve.java index 1b59a210fe..7220ffabf0 100644 --- a/java/org/apache/catalina/valves/ProxyErrorReportValve.java +++ b/java/org/apache/catalina/valves/ProxyErrorReportValve.java @@ -219,7 +219,7 @@ public class ProxyErrorReportValve extends ErrorReportValve { OutputStream outputStream = response.getOutputStream(); InputStream inputStream = url.openStream(); IOUtils.copy(inputStream, outputStream); - } catch (URISyntaxException | IOException e) { + } catch (URISyntaxException | IOException | IllegalArgumentException e) { if (log.isDebugEnabled()) { log.debug("Proxy error to " + urlString, e); } diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResource.java b/java/org/apache/catalina/webresources/AbstractArchiveResource.java index 982d676f12..d4f2e1c4a1 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResource.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResource.java @@ -144,7 +144,7 @@ public abstract class AbstractArchiveResource extends AbstractResource { String url = baseUrl + URLEncoder.DEFAULT.encode(resource.getName(), StandardCharsets.UTF_8); try { return new URI(url).toURL(); - } catch (MalformedURLException | URISyntaxException e) { + } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { if (getLog().isDebugEnabled()) { getLog().debug(sm.getString("fileResource.getUrlFail", url), e); } diff --git a/java/org/apache/catalina/webresources/JarResourceRoot.java b/java/org/apache/catalina/webresources/JarResourceRoot.java index 27686edf76..cdd6e1b1fa 100644 --- a/java/org/apache/catalina/webresources/JarResourceRoot.java +++ b/java/org/apache/catalina/webresources/JarResourceRoot.java @@ -125,7 +125,7 @@ public class JarResourceRoot extends AbstractResource { String url = baseUrl + "!/"; try { return new URI(url).toURL(); - } catch (MalformedURLException | URISyntaxException e) { + } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { if (log.isDebugEnabled()) { log.debug(sm.getString("fileResource.getUrlFail", url), e); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index f5d33f1434..36b3568f01 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -105,6 +105,14 @@ issues do not "pop up" wrt. others). --> <section name="Tomcat 8.5.89 (schultz)" rtext="in development"> + <subsection name="Catalina"> + <changelog> + <fix> + <bug>66567</bug>: Fix missing <code>IllegalArgumentException</code> + after the Tomcat code was converted to using URI instead of URL. (remm) + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 8.5.88 (schultz)" rtext="release in progress"> <subsection name="Catalina"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org