UriComponentsBuilder.fromUriString(...) appears to parse a relative URI with a fragment incorrectly.
For the input:
the resulting UriComponents has:
path = "path2"
fragment = "path2#foo"
instead of:
path = "path2"
fragment = "foo"
As a result, toUriString() produces:
instead of:
Reproduction
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
public class Repro {
public static void main(String[] args) {
UriComponents u = UriComponentsBuilder.fromUriString("path2#foo").build();
System.out.println("path=" + u.getPath());
System.out.println("fragment=" + u.getFragment());
System.out.println("uriString=" + u.toUriString());
}
}
Actual result
path=path2
fragment=path2#foo
uriString=path2#path2#foo
Expected result
path=path2
fragment=foo
uriString=path2#foo
Version
Observed with:
UriComponentsBuilder.fromUriString(...)appears to parse a relative URI with a fragment incorrectly.For the input:
the resulting UriComponents has:
path = "path2"fragment = "path2#foo"instead of:
path = "path2"fragment = "foo"As a result, toUriString() produces:
instead of:
Reproduction
Actual result
Expected result
Version
Observed with: