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

Guard against NPE in PathMatchConfigurer #28816

Closed
mbhave opened this issue Jul 13, 2022 · 0 comments
Closed

Guard against NPE in PathMatchConfigurer #28816

mbhave opened this issue Jul 13, 2022 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@mbhave
Copy link
Contributor

mbhave commented Jul 13, 2022

This would cause an NPE if suffixPatternMatch is null.

Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because "suffixPatternMatch" is null
	at org.springframework.web.servlet.config.annotation.PathMatchConfigurer.setUseSuffixPatternMatch(PathMatchConfigurer.java:156) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at com.example.demo.PathMatchingThingyApplication.configurePathMatch(PathMatchingThingyApplication.java:14) ~[main/:na]
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.configurePathMatch(WebMvcConfigurerComposite.java:53) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.configurePathMatch(DelegatingWebMvcConfiguration.java:58) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getPathMatchConfigurer(WebMvcConfigurationSupport.java:388) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.mvcResourceUrlProvider(WebMvcConfigurationSupport.java:614) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:130) ~[spring-beans-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	... 34 common frames omitted

While the API doesn't expect nulls, it's worth investigating whether switching to boolean or adding an Assert would be possible. Similar case for registeredSuffixPatternMatch .

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 13, 2022
@rstoyanchev rstoyanchev self-assigned this Jul 13, 2022
@rstoyanchev rstoyanchev added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 13, 2022
@rstoyanchev rstoyanchev added this to the 6.0.0-M5 milestone Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants