@@ -58,37 +58,37 @@ public OnCommittedResponseWrapper(HttpServletResponse response) {
5858 }
5959
6060 @ Override
61- public void addHeader (String name , String value ) {
61+ public void addHeader (@ Nullable String name , @ Nullable String value ) {
6262 checkContentLengthHeader (name , value );
6363 super .addHeader (name , value );
6464 }
6565
6666 @ Override
67- public void addIntHeader (String name , int value ) {
67+ public void addIntHeader (@ Nullable String name , int value ) {
6868 checkContentLengthHeader (name , value );
6969 super .addIntHeader (name , value );
7070 }
7171
7272 @ Override
73- public void setHeader (String name , String value ) {
73+ public void setHeader (@ Nullable String name , @ Nullable String value ) {
7474 checkContentLengthHeader (name , value );
7575 super .setHeader (name , value );
7676 }
7777
7878 @ Override
79- public void setIntHeader (String name , int value ) {
79+ public void setIntHeader (@ Nullable String name , int value ) {
8080 checkContentLengthHeader (name , value );
8181 super .setIntHeader (name , value );
8282 }
8383
84- private void checkContentLengthHeader (String name , int value ) {
84+ private void checkContentLengthHeader (@ Nullable String name , int value ) {
8585 if ("Content-Length" .equalsIgnoreCase (name )) {
8686 setContentLength (value );
8787 }
8888 }
8989
90- private void checkContentLengthHeader (String name , String value ) {
91- if ("Content-Length" .equalsIgnoreCase (name )) {
90+ private void checkContentLengthHeader (@ Nullable String name , @ Nullable String value ) {
91+ if (value != null && "Content-Length" .equalsIgnoreCase (name )) {
9292 setContentLength (Long .parseLong (value ));
9393 }
9494 }
@@ -150,7 +150,7 @@ public final void sendError(int sc) throws IOException {
150150 * before calling the superclass <code>sendError()</code>
151151 */
152152 @ Override
153- public final void sendError (int sc , String msg ) throws IOException {
153+ public final void sendError (int sc , @ Nullable String msg ) throws IOException {
154154 doOnResponseCommitted ();
155155 super .sendError (sc , msg );
156156 }
@@ -160,7 +160,7 @@ public final void sendError(int sc, String msg) throws IOException {
160160 * before calling the superclass <code>sendRedirect()</code>
161161 */
162162 @ Override
163- public final void sendRedirect (String location ) throws IOException {
163+ public final void sendRedirect (@ Nullable String location ) throws IOException {
164164 doOnResponseCommitted ();
165165 super .sendRedirect (location );
166166 }
@@ -207,7 +207,7 @@ private void trackContentLength(char content) {
207207 }
208208 }
209209
210- private void trackContentLength (Object content ) {
210+ private void trackContentLength (@ Nullable Object content ) {
211211 if (!this .disableOnCommitted ) {
212212 trackContentLength (String .valueOf (content ));
213213 }
@@ -249,7 +249,7 @@ private void trackContentLengthLn() {
249249 }
250250 }
251251
252- private void trackContentLength (String content ) {
252+ private void trackContentLength (@ Nullable String content ) {
253253 if (!this .disableOnCommitted ) {
254254 int contentLength = (content != null ) ? content .length () : 4 ;
255255 checkContentLength (contentLength );
@@ -356,7 +356,7 @@ public void write(String s, int off, int len) {
356356 }
357357
358358 @ Override
359- public void write (String s ) {
359+ public void write (@ Nullable String s ) {
360360 trackContentLength (s );
361361 this .delegate .write (s );
362362 }
@@ -404,13 +404,13 @@ public void print(char[] s) {
404404 }
405405
406406 @ Override
407- public void print (String s ) {
407+ public void print (@ Nullable String s ) {
408408 trackContentLength (s );
409409 this .delegate .print (s );
410410 }
411411
412412 @ Override
413- public void print (Object obj ) {
413+ public void print (@ Nullable Object obj ) {
414414 trackContentLength (obj );
415415 this .delegate .print (obj );
416416 }
@@ -471,14 +471,14 @@ public void println(char[] x) {
471471 }
472472
473473 @ Override
474- public void println (String x ) {
474+ public void println (@ Nullable String x ) {
475475 trackContentLength (x );
476476 trackContentLengthLn ();
477477 this .delegate .println (x );
478478 }
479479
480480 @ Override
481- public void println (Object x ) {
481+ public void println (@ Nullable Object x ) {
482482 trackContentLength (x );
483483 trackContentLengthLn ();
484484 this .delegate .println (x );
@@ -505,13 +505,13 @@ public PrintWriter format(Locale l, String format, Object... args) {
505505 }
506506
507507 @ Override
508- public PrintWriter append (CharSequence csq ) {
509- checkContentLength (csq .length ());
508+ public PrintWriter append (@ Nullable CharSequence csq ) {
509+ checkContentLength (( csq != null ) ? csq .length () : 4 );
510510 return this .delegate .append (csq );
511511 }
512512
513513 @ Override
514- public PrintWriter append (CharSequence csq , int start , int end ) {
514+ public PrintWriter append (@ Nullable CharSequence csq , int start , int end ) {
515515 checkContentLength (end - start );
516516 return this .delegate .append (csq , start , end );
517517 }
@@ -596,7 +596,7 @@ public void print(long l) throws IOException {
596596 }
597597
598598 @ Override
599- public void print (String s ) throws IOException {
599+ public void print (@ Nullable String s ) throws IOException {
600600 trackContentLength (s );
601601 this .delegate .print (s );
602602 }
@@ -650,7 +650,7 @@ public void println(long l) throws IOException {
650650 }
651651
652652 @ Override
653- public void println (String s ) throws IOException {
653+ public void println (@ Nullable String s ) throws IOException {
654654 trackContentLength (s );
655655 trackContentLengthLn ();
656656 this .delegate .println (s );
0 commit comments