[Bug 66533] Wrapping Requests or Responses in Valves is not possible
https://bz.apache.org/bugzilla/show_bug.cgi?id=66533 --- Comment #2 from Wolfgang Illmeyer --- Ok, after playing around with Valves for a little, I would advise against actually using HttpServletRequest & HttpServletResponse and instead opt for extracting an interface from the currently used Request & Response classes. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66541] CachedResource for OSGi URL resources changes URL hashing behavior & exacerbates DNS issues
https://bz.apache.org/bugzilla/show_bug.cgi?id=66541 --- Comment #7 from Mark Thomas --- (In reply to Tom Whitmore from comment #6) > Thanks. The "wrapped one" is the outer one; I use wrapped & underlying as a > frequent terminology, it works well & is clear semantically. On that we are going to have to agree to disagree. The cache URL handler has references to both the original resource URL and that cache URL. I can see how either of those could be viewed as wrapped. That you and I seem to view this differently - and both us of seem fairly sure we are right - tells me any variation on the theme of "wrap" is not the right one. Replacing "associatedURL" with "cacheURL" is an alternative possibility. The first step is to fix the bug - which I'll do shortly. The second step is to take another look at the logic. I'm not sure the "... == u1" tests are required at all. I think those methods are only going to be called from the URL instance that was created with the handler instance so they are always going to be true. If that is the case, I'll simplify (remove) the logic. Finally there is the rename to make things clearer. Current front-runner is cacheURL, with the caveat a reason not to use it / a better idea may occur to me while working on this issue. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix logic bug - with thanks to Tom Whitmore.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new e4c0f1fe3e Fix logic bug - with thanks to Tom Whitmore. e4c0f1fe3e is described below commit e4c0f1fe3e2d145fe6abb23eb2d09c7b01462a8d Author: Mark Thomas AuthorDate: Mon Mar 27 16:30:39 2023 +0100 Fix logic bug - with thanks to Tom Whitmore. --- java/org/apache/catalina/webresources/CachedResource.java | 4 ++-- webapps/docs/changelog.xml| 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index 8cd119752a..744dad533b 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -467,7 +467,7 @@ public class CachedResource implements WebResource { @Override protected boolean equals(URL u1, URL u2) { // Deliberate use of == -if (resourceURL == u1) { +if (associatedURL == u1) { return resourceURL.equals(u2); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. @@ -484,7 +484,7 @@ public class CachedResource implements WebResource { @Override protected int hashCode(URL u) { // Deliberate use of == -if (resourceURL == u) { +if (associatedURL == u) { return resourceURL.hashCode(); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 8f8f5b1bcd..2117f1cda9 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -172,7 +172,8 @@ and hashcode() algorithms, if present, will now be used for URLs for these resources. This addresses a potential performance issue with some OSGi custom URL schemes that can trigger potentially slow DNS -lookups in some configurations. (markt) +lookups in some configurations. Based on a patch provided by Tom +Whitmore. (markt) When using a custom session manager deployed as part of the web - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix logic bug - with thanks to Tom Whitmore.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new af62dea83f Fix logic bug - with thanks to Tom Whitmore. af62dea83f is described below commit af62dea83f1222de49b4b654051ea91248e5517f Author: Mark Thomas AuthorDate: Mon Mar 27 16:30:39 2023 +0100 Fix logic bug - with thanks to Tom Whitmore. --- java/org/apache/catalina/webresources/CachedResource.java | 4 ++-- webapps/docs/changelog.xml| 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index f4894c7172..d8c02915b2 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -472,7 +472,7 @@ public class CachedResource implements WebResource { @Override protected boolean equals(URL u1, URL u2) { // Deliberate use of == -if (resourceURL == u1) { +if (associatedURL == u1) { return resourceURL.equals(u2); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. @@ -489,7 +489,7 @@ public class CachedResource implements WebResource { @Override protected int hashCode(URL u) { // Deliberate use of == -if (resourceURL == u) { +if (associatedURL == u) { return resourceURL.hashCode(); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b403d9f753..e7919383eb 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -157,7 +157,8 @@ and hashcode() algorithms, if present, will now be used for URLs for these resources. This addresses a potential performance issue with some OSGi custom URL schemes that can trigger potentially slow DNS -lookups in some configurations. (markt) +lookups in some configurations. Based on a patch provided by Tom +Whitmore. (markt) When using a custom session manager deployed as part of the web - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Fix logic bug - with thanks to Tom Whitmore.
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 baeeddce3b Fix logic bug - with thanks to Tom Whitmore. baeeddce3b is described below commit baeeddce3b5f93c2cea80a5acad84c4e8c902cd8 Author: Mark Thomas AuthorDate: Mon Mar 27 16:30:39 2023 +0100 Fix logic bug - with thanks to Tom Whitmore. --- java/org/apache/catalina/webresources/CachedResource.java | 4 ++-- webapps/docs/changelog.xml| 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index f4894c7172..d8c02915b2 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -472,7 +472,7 @@ public class CachedResource implements WebResource { @Override protected boolean equals(URL u1, URL u2) { // Deliberate use of == -if (resourceURL == u1) { +if (associatedURL == u1) { return resourceURL.equals(u2); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. @@ -489,7 +489,7 @@ public class CachedResource implements WebResource { @Override protected int hashCode(URL u) { // Deliberate use of == -if (resourceURL == u) { +if (associatedURL == u) { return resourceURL.hashCode(); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index fd7c709548..ed7b27cc53 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -157,7 +157,8 @@ and hashcode() algorithms, if present, will now be used for URLs for these resources. This addresses a potential performance issue with some OSGi custom URL schemes that can trigger potentially slow DNS -lookups in some configurations. (markt) +lookups in some configurations. Based on a patch provided by Tom +Whitmore. (markt) When using a custom session manager deployed as part of the web - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Fix logic bug - with thanks to Tom Whitmore.
This is an automated email from the ASF dual-hosted git repository. markt 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 f1295ac538 Fix logic bug - with thanks to Tom Whitmore. f1295ac538 is described below commit f1295ac538539c2d80d67dbfff72a52799b471d2 Author: Mark Thomas AuthorDate: Mon Mar 27 16:30:39 2023 +0100 Fix logic bug - with thanks to Tom Whitmore. --- java/org/apache/catalina/webresources/CachedResource.java | 4 ++-- webapps/docs/changelog.xml| 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index f4894c7172..d8c02915b2 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -472,7 +472,7 @@ public class CachedResource implements WebResource { @Override protected boolean equals(URL u1, URL u2) { // Deliberate use of == -if (resourceURL == u1) { +if (associatedURL == u1) { return resourceURL.equals(u2); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. @@ -489,7 +489,7 @@ public class CachedResource implements WebResource { @Override protected int hashCode(URL u) { // Deliberate use of == -if (resourceURL == u) { +if (associatedURL == u) { return resourceURL.hashCode(); } // Not the original resourceURL. Use the default implementation from URLStreamHandler. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 71d5c6f2c4..0cde954a66 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -152,7 +152,8 @@ and hashcode() algorithms, if present, will now be used for URLs for these resources. This addresses a potential performance issue with some OSGi custom URL schemes that can trigger potentially slow DNS -lookups in some configurations. (markt) +lookups in some configurations. Based on a patch provided by Tom +Whitmore. (markt) When using a custom session manager deployed as part of the web - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Improve naming - based a patch by Tom Whitmore
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 71b6644bce Improve naming - based a patch by Tom Whitmore 71b6644bce is described below commit 71b6644bceeadd8f5061ca74e0e14cbb2e2ae920 Author: Mark Thomas AuthorDate: Mon Mar 27 16:51:37 2023 +0100 Improve naming - based a patch by Tom Whitmore --- .../catalina/webresources/CachedResource.java | 43 ++ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index 744dad533b..c5dd835d2b 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -343,7 +343,7 @@ public class CachedResource implements WebResource { CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources); URL result = new URL(null, resourceURL.toExternalForm(), handler); -handler.setAssociatedURL(result); +handler.setCacheURL(result); return result; } catch (MalformedURLException e) { log.error(sm.getString("cachedResource.invalidURL", resourceURL.toExternalForm()), e); @@ -410,6 +410,15 @@ public class CachedResource implements WebResource { } +/** + * URLStreamHandler to handle a URL for a cached resource, delegating reads to the Cache. + * + * delegates reads to the Cache, to ensure consistent invalidation behavior + * delegates hashCode()/ equals() behavior to the underlying Resource URL. (Equinox/ OSGi compatibility) + * detects the case where a new relative URL is created from the wrapped URL, inheriting its handler; in this + * case reverts to default behavior + * + */ private static class CachedResourceURLStreamHandler extends URLStreamHandler { private final URL resourceURL; @@ -417,7 +426,7 @@ public class CachedResource implements WebResource { private final String webAppPath; private final boolean usesClassLoaderResources; -private URL associatedURL = null; +private URL cacheURL = null; CachedResourceURLStreamHandler(URL resourceURL, StandardRoot root, String webAppPath, boolean usesClassLoaderResources) { @@ -427,8 +436,8 @@ public class CachedResource implements WebResource { this.usesClassLoaderResources = usesClassLoaderResources; } -protected void setAssociatedURL(URL associatedURL) { -this.associatedURL = associatedURL; +protected void setCacheURL(URL cacheURL) { +this.cacheURL = cacheURL; } @Override @@ -436,15 +445,15 @@ public class CachedResource implements WebResource { // This deliberately uses ==. If u isn't the URL object this // URLStreamHandler was constructed for we do not want to use this // URLStreamHandler to create a connection. -if (associatedURL != null && u == associatedURL) { -if ("jar".equals(associatedURL.getProtocol())) { +if (cacheURL != null && u == cacheURL) { +if ("jar".equals(cacheURL.getProtocol())) { return new CachedResourceJarURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } else { return new CachedResourceURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } } else { -// The stream handler has been inherited by a URL that was -// constructed from a cache URL. We need to break that link. +// This stream handler has been inherited by a URL that was constructed from a cache URL. +// We need to break that link. URI constructedURI; try { constructedURI = new URI(u.toExternalForm()); @@ -460,34 +469,36 @@ public class CachedResource implements WebResource { /** * {@inheritDoc} * - * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the wrapped - * resourceURL, delegate to the resourceURL and it's handler. Otherwise, use the default implementation from + * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the cacheURL, + * delegate to the resourceURL and it's handler. Otherwise, use the default implementation from * URLStreamHandler. */ @Override protected boolean equals(URL u1, URL u2) { //
[tomcat] branch 10.1.x updated: Improve naming - based a patch by Tom Whitmore
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new da5d1eef78 Improve naming - based a patch by Tom Whitmore da5d1eef78 is described below commit da5d1eef78953f4c872588a36782d014bee72001 Author: Mark Thomas AuthorDate: Mon Mar 27 16:51:37 2023 +0100 Improve naming - based a patch by Tom Whitmore --- .../catalina/webresources/CachedResource.java | 43 ++ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d8c02915b2..d512abca93 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -343,7 +343,7 @@ public class CachedResource implements WebResource { CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources); URL result = new URL(null, resourceURL.toExternalForm(), handler); -handler.setAssociatedURL(result); +handler.setCacheURL(result); return result; } catch (MalformedURLException e) { log.error(sm.getString("cachedResource.invalidURL", resourceURL.toExternalForm()), e); @@ -415,6 +415,15 @@ public class CachedResource implements WebResource { } +/** + * URLStreamHandler to handle a URL for a cached resource, delegating reads to the Cache. + * + * delegates reads to the Cache, to ensure consistent invalidation behavior + * delegates hashCode()/ equals() behavior to the underlying Resource URL. (Equinox/ OSGi compatibility) + * detects the case where a new relative URL is created from the wrapped URL, inheriting its handler; in this + * case reverts to default behavior + * + */ private static class CachedResourceURLStreamHandler extends URLStreamHandler { private final URL resourceURL; @@ -422,7 +431,7 @@ public class CachedResource implements WebResource { private final String webAppPath; private final boolean usesClassLoaderResources; -private URL associatedURL = null; +private URL cacheURL = null; CachedResourceURLStreamHandler(URL resourceURL, StandardRoot root, String webAppPath, boolean usesClassLoaderResources) { @@ -432,8 +441,8 @@ public class CachedResource implements WebResource { this.usesClassLoaderResources = usesClassLoaderResources; } -protected void setAssociatedURL(URL associatedURL) { -this.associatedURL = associatedURL; +protected void setCacheURL(URL cacheURL) { +this.cacheURL = cacheURL; } @Override @@ -441,15 +450,15 @@ public class CachedResource implements WebResource { // This deliberately uses ==. If u isn't the URL object this // URLStreamHandler was constructed for we do not want to use this // URLStreamHandler to create a connection. -if (associatedURL != null && u == associatedURL) { -if ("jar".equals(associatedURL.getProtocol())) { +if (cacheURL != null && u == cacheURL) { +if ("jar".equals(cacheURL.getProtocol())) { return new CachedResourceJarURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } else { return new CachedResourceURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } } else { -// The stream handler has been inherited by a URL that was -// constructed from a cache URL. We need to break that link. +// This stream handler has been inherited by a URL that was constructed from a cache URL. +// We need to break that link. URI constructedURI; try { constructedURI = new URI(u.toExternalForm()); @@ -465,34 +474,36 @@ public class CachedResource implements WebResource { /** * {@inheritDoc} * - * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the wrapped - * resourceURL, delegate to the resourceURL and it's handler. Otherwise, use the default implementation from + * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the cacheURL, + * delegate to the resourceURL and it's handler. Otherwise, use the default implementation from * URLStreamHandler. */ @Override protected boolean equals(URL u1, URL u2) {
[tomcat] branch 9.0.x updated: Improve naming - based a patch by Tom Whitmore
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 9626aa78f7 Improve naming - based a patch by Tom Whitmore 9626aa78f7 is described below commit 9626aa78f7a02d3426d1a935af6b71d4e53ed294 Author: Mark Thomas AuthorDate: Mon Mar 27 16:51:37 2023 +0100 Improve naming - based a patch by Tom Whitmore --- .../catalina/webresources/CachedResource.java | 43 ++ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d8c02915b2..d512abca93 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -343,7 +343,7 @@ public class CachedResource implements WebResource { CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources); URL result = new URL(null, resourceURL.toExternalForm(), handler); -handler.setAssociatedURL(result); +handler.setCacheURL(result); return result; } catch (MalformedURLException e) { log.error(sm.getString("cachedResource.invalidURL", resourceURL.toExternalForm()), e); @@ -415,6 +415,15 @@ public class CachedResource implements WebResource { } +/** + * URLStreamHandler to handle a URL for a cached resource, delegating reads to the Cache. + * + * delegates reads to the Cache, to ensure consistent invalidation behavior + * delegates hashCode()/ equals() behavior to the underlying Resource URL. (Equinox/ OSGi compatibility) + * detects the case where a new relative URL is created from the wrapped URL, inheriting its handler; in this + * case reverts to default behavior + * + */ private static class CachedResourceURLStreamHandler extends URLStreamHandler { private final URL resourceURL; @@ -422,7 +431,7 @@ public class CachedResource implements WebResource { private final String webAppPath; private final boolean usesClassLoaderResources; -private URL associatedURL = null; +private URL cacheURL = null; CachedResourceURLStreamHandler(URL resourceURL, StandardRoot root, String webAppPath, boolean usesClassLoaderResources) { @@ -432,8 +441,8 @@ public class CachedResource implements WebResource { this.usesClassLoaderResources = usesClassLoaderResources; } -protected void setAssociatedURL(URL associatedURL) { -this.associatedURL = associatedURL; +protected void setCacheURL(URL cacheURL) { +this.cacheURL = cacheURL; } @Override @@ -441,15 +450,15 @@ public class CachedResource implements WebResource { // This deliberately uses ==. If u isn't the URL object this // URLStreamHandler was constructed for we do not want to use this // URLStreamHandler to create a connection. -if (associatedURL != null && u == associatedURL) { -if ("jar".equals(associatedURL.getProtocol())) { +if (cacheURL != null && u == cacheURL) { +if ("jar".equals(cacheURL.getProtocol())) { return new CachedResourceJarURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } else { return new CachedResourceURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } } else { -// The stream handler has been inherited by a URL that was -// constructed from a cache URL. We need to break that link. +// This stream handler has been inherited by a URL that was constructed from a cache URL. +// We need to break that link. URI constructedURI; try { constructedURI = new URI(u.toExternalForm()); @@ -465,34 +474,36 @@ public class CachedResource implements WebResource { /** * {@inheritDoc} * - * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the wrapped - * resourceURL, delegate to the resourceURL and it's handler. Otherwise, use the default implementation from + * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the cacheURL, + * delegate to the resourceURL and it's handler. Otherwise, use the default implementation from * URLStreamHandler. */ @Override protected boolean equals(URL u1, URL u2) { /
[tomcat] branch 8.5.x updated: Improve naming - based a patch by Tom Whitmore
This is an automated email from the ASF dual-hosted git repository. markt 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 23cc5bcdb0 Improve naming - based a patch by Tom Whitmore 23cc5bcdb0 is described below commit 23cc5bcdb0562904a3d7dc692a4653257d66282b Author: Mark Thomas AuthorDate: Mon Mar 27 16:51:37 2023 +0100 Improve naming - based a patch by Tom Whitmore --- .../catalina/webresources/CachedResource.java | 43 ++ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d8c02915b2..d512abca93 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -343,7 +343,7 @@ public class CachedResource implements WebResource { CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources); URL result = new URL(null, resourceURL.toExternalForm(), handler); -handler.setAssociatedURL(result); +handler.setCacheURL(result); return result; } catch (MalformedURLException e) { log.error(sm.getString("cachedResource.invalidURL", resourceURL.toExternalForm()), e); @@ -415,6 +415,15 @@ public class CachedResource implements WebResource { } +/** + * URLStreamHandler to handle a URL for a cached resource, delegating reads to the Cache. + * + * delegates reads to the Cache, to ensure consistent invalidation behavior + * delegates hashCode()/ equals() behavior to the underlying Resource URL. (Equinox/ OSGi compatibility) + * detects the case where a new relative URL is created from the wrapped URL, inheriting its handler; in this + * case reverts to default behavior + * + */ private static class CachedResourceURLStreamHandler extends URLStreamHandler { private final URL resourceURL; @@ -422,7 +431,7 @@ public class CachedResource implements WebResource { private final String webAppPath; private final boolean usesClassLoaderResources; -private URL associatedURL = null; +private URL cacheURL = null; CachedResourceURLStreamHandler(URL resourceURL, StandardRoot root, String webAppPath, boolean usesClassLoaderResources) { @@ -432,8 +441,8 @@ public class CachedResource implements WebResource { this.usesClassLoaderResources = usesClassLoaderResources; } -protected void setAssociatedURL(URL associatedURL) { -this.associatedURL = associatedURL; +protected void setCacheURL(URL cacheURL) { +this.cacheURL = cacheURL; } @Override @@ -441,15 +450,15 @@ public class CachedResource implements WebResource { // This deliberately uses ==. If u isn't the URL object this // URLStreamHandler was constructed for we do not want to use this // URLStreamHandler to create a connection. -if (associatedURL != null && u == associatedURL) { -if ("jar".equals(associatedURL.getProtocol())) { +if (cacheURL != null && u == cacheURL) { +if ("jar".equals(cacheURL.getProtocol())) { return new CachedResourceJarURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } else { return new CachedResourceURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } } else { -// The stream handler has been inherited by a URL that was -// constructed from a cache URL. We need to break that link. +// This stream handler has been inherited by a URL that was constructed from a cache URL. +// We need to break that link. URI constructedURI; try { constructedURI = new URI(u.toExternalForm()); @@ -465,34 +474,36 @@ public class CachedResource implements WebResource { /** * {@inheritDoc} * - * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the wrapped - * resourceURL, delegate to the resourceURL and it's handler. Otherwise, use the default implementation from + * We don't know what the requirements are for equals for the wrapped resourceURL so if u1 is the cacheURL, + * delegate to the resourceURL and it's handler. Otherwise, use the default implementation from * URLStreamHandler. */ @Override protected boolean equals(URL u1, URL u2) { /
[tomcat] branch main updated: Fix comment typo
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 628bb0ee10 Fix comment typo 628bb0ee10 is described below commit 628bb0ee10cb201d072a8e78616faf78c8f90b00 Author: Mark Thomas AuthorDate: Mon Mar 27 16:52:58 2023 +0100 Fix comment typo --- java/org/apache/catalina/webresources/CachedResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index c5dd835d2b..d70d496a12 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -328,7 +328,7 @@ public class CachedResource implements WebResource { * One option to resolve this issue is to use a custom URL scheme for resource URLs. This would allow us, via * registration of a URLStreamHandlerFactory, to control how the resources are accessed and ensure that all * access go via the cache We took this approach for war: URLs so we can use jar:war:file: URLs to reference - * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be caused once, + * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be called once, * this can cause problems when using other libraries that also want to use a custom URL scheme. * * The approach below allows us to insert a custom URLStreamHandler without registering a custom protocol. The - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix comment typo
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new af4a4dbe5a Fix comment typo af4a4dbe5a is described below commit af4a4dbe5af5c4e5415faf8e3ae5d3432af740fa Author: Mark Thomas AuthorDate: Mon Mar 27 16:52:58 2023 +0100 Fix comment typo --- java/org/apache/catalina/webresources/CachedResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d512abca93..b2b4d62693 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -328,7 +328,7 @@ public class CachedResource implements WebResource { * One option to resolve this issue is to use a custom URL scheme for resource URLs. This would allow us, via * registration of a URLStreamHandlerFactory, to control how the resources are accessed and ensure that all * access go via the cache We took this approach for war: URLs so we can use jar:war:file: URLs to reference - * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be caused once, + * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be called once, * this can cause problems when using other libraries that also want to use a custom URL scheme. * * The approach below allows us to insert a custom URLStreamHandler without registering a custom protocol. The - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Fix comment typo
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 3578c93597 Fix comment typo 3578c93597 is described below commit 3578c93597bf91f4cd49579ec807e5a38221de66 Author: Mark Thomas AuthorDate: Mon Mar 27 16:52:58 2023 +0100 Fix comment typo --- java/org/apache/catalina/webresources/CachedResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d512abca93..b2b4d62693 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -328,7 +328,7 @@ public class CachedResource implements WebResource { * One option to resolve this issue is to use a custom URL scheme for resource URLs. This would allow us, via * registration of a URLStreamHandlerFactory, to control how the resources are accessed and ensure that all * access go via the cache We took this approach for war: URLs so we can use jar:war:file: URLs to reference - * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be caused once, + * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be called once, * this can cause problems when using other libraries that also want to use a custom URL scheme. * * The approach below allows us to insert a custom URLStreamHandler without registering a custom protocol. The - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Fix comment typo
This is an automated email from the ASF dual-hosted git repository. markt 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 6d3415e090 Fix comment typo 6d3415e090 is described below commit 6d3415e090a57e0cdd2e34d2457ca552429d29db Author: Mark Thomas AuthorDate: Mon Mar 27 16:52:58 2023 +0100 Fix comment typo --- java/org/apache/catalina/webresources/CachedResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d512abca93..b2b4d62693 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -328,7 +328,7 @@ public class CachedResource implements WebResource { * One option to resolve this issue is to use a custom URL scheme for resource URLs. This would allow us, via * registration of a URLStreamHandlerFactory, to control how the resources are accessed and ensure that all * access go via the cache We took this approach for war: URLs so we can use jar:war:file: URLs to reference - * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be caused once, + * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be called once, * this can cause problems when using other libraries that also want to use a custom URL scheme. * * The approach below allows us to insert a custom URLStreamHandler without registering a custom protocol. The - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66541] CachedResource for OSGi URL resources changes URL hashing behavior & exacerbates DNS issues
https://bz.apache.org/bugzilla/show_bug.cgi?id=66541 Mark Thomas changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #8 from Mark Thomas --- Fixed. Bug fixed and field renamed. The logic needed to stay and I added a comment to remind the next person looking at the code why this is. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66544] java.lang.ArrayIndexOutOfBoundsException @ rg.apache.coyote.http11.Http11Processor.service Error processing request
https://bz.apache.org/bugzilla/show_bug.cgi?id=66544 --- Comment #2 from Mark Thomas --- I don't see how this could be a Tomcat bug. All the indications are that this is a JVM bug. I won't close this just yet, but it is likely to be closed in the next few days. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf merged pull request #604: Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent
markt-asf merged PR #604: URL: https://github.com/apache/tomcat/pull/604 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 0ac33836c3 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent 0ac33836c3 is described below commit 0ac33836c37dda486842b2d2ec4446ac112452ff Author: Felix Schumacher AuthorDate: Sat Mar 25 13:12:38 2023 +0100 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent Give it its own log message instead of re-using the one from fireRequestInitEvent. --- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/StandardContext.java| 2 +- webapps/docs/changelog.xml| 4 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties index e4438c7556..7988653de3 100644 --- a/java/org/apache/catalina/core/LocalStrings.properties +++ b/java/org/apache/catalina/core/LocalStrings.properties @@ -209,6 +209,7 @@ standardContext.predestroy.duplicate=Duplicate @PreDestroy method definition for standardContext.predestroy.required=Both fully qualified class name and method name are required standardContext.reloadingCompleted=Reloading Context with name [{0}] is completed standardContext.reloadingStarted=Reloading Context with name [{0}] has started +standardContext.requestListener.requestDestroyed=Exception sending request destroyed lifecycle event to listener instance of class [{0}] standardContext.requestListener.requestInit=Exception sending request initialized lifecycle event to listener instance of class [{0}] standardContext.resourcesInit=Error initializing static Resources standardContext.resourcesStart=Error starting static Resources diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 21ac22928b..446ab1a686 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5629,7 +5629,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat listener.requestDestroyed(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLogger().error(sm.getString("standardContext.requestListener.requestInit", + getLogger().error(sm.getString("standardContext.requestListener.requestDestroyed", instances[j].getClass().getName()), t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2117f1cda9..d2b3516a80 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -180,6 +180,10 @@ application, avoid ClassNotFoundExceptions when validating session IDs extracted from requests. (markt) + +66543: Give StandardContext#fireRequestDestroyEvent + its own log message. (fschumacher) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent
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 9f00d9fba7 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent 9f00d9fba7 is described below commit 9f00d9fba7b7ff29f02188cfe1b72439bd478008 Author: Felix Schumacher AuthorDate: Sat Mar 25 13:12:38 2023 +0100 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent Give it its own log message instead of re-using the one from fireRequestInitEvent. --- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/StandardContext.java| 2 +- webapps/docs/changelog.xml| 4 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties index a37fcf0fc4..c81a1a91a5 100644 --- a/java/org/apache/catalina/core/LocalStrings.properties +++ b/java/org/apache/catalina/core/LocalStrings.properties @@ -216,6 +216,7 @@ standardContext.predestroy.duplicate=Duplicate @PreDestroy method definition for standardContext.predestroy.required=Both fully qualified class name and method name are required standardContext.reloadingCompleted=Reloading Context with name [{0}] is completed standardContext.reloadingStarted=Reloading Context with name [{0}] has started +standardContext.requestListener.requestDestroyed=Exception sending request destroyed lifecycle event to listener instance of class [{0}] standardContext.requestListener.requestInit=Exception sending request initialized lifecycle event to listener instance of class [{0}] standardContext.resourcesInit=Error initializing static Resources standardContext.resourcesStart=Error starting static Resources diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index cbdef7902f..6a7a03bcb0 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5697,7 +5697,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat listener.requestDestroyed(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLogger().error(sm.getString("standardContext.requestListener.requestInit", + getLogger().error(sm.getString("standardContext.requestListener.requestDestroyed", instances[j].getClass().getName()), t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index ed7b27cc53..c305c2de06 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -165,6 +165,10 @@ application, avoid ClassNotFoundExceptions when validating session IDs extracted from requests. (markt) + +66543: Give StandardContext#fireRequestDestroyEvent + its own log message. (fschumacher) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent
This is an automated email from the ASF dual-hosted git repository. markt 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 4b201dff58 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent 4b201dff58 is described below commit 4b201dff58b3708b37462a4c2b380557a3180f30 Author: Felix Schumacher AuthorDate: Sat Mar 25 13:12:38 2023 +0100 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent Give it its own log message instead of re-using the one from fireRequestInitEvent. --- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/StandardContext.java| 2 +- webapps/docs/changelog.xml| 4 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties index fef134d38a..7cbf76d05b 100644 --- a/java/org/apache/catalina/core/LocalStrings.properties +++ b/java/org/apache/catalina/core/LocalStrings.properties @@ -215,6 +215,7 @@ standardContext.predestroy.duplicate=Duplicate @PreDestroy method definition for standardContext.predestroy.required=Both fully qualified class name and method name are required standardContext.reloadingCompleted=Reloading Context with name [{0}] is completed standardContext.reloadingStarted=Reloading Context with name [{0}] has started +standardContext.requestListener.requestDestroyed=Exception sending request destroyed lifecycle event to listener instance of class [{0}] standardContext.requestListener.requestInit=Exception sending request initialized lifecycle event to listener instance of class [{0}] standardContext.resourcesInit=Error initializing static Resources standardContext.resourcesStart=Error starting static Resources diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index dbd0afc5f8..1912529d2f 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5703,7 +5703,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat listener.requestDestroyed(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLogger().error(sm.getString("standardContext.requestListener.requestInit", + getLogger().error(sm.getString("standardContext.requestListener.requestDestroyed", instances[j].getClass().getName()), t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0cde954a66..c538c08d23 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -160,6 +160,10 @@ application, avoid ClassNotFoundExceptions when validating session IDs extracted from requests. (markt) + +66543: Give StandardContext#fireRequestDestroyEvent + its own log message. (fschumacher) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66543] Misleading error log in fireRequestDestroyEvent
https://bz.apache.org/bugzilla/show_bug.cgi?id=66543 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Mark Thomas --- Fixed with Felix's PR in: - 11.0.x for 11.0.0-M5 onwards - 10.1.x for 10.1.8 onwards - 9.0.x for 9.0.74 onwards - 8.5.x for 8.5.88 onwards -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new e7c450e994 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent e7c450e994 is described below commit e7c450e99409cbee20ac5389e80f49594342cff6 Author: Felix Schumacher AuthorDate: Sat Mar 25 13:12:38 2023 +0100 Fix Bug 66543 - Wrong log message used in StandardContext#fireRequestDestroyEvent Give it its own log message instead of re-using the one from fireRequestInitEvent. --- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/StandardContext.java| 2 +- webapps/docs/changelog.xml| 4 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties index 944e236726..dd7e15ee2d 100644 --- a/java/org/apache/catalina/core/LocalStrings.properties +++ b/java/org/apache/catalina/core/LocalStrings.properties @@ -209,6 +209,7 @@ standardContext.predestroy.duplicate=Duplicate @PreDestroy method definition for standardContext.predestroy.required=Both fully qualified class name and method name are required standardContext.reloadingCompleted=Reloading Context with name [{0}] is completed standardContext.reloadingStarted=Reloading Context with name [{0}] has started +standardContext.requestListener.requestDestroyed=Exception sending request destroyed lifecycle event to listener instance of class [{0}] standardContext.requestListener.requestInit=Exception sending request initialized lifecycle event to listener instance of class [{0}] standardContext.resourcesInit=Error initializing static Resources standardContext.resourcesStart=Error starting static Resources diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 6803a35477..4e6af40ba0 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5643,7 +5643,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat listener.requestDestroyed(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLogger().error(sm.getString("standardContext.requestListener.requestInit", + getLogger().error(sm.getString("standardContext.requestListener.requestDestroyed", instances[j].getClass().getName()), t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e7919383eb..4986f89652 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -165,6 +165,10 @@ application, avoid ClassNotFoundExceptions when validating session IDs extracted from requests. (markt) + +66543: Give StandardContext#fireRequestDestroyEvent + its own log message. (fschumacher) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new a6339b1405 Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail a6339b1405 is described below commit a6339b1405520b99fc54c35b202ac2639f114f93 Author: Mark Thomas AuthorDate: Mon Mar 27 20:08:35 2023 +0100 Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail --- webapps/docs/changelog.xml| 8 webapps/docs/jndi-resources-howto.xml | 37 +++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index d2b3516a80..4114c6fc1a 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -244,6 +244,14 @@ + + + +66542: Documentation. Update the JNDI documentation to +replace references to JavaMail with references to Jakarta Mail. (markt) + + + diff --git a/webapps/docs/jndi-resources-howto.xml b/webapps/docs/jndi-resources-howto.xml index 3ea9e747a3..12b238dddb 100644 --- a/webapps/docs/jndi-resources-howto.xml +++ b/webapps/docs/jndi-resources-howto.xml @@ -66,7 +66,7 @@ resources: will operate.- Resource reference, which is typically to an object factory for resources such as a JDBC -DataSource, a JavaMail Session, or custom +DataSource, a Jakarta Mail Session, or custom object factories configured into Tomcat. - Resource environment reference, a new variation of resource-ref @@ -619,13 +619,13 @@ create table user_roles ( - + 0. Introduction In many web applications, sending electronic mail messages is a required part of the system's functionality. The -http://www.oracle.com/technetwork/java/javamail/index.html";>Java Mail API +https://jakartaee.github.io/mail-api/";>Jakarta Mail API makes this process relatively straightforward, but requires many configuration details that the client application must be aware of (including the name of the SMTP host to be used for message sending). @@ -717,7 +717,7 @@ Transport.send(message);]]> and values and passed to jakarta.mail.Session.getInstance(java.util.Properties) as part of the java.util.Properties collection. In addition to the -properties defined in Annex A of the JavaMail specification, individual +properties defined in Appendix A of the Jakarta Mail specification, individual providers may also support additional properties. @@ -726,19 +726,30 @@ Transport.send(message);]]> then Tomcat's resource factory will configure and add a jakarta.mail.Authenticator to the mail session. -4. Install the JavaMail libraries +4. Install the Jakarta Mail API -http://javamail.java.net/";> -Download the JavaMail API. +https://search.maven.org/artifact/jakarta.mail/jakarta.mail-api/2.1.0/jar";> +Download the Jakarta Mail API. -Unpackage the distribution and place mail.jar into $CATALINA_HOME/lib so -that it is available to Tomcat during the initialization of the mail Session -Resource. Note: placing this jar in both $CATALINA_HOME/lib -and a web application's lib folder will cause an error, so ensure you have -it in the $CATALINA_HOME/lib location only. +Unpackage the distribution and place jakarta.mail-api-2.1.0.jar into +$CATALINA_HOME/lib so that it is available to Tomcat during the +initialization of the mail Session Resource. +Note: placing this jar in both $CATALINA_HOME/lib and a web +application's lib folder will cause an error, so ensure you have it in the +$CATALINA_HOME/lib location only. -5. Restart Tomcat +5. Install a compatible implementaion + +Select and https://jakarta.ee/specifications/mail/2.1/";> +download a compatible implementation. + +Unpackage the implementation and place the jar file(s) into +$CATALINA_HOME/lib. + +Note: Other implementations may be available + +6. Restart Tomcat For the additional JAR to be visible to Tomcat, it is necessary for the Tomcat instance to be restarted. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new b441ffe9e4 Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail b441ffe9e4 is described below commit b441ffe9e4276384042eddf953f96b541e8b447a Author: Mark Thomas AuthorDate: Mon Mar 27 20:08:35 2023 +0100 Fix BZ 66542 - Update references to JavaMail to use Jakarta Mail --- webapps/docs/changelog.xml| 8 webapps/docs/jndi-resources-howto.xml | 37 +++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4986f89652..d55fd750b6 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -229,6 +229,14 @@ + + + +66542: Documentation. Update the JNDI documentation to +replace references to JavaMail with references to Jakarta Mail. (markt) + + + diff --git a/webapps/docs/jndi-resources-howto.xml b/webapps/docs/jndi-resources-howto.xml index 3ea9e747a3..12b238dddb 100644 --- a/webapps/docs/jndi-resources-howto.xml +++ b/webapps/docs/jndi-resources-howto.xml @@ -66,7 +66,7 @@ resources: will operate.- Resource reference, which is typically to an object factory for resources such as a JDBC -DataSource, a JavaMail Session, or custom +DataSource, a Jakarta Mail Session, or custom object factories configured into Tomcat. - Resource environment reference, a new variation of resource-ref @@ -619,13 +619,13 @@ create table user_roles ( - + 0. Introduction In many web applications, sending electronic mail messages is a required part of the system's functionality. The -http://www.oracle.com/technetwork/java/javamail/index.html";>Java Mail API +https://jakartaee.github.io/mail-api/";>Jakarta Mail API makes this process relatively straightforward, but requires many configuration details that the client application must be aware of (including the name of the SMTP host to be used for message sending). @@ -717,7 +717,7 @@ Transport.send(message);]]> and values and passed to jakarta.mail.Session.getInstance(java.util.Properties) as part of the java.util.Properties collection. In addition to the -properties defined in Annex A of the JavaMail specification, individual +properties defined in Appendix A of the Jakarta Mail specification, individual providers may also support additional properties. @@ -726,19 +726,30 @@ Transport.send(message);]]> then Tomcat's resource factory will configure and add a jakarta.mail.Authenticator to the mail session. -4. Install the JavaMail libraries +4. Install the Jakarta Mail API -http://javamail.java.net/";> -Download the JavaMail API. +https://search.maven.org/artifact/jakarta.mail/jakarta.mail-api/2.1.0/jar";> +Download the Jakarta Mail API. -Unpackage the distribution and place mail.jar into $CATALINA_HOME/lib so -that it is available to Tomcat during the initialization of the mail Session -Resource. Note: placing this jar in both $CATALINA_HOME/lib -and a web application's lib folder will cause an error, so ensure you have -it in the $CATALINA_HOME/lib location only. +Unpackage the distribution and place jakarta.mail-api-2.1.0.jar into +$CATALINA_HOME/lib so that it is available to Tomcat during the +initialization of the mail Session Resource. +Note: placing this jar in both $CATALINA_HOME/lib and a web +application's lib folder will cause an error, so ensure you have it in the +$CATALINA_HOME/lib location only. -5. Restart Tomcat +5. Install a compatible implementaion + +Select and https://jakarta.ee/specifications/mail/2.1/";> +download a compatible implementation. + +Unpackage the implementation and place the jar file(s) into +$CATALINA_HOME/lib. + +Note: Other implementations may be available + +6. Restart Tomcat For the additional JAR to be visible to Tomcat, it is necessary for the Tomcat instance to be restarted. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66542] JavaMail specification links are outdated in documentation
https://bz.apache.org/bugzilla/show_bug.cgi?id=66542 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Mark Thomas --- Fixed in: - 11.0.x for 11.0.0-M5 onwards - 10.1.x for 10.1.8 onwards -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66505] Calling [asyncPostProcess()] is not valid for a request with Async state [ERROR]
https://bz.apache.org/bugzilla/show_bug.cgi?id=66505 Mark Thomas changed: What|Removed |Added Resolution|--- |WORKSFORME Status|NEEDINFO|RESOLVED --- Comment #4 from Mark Thomas --- Closing as per previous comment -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66541] CachedResource for OSGi URL resources changes URL hashing behavior & exacerbates DNS issues
https://bz.apache.org/bugzilla/show_bug.cgi?id=66541 --- Comment #9 from Tom Whitmore --- Great, thanks Mark. * I think 'cacheURL' and 'resourceURL' sound reasonably clearly distinct. * I agree the 'url == cacheURL' logic is necessary; relative resource URL objects can be created inheriting their parent handlers. * I personally wasn't certain the null-check on openConnection() was necessary unless that can somehow be called with a null. (But that's pre-existing to this issue.) Do you have a build I can review? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66541] CachedResource for OSGi URL resources changes URL hashing behavior & exacerbates DNS issues
https://bz.apache.org/bugzilla/show_bug.cgi?id=66541 --- Comment #10 from Mark Thomas --- I have updated https://people.apache.org/~markt/dev/v8.5.88-dev/ with a new test / dev build. Same caveats apply. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 66508] Tomcat after a GC pause causes the HTTP threads to be blocked to acquire a semaphore to process WebSockets connection closure.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66508 --- Comment #18 from Mark Thomas --- Thanks for the Connector settings. The stack traces will definitely be useful as it looks as if you are using useAsyncIO="true". If correct, I definitely want to see how this is being triggered. As an alternative, I'm happy to look at the stack traces for the modified Tomcat source if you can also provide the modified source. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/01: Further fix for BZ 66508
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch fix-bz-66508 in repository https://gitbox.apache.org/repos/asf/tomcat.git commit f09171e654dfedcdf9657973427bd9c62b732ad0 Author: Mark Thomas AuthorDate: Fri Mar 24 17:21:04 2023 + Further fix for BZ 66508 https://bz.apache.org/bugzilla/show_bug.cgi?id=66508 Avoid deadlock for close messages when WsRemoteEndpointImplServer.endMessage() for a previous message is processed on a container thread --- .../tomcat/websocket/WsRemoteEndpointImplBase.java | 24 +-- .../websocket/server/WsHttpUpgradeHandler.java | 3 +- .../server/WsRemoteEndpointImplServer.java | 76 +- 3 files changed, 97 insertions(+), 6 deletions(-) diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java index eec3381a85..9091dab205 100644 --- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java +++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java @@ -66,7 +66,7 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint { private final IntermediateMessageHandler intermediateMessageHandler = new IntermediateMessageHandler(this); private Transformation transformation = null; -private final Semaphore messagePartInProgress = new Semaphore(1); +protected final Semaphore messagePartInProgress = new Semaphore(1); private final Queue messagePartQueue = new ArrayDeque<>(); private final Object messagePartLock = new Object(); @@ -288,9 +288,8 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint { return; } -long timeout = timeoutExpiry - System.currentTimeMillis(); try { -if (!messagePartInProgress.tryAcquire(timeout, TimeUnit.MILLISECONDS)) { +if (!acquireMessagePartInProgressSemaphore(opCode, timeoutExpiry)) { String msg = sm.getString("wsRemoteEndpoint.acquireTimeout"); wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg), new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg), true); @@ -334,6 +333,23 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint { } +/** + * Acquire the semaphore that allows a message part to be written. + * + * @param opCode The OPCODE for the message to be written + * @param timeoutExpiry The time when the attempt to acquire the semaphore should expire + * + * @return {@code true} if the semaphore is obtained, otherwise {@code false}. + * + * @throws InterruptedException If the wait for the semaphore is interrupted + */ +protected boolean acquireMessagePartInProgressSemaphore(byte opCode, long timeoutExpiry) +throws InterruptedException { +long timeout = timeoutExpiry - System.currentTimeMillis(); +return messagePartInProgress.tryAcquire(timeout, TimeUnit.MILLISECONDS); +} + + void startMessage(byte opCode, ByteBuffer payload, boolean last, SendHandler handler) { wsSession.updateLastActiveWrite(); @@ -392,7 +408,7 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint { } -void endMessage(SendHandler handler, SendResult result) { +protected void endMessage(SendHandler handler, SendResult result) { boolean doWrite = false; MessagePart mpNext = null; synchronized (messagePartLock) { diff --git a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java index b180e52a74..a71580e418 100644 --- a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java +++ b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java @@ -117,7 +117,8 @@ public class WsHttpUpgradeHandler implements InternalHttpUpgradeHandler { ClassLoader cl = t.getContextClassLoader(); t.setContextClassLoader(applicationClassLoader); try { -wsRemoteEndpointServer = new WsRemoteEndpointImplServer(socketWrapper, upgradeInfo, webSocketContainer); +wsRemoteEndpointServer = +new WsRemoteEndpointImplServer(socketWrapper, upgradeInfo, webSocketContainer, connection); wsSession = new WsSession(wsRemoteEndpointServer, webSocketContainer, handshakeRequest.getRequestURI(), handshakeRequest.getParameterMap(), handshakeRequest.getQueryString(), handshakeRequest.getUserPrincipal(), httpSessionId, negotiatedExtensions, subProtocol, diff --git a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java index 8dd5974328..67e97a111d 100644 --- a/java/org/apache/tomcat/websocket/server/WsRemo
[tomcat] branch fix-bz-66508 created (now f09171e654)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch fix-bz-66508 in repository https://gitbox.apache.org/repos/asf/tomcat.git at f09171e654 Further fix for BZ 66508 This branch includes the following new commits: new f09171e654 Further fix for BZ 66508 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf opened a new pull request, #605: Further fix for BZ 66508
markt-asf opened a new pull request, #605: URL: https://github.com/apache/tomcat/pull/605 https://bz.apache.org/bugzilla/show_bug.cgi?id=66508 Avoid deadlock for close messages when WsRemoteEndpointImplServer.endMessage() for a previous message is processed on a container thread The fix for this involves the thread currently processing a socket effectively yielding the socket lock and processor to another thread. I think that is worthy of closer review before merge. There are a couple of potential alternatives. Plan B would be to make handing of the close message async. That is potentially better but will be more complex to implement and may uncover other complexities. Plan C would be to require useAsyncIO="true" to enable WebSocket. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf commented on pull request #605: Further fix for BZ 66508
markt-asf commented on PR #605: URL: https://github.com/apache/tomcat/pull/605#issuecomment-1486301345 Sorry. Branch in wrong repo. I'll resubmit. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf closed pull request #605: Further fix for BZ 66508
markt-asf closed pull request #605: Further fix for BZ 66508 URL: https://github.com/apache/tomcat/pull/605 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] markt-asf opened a new pull request, #606: Further fix for BZ 66508
markt-asf opened a new pull request, #606: URL: https://github.com/apache/tomcat/pull/606 https://bz.apache.org/bugzilla/show_bug.cgi?id=66508 Avoid deadlock for close messages when WsRemoteEndpointImplServer.endMessage() for a previous message is processed on a container thread The fix for this involves the thread currently processing a socket effectively yielding the socket lock and processor to another thread. I think that is worthy of closer review before merge. There are a couple of potential alternatives. Plan B would be to make handing of the close message async. That is potentially better but will be more complex to implement and may uncover other complexities. Plan C would be to require useAsyncIO="true" to enable WebSocket. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [GitHub] [tomcat] markt-asf opened a new pull request, #606: Further fix for BZ 66508
On 28/03/2023 07:44, markt-asf (via GitHub) wrote: markt-asf opened a new pull request, #606: URL: https://github.com/apache/tomcat/pull/606 https://bz.apache.org/bugzilla/show_bug.cgi?id=66508 I'd really like to get this fixed for the April releases but the fix is non-trivial. Review would be very welcome. I have some ideas for a unit test that I'll try and get to later this week. Mark Avoid deadlock for close messages when WsRemoteEndpointImplServer.endMessage() for a previous message is processed on a container thread The fix for this involves the thread currently processing a socket effectively yielding the socket lock and processor to another thread. I think that is worthy of closer review before merge. There are a couple of potential alternatives. Plan B would be to make handing of the close message async. That is potentially better but will be more complex to implement and may uncover other complexities. Plan C would be to require useAsyncIO="true" to enable WebSocket. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org