NPE when using pathExtension
predicate for routes that have no file extensions
#32404
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Affects: Spring Boot 3.2.3
I have the following code which was taken from the Spring Boot docs:
This should theoretically be serving the
index.html
page for any URL that does not match the/api
,/error
or a list of extensions.However, there is a problem with the
RequestPredicates#test
method:The assumption seems to be that
pathExtension
would always contain some value.Unfortunately this is not true. We are using an Angular frontend which has it's own routing system.
The URL coming from the there is
http://localhost:8080/app/users
and obviously fails with a NPE, because thepathExtension
isnull
.Click here to see the full log
The fix would be to verify if
pathExtension
is not null before callingthis.extensionPredicate.test()
.Maybe something like this:
The text was updated successfully, but these errors were encountered: