Enhance thread context uniqueness assertion

This commit enhances the assertion message when de-duplicating values on
a thread context header so that if this assertion trips we can see the
values and their correpsonding unique values to understand why this
assertion might trip.
This commit is contained in:
Jason Tedor 2018-06-26 00:01:45 -04:00
parent 357a07e7a2
commit 424be02728
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 2 additions and 1 deletions

View File

@ -489,7 +489,8 @@ public final class ThreadContext implements Closeable, Writeable {
final List<String> existingValues = newResponseHeaders.get(key);
if (existingValues != null) {
final Set<String> existingUniqueValues = existingValues.stream().map(uniqueValue).collect(Collectors.toSet());
assert existingValues.size() == existingUniqueValues.size();
assert existingValues.size() == existingUniqueValues.size() :
"existing values: [" + existingValues + "], existing unique values [" + existingUniqueValues + "]";
if (existingUniqueValues.contains(uniqueValue.apply(value))) {
return this;
}