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

HierarchicalUriComponents::getPort() throws NumberFormatException with invalid port in URI #28521

Closed
Jackson-S opened this issue May 25, 2022 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@Jackson-S
Copy link

Jackson-S commented May 25, 2022

Affects: 5.3.18


HierarchicalUriComponents::toUri() throws java.lang.NumberFormatException instead of the expected IllegalStateException when provided with a URI of the format https://x.com:string.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 25, 2022
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 25, 2022
@sbrannen sbrannen added this to the 5.3.21 milestone May 25, 2022
@sbrannen sbrannen self-assigned this May 25, 2022
@sbrannen sbrannen changed the title HierarchicalUriComponents::toUri() returns NumberFormatException with invalid port in URI HierarchicalUriComponents::getPort() throws NumberFormatException with invalid port in URI May 25, 2022
@sbrannen
Copy link
Member

sbrannen commented May 25, 2022

The underlying issue is that HierarchicalUriComponents.getPort() invokes Integer.parseInt() which throws the NumberFormatException.

Thus, invocations of getPort(), toUri(), toUriString(), and toString() are all affected.

@sbrannen
Copy link
Member

This has been addressed in 5.3.x and main.

@Jackson-S, thanks for submitting your first issue for the Spring Framework! 👍

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: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants