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

NullPointerException can happen in HttpRequestMethodNotSupportedException.getSupportedHttpMethods() [SPR-15377] #19941

spring-issuemaster opened this issue Mar 23, 2017 · 1 comment


None yet
2 participants
Copy link

commented Mar 23, 2017

Istvan Ratkai opened SPR-15377 and commented

You can create an object without supportedMethod array.
public HttpRequestMethodNotSupportedException(String method) {
this(method, (String[]) null);

However when getSupportedHttpMethods() is called there is no null-check for this.supportedMethods in it:

public Set<HttpMethod> getSupportedHttpMethods() {
	List<HttpMethod> supportedMethods = new LinkedList<HttpMethod>();
	for (String value : this.supportedMethods) {
		HttpMethod resolved = HttpMethod.resolve(value);
		if (resolved != null) {
	return EnumSet.copyOf(supportedMethods);

Affects: 4.3.7


This comment has been minimized.

Copy link
Collaborator Author

commented Mar 23, 2017

Juergen Hoeller commented

I've clarified and revised the null handling for both getSupportedMethods and getSupportedHttpMethods, as well as the corresponding constructors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.