Skip to content

UriComponentBuilder doesn't work with encoded HTTP URL having '+'. [SPR-14828] #19394

Closed
@spring-projects-issues

Description

@spring-projects-issues

Johnny Lim opened SPR-14828 and commented

'+' is valid for a space but with the following code:

String httpUrl = "http://localhost:8080/test/print?value=%EA%B0%80+%EB%82%98";
URI uri = UriComponentsBuilder.fromHttpUrl(httpUrl).build(true).toUri();
System.out.println(uri);

I got the following error:

java.lang.IllegalArgumentException: Invalid character '+' for QUERY_PARAM in "%EA%B0%80+%EB%82%98"

	at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:313)
	at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:281)
	at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:90)
	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:336)
	at learningtest.org.springframework.web.UriComponentBuilderTests.testFromHttpUrlBuildEncoded(UriComponentBuilderTests.java:19)

Affects: 4.3.3

Reference URL: https://github.com/izeye/spring-boot-throwaway-branches/blob/rest-and-logback-access/src/test/java/learningtest/org/springframework/web/UriComponentBuilderTests.java

Issue Links:

Referenced from: commits f2e293a

1 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions