Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathResourceResolver.getResource() does not log warning if Resource#getURL() throws exception #31624

Closed
github-actions bot opened this issue Nov 19, 2023 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch type: bug A general bug
Milestone

Comments

@github-actions
Copy link
Contributor

Backport of gh-31623

@github-actions github-actions bot added in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch type: bug A general bug labels Nov 19, 2023
@github-actions github-actions bot added this to the 6.0.15 milestone Nov 19, 2023
@sbrannen sbrannen self-assigned this Nov 19, 2023
sbrannen added a commit that referenced this issue Nov 20, 2023
Prior to this commit, the getResource() methods in PathResourceResolver
implementations allowed an exception thrown from Resource#getURL() to
propagate instead of logging a warning about the missing resource as
intended.

This commit modifies the getResource() methods in PathResourceResolver
implementations so that the log messages include the output of the
toString() implementations of the underlying resources instead of their
getURL() implementations, which may throw an exception.

Furthermore, logging the toString() output of resources aligns with the
existing output for "allowed locations" in the same log message.

Note that the toString() implementations could potentially also throw
exceptions, but that is considered less likely.

See gh-31623
Closes gh-31624

(cherry picked from commit 7d2ea7e)
Copy link
Contributor Author

Fixed via 86b8a70

@sbrannen sbrannen changed the title Servlet-based PathResourceResolver.getResource() never logs a warning for non-existent ServletContextResource PathResourceResolver.getResource() does not log warning if Resource#getURL() throws exception Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant