diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java index cec5db3f1f..5c103d8775 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java @@ -23,6 +23,7 @@ package org.jboss.netty.handler.codec.http; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -207,7 +208,12 @@ public class DefaultHttpMessage implements HttpMessage { } public List getHeaders(final String name) { - return headers.get(name); + List values = headers.get(name); + if (values == null) { + return Collections.emptyList(); + } else { + return values; + } } public boolean containsHeader(final String name) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java index 722dd9b122..934d095f7a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java @@ -52,8 +52,8 @@ public interface HttpMessage { /** * Returns the header values with the specified header name. * - * @return the {@link List} of header values of {@code null} if there is - * no such header + * @return the {@link List} of header values. An empty list if there is no + * such header. */ List getHeaders(String name);