Skip to content

Commit 1dc346a

Browse files
committed
SPR-5802 - NullPointerException when using @CookieValue annotation
1 parent 6403107 commit 1dc346a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,12 @@ protected Object resolveCookieValue(String cookieName, Class paramType, NativeWe
638638
if (Cookie.class.isAssignableFrom(paramType)) {
639639
return cookieValue;
640640
}
641-
else {
641+
else if (cookieValue != null) {
642642
return cookieValue.getValue();
643643
}
644+
else {
645+
return null;
646+
}
644647
}
645648

646649
@Override

0 commit comments

Comments
 (0)