Alternate fix for #1319
Turns out the issue wasn't with an empty string returning an empty array, but a string with just `,`. ``` jshell> ",".split(",") $1 ==> String[0] { } ``` A non-intuitive edge case in my opinion.
This commit is contained in:
parent
176b9c0121
commit
e7f0d2db12
|
@ -299,12 +299,15 @@ public final class OpenTracing32 implements TracerAPI {
|
||||||
extracted = new HashMap<>();
|
extracted = new HashMap<>();
|
||||||
for (final String key : getter.keys(carrier)) {
|
for (final String key : getter.keys(carrier)) {
|
||||||
// extracted header value
|
// extracted header value
|
||||||
String s = getter.get(carrier, key);
|
String value = getter.get(carrier, key);
|
||||||
// in case of multiple values in the header, need to parse
|
// in case of multiple values in the header, need to parse
|
||||||
if (s != null && !s.isEmpty()) {
|
if (value != null) {
|
||||||
s = s.split(",")[0].trim();
|
final String[] split = value.split(",");
|
||||||
|
if (split.length > 0) {
|
||||||
|
value = split[0].trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extracted.put(key, s);
|
extracted.put(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue