Skip to content

Null path after UriComponents.normalize() results in NullPointerException [SPR-16364] #20911

Closed
@spring-projects-issues

Description

@spring-projects-issues

cda opened SPR-16364 and commented

Test case:

UriComponents uri1 = UriComponentsBuilder.fromUriString( "http://test.com" ).build().normalize();
UriComponents uri2 = UriComponentsBuilder.fromUriString( "http://test.com/" ).build();
assert !uri1.equals( uri2 );

Throws:

java.lang.NullPointerException
	at org.springframework.web.util.HierarchicalUriComponents$FullPathComponent.equals(HierarchicalUriComponents.java:700)
	at org.springframework.web.util.HierarchicalUriComponents.equals(HierarchicalUriComponents.java:464)
...

Also, this code throws NullPointerException:

UriComponentsBuilder.fromUriString( "http://test.com" ).build().normalize().getPathSegments()

Affects: 4.3.12

Issue Links:

Referenced from: commits 93f6458, f68fdd4

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