Skip to content

Commit 5c6b9be

Browse files
committed
Send 400 for PathVariable that is null after conversion
This implies a value was actually sent, but is not something that can be converted to the expected type. Closes gh-31382
1 parent 33fba8e commit 5c6b9be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-web/src/main/java/org/springframework/web/bind/MissingPathVariableException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -88,7 +88,7 @@ public final MethodParameter getParameter() {
8888

8989
@Override
9090
public HttpStatusCode getStatusCode() {
91-
return HttpStatus.INTERNAL_SERVER_ERROR;
91+
return (isMissingAfterConversion() ? HttpStatus.BAD_REQUEST : HttpStatus.INTERNAL_SERVER_ERROR);
9292
}
9393

9494
}

0 commit comments

Comments
 (0)