Skip to content

Commit 9cf2cf0

Browse files
committed
pr review
1 parent 75b93e8 commit 9cf2cf0

File tree

1 file changed

+3
-8
lines changed
  • instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/internal

1 file changed

+3
-8
lines changed

instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/internal/HeaderUtil.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.lang.invoke.MethodHandles;
1212
import java.lang.invoke.MethodType;
1313
import java.util.List;
14-
import java.util.Map;
1514
import org.springframework.http.HttpHeaders;
1615

1716
/**
@@ -38,17 +37,13 @@ private static MethodHandle findGetHeadersMethod(MethodType methodType) {
3837
// before spring web 7.0 HttpHeaders implements Map<String, List<String>>, this triggers
3938
// errorprone BadInstanceof warning since errorpone is not aware that this instanceof check does
4039
// not pass with spring web 7.0+
41-
@SuppressWarnings({"unchecked", "BadInstanceof"})
40+
@SuppressWarnings("unchecked") // casting GET_HEADERS.invoke result
4241
public static List<String> getHeader(HttpHeaders headers, String name) {
43-
if (headers instanceof Map) {
44-
// before spring web 7.0
45-
return ((Map<String, List<String>>) headers).getOrDefault(name, emptyList());
46-
} else if (GET_HEADERS != null) {
47-
// spring web 7.0
42+
if (headers != null) {
4843
try {
4944
return (List<String>) GET_HEADERS.invoke(headers, name, emptyList());
5045
} catch (Throwable t) {
51-
// ignore
46+
throw new IllegalStateException(t);
5247
}
5348
}
5449
return emptyList();

0 commit comments

Comments
 (0)