Skip to content

Commit f80dc37

Browse files
author
Stephane Landelle
committed
FluentCaseInsensitiveStringsMap.get should return an empty immutable list instead of null, close AsyncHttpClient#758
1 parent cdf70a5 commit f80dc37

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

api/src/main/java/org/asynchttpclient/FluentCaseInsensitiveStringsMap.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,13 @@ public String getJoinedValue(String key, String delimiter) {
449449
*/
450450
@Override
451451
public List<String> get(Object key) {
452-
if (key == null) {
453-
return null;
454-
}
452+
if (key == null)
453+
return Collections.emptyList();
455454

456455
String lcKey = key.toString().toLowerCase(Locale.ENGLISH);
457456
String realKey = keyLookup.get(lcKey);
458457

459-
if (realKey == null) {
460-
return null;
461-
} else {
462-
return values.get(realKey);
463-
}
458+
return realKey != null ? values.get(realKey) : Collections.<String> emptyList();
464459
}
465460

466461
/**

0 commit comments

Comments
 (0)