Allow null argument for ResponseEntity.DefaultBuilder.eTag(String etag)
#28947
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Affects: v5.3.22
Description
Building a response with etags can result in a
NullPointerException
if the argument foretag
isnull
. Surprisingly,HttpHeaders.setETag(@Nullable String etag)
handlesnull
arguments and is called inResponseEntity.DefaultBuilder.eTag(String etag)
.Sample Code
Effected Code
spring-framework/spring-web/src/main/java/org/springframework/http/ResponseEntity.java
Lines 565 to 574 in b72ee5f
spring-framework/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
Lines 1042 to 1052 in b72ee5f
Solution
null
stringsnull
strings (likeHttpHeaders.setETag()
already does)Therefore it should be safe just to call
HttpHeaders.setETag()
fornull
values:The text was updated successfully, but these errors were encountered: