this is not supposed to return null (#3998)

see https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/Part.html#getHeaders-java.lang.String-
this fix related tck test

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
Olivier Lamy 2019-08-19 10:08:21 +10:00 committed by GitHub
parent 9fce1e8512
commit 7c0266af4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -205,7 +205,8 @@ public class MultiPartFormInputStream
@Override
public Collection<String> getHeaders(String name)
{
return _headers.getValues(name);
Collection<String> headers = _headers.getValues(name);
return headers == null ? Collections.emptyList():headers;
}
@Override

View File

@ -786,6 +786,8 @@ public class MultiPartFormInputStreamTest
assertThat(stuff.getContentType(), is("text/plain"));
assertThat(stuff.getHeader("Content-Type"), is("text/plain"));
assertThat(stuff.getHeaders("content-type").size(), is(1));
assertNotNull(stuff.getHeaders("non existing part"));
assertThat(stuff.getHeaders("non existing part").size(), is(0));
assertThat(stuff.getHeader("content-disposition"), is("form-data; name=\"stuff\"; filename=\"" + filename + "\""));
assertThat(stuff.getHeaderNames().size(), is(2));
assertThat(stuff.getSize(), is(51L));