HttpMessage.getHeaders() never returns null for convenience
This commit is contained in:
parent
6158f7772f
commit
281b4507df
@ -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<String> getHeaders(final String name) {
|
||||
return headers.get(name);
|
||||
List<String> values = headers.get(name);
|
||||
if (values == null) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsHeader(final String name) {
|
||||
|
@ -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<String> getHeaders(String name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user