2424import java .util .Map ;
2525import java .util .concurrent .TimeUnit ;
2626
27- import static java .util .Objects .requireNonNull ;
28-
2927/**
3028 * Response cookie implementation. Response are send it back to client using
3129 * {@link Context#setResponseCookie(Cookie)}.
@@ -402,9 +400,12 @@ public long getMaxAge() {
402400 /**
403401 * Encode a hash into cookie value, like: <code>k1=v1&...&kn=vn</code>. Also,
404402 * <code>key</code> and <code>value</code> are encoded using {@link URLEncoder}.
403+ *
404+ * @param attributes Map to encode.
405+ * @return URL encoded from map attributes.
405406 */
406- public static String encode (Map <String , String > attributes ) {
407- if (attributes .size () == 0 ) {
407+ public static @ Nonnull String encode (@ Nullable Map <String , String > attributes ) {
408+ if (attributes == null || attributes .size () == 0 ) {
408409 return "" ;
409410 }
410411 try {
@@ -429,8 +430,11 @@ public static String encode(Map<String, String> attributes) {
429430 * Decode a cookie value using, like: <code>k=v</code>, multiple <code>k=v</code> pair are
430431 * separated by <code>&</code>. Also, <code>k</code> and <code>v</code> are decoded using
431432 * {@link URLDecoder}.
433+ *
434+ * @param value URL encoded value.
435+ * @return Decoded as map.
432436 */
433- public static Map <String , String > decode (String value ) {
437+ public static @ Nonnull Map <String , String > decode (@ Nullable String value ) {
434438 if (value == null || value .length () == 0 ) {
435439 return Collections .emptyMap ();
436440 }
0 commit comments