Skip to content

Commit

Permalink
[CXF-8939]java.lang.NullPointerException: Cannot invoke (#1461)
Browse files Browse the repository at this point in the history
"java.util.List.size()" because the return value of
"java.util.Map$Entry.getValue()" is null

(cherry picked from commit a6b0b5b)
  • Loading branch information
garydgregory authored and reta committed Oct 4, 2023
1 parent 32b8cd0 commit 8a0f39d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ private Map<String, String> getHeaders(Message message) {
return result;
}
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
if (entry.getValue().size() == 1) {
Object value = entry.getValue().get(0);
List<Object> list = entry.getValue() != null ? entry.getValue() : Collections.emptyList();
if (list.size() == 1) {
Object value = list.get(0);
if (value != null) {
result.put(entry.getKey(), value.toString());
}
} else {
result.put(entry.getKey(), Arrays.deepToString(entry.getValue().toArray()));
result.put(entry.getKey(), Arrays.deepToString(list.toArray()));
}
}
return result;
Expand Down

0 comments on commit 8a0f39d

Please sign in to comment.