1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -114,12 +114,14 @@ public EntityResponse.Builder<T> cookie(Cookie cookie) {
114
114
@ Override
115
115
public EntityResponse .Builder <T > cookies (
116
116
Consumer <MultiValueMap <String , Cookie >> cookiesConsumer ) {
117
+ Assert .notNull (cookiesConsumer , "cookiesConsumer must not be null" );
117
118
cookiesConsumer .accept (this .cookies );
118
119
return this ;
119
120
}
120
121
121
122
@ Override
122
123
public EntityResponse .Builder <T > header (String headerName , String ... headerValues ) {
124
+ Assert .notNull (headerName , "headerName must not be null" );
123
125
for (String headerValue : headerValues ) {
124
126
this .headers .add (headerName , headerValue );
125
127
}
@@ -128,18 +130,21 @@ public EntityResponse.Builder<T> header(String headerName, String... headerValue
128
130
129
131
@ Override
130
132
public EntityResponse .Builder <T > headers (Consumer <HttpHeaders > headersConsumer ) {
133
+ Assert .notNull (headersConsumer , "headersConsumer must not be null" );
131
134
headersConsumer .accept (this .headers );
132
135
return this ;
133
136
}
134
137
135
138
@ Override
136
139
public EntityResponse .Builder <T > allow (HttpMethod ... allowedMethods ) {
140
+ Assert .notNull (allowedMethods , "allowedMethods must not be null" );
137
141
this .headers .setAllow (new LinkedHashSet <>(Arrays .asList (allowedMethods )));
138
142
return this ;
139
143
}
140
144
141
145
@ Override
142
146
public EntityResponse .Builder <T > allow (Set <HttpMethod > allowedMethods ) {
147
+ Assert .notNull (allowedMethods , "allowedMethods must not be null" );
143
148
this .headers .setAllow (allowedMethods );
144
149
return this ;
145
150
}
@@ -152,6 +157,7 @@ public EntityResponse.Builder<T> contentLength(long contentLength) {
152
157
153
158
@ Override
154
159
public EntityResponse .Builder <T > contentType (MediaType contentType ) {
160
+ Assert .notNull (contentType , "contentType must not be null" );
155
161
this .headers .setContentType (contentType );
156
162
return this ;
157
163
}
@@ -170,24 +176,28 @@ public EntityResponse.Builder<T> eTag(String etag) {
170
176
171
177
@ Override
172
178
public EntityResponse .Builder <T > lastModified (ZonedDateTime lastModified ) {
179
+ Assert .notNull (lastModified , "lastModified must not be null" );
173
180
this .headers .setLastModified (lastModified );
174
181
return this ;
175
182
}
176
183
177
184
@ Override
178
185
public EntityResponse .Builder <T > lastModified (Instant lastModified ) {
186
+ Assert .notNull (lastModified , "lastModified must not be null" );
179
187
this .headers .setLastModified (lastModified );
180
188
return this ;
181
189
}
182
190
183
191
@ Override
184
192
public EntityResponse .Builder <T > location (URI location ) {
193
+ Assert .notNull (location , "location must not be null" );
185
194
this .headers .setLocation (location );
186
195
return this ;
187
196
}
188
197
189
198
@ Override
190
199
public EntityResponse .Builder <T > cacheControl (CacheControl cacheControl ) {
200
+ Assert .notNull (cacheControl , "cacheControl must not be null" );
191
201
this .headers .setCacheControl (cacheControl );
192
202
return this ;
193
203
}
0 commit comments