Fix NullPointerException when call "ReactiveRequestHolder.getHeaders" (#6651)
This commit is contained in:
parent
523944a59f
commit
9a3e8357cc
|
|
@ -27,6 +27,7 @@ Release Notes.
|
|||
* Replace hbase-1.x-plugin with hbase-1.x-2.x-plugin to adapt hbase client 2.x
|
||||
* Remove the close_before_method and close_after_method parameters of custom-enhance-plugin to avoid memory leaks.
|
||||
* Fix bug that springmvn-annotation-4.x-plugin, witness class does not exist in some versions.
|
||||
* Fix NullPointerException with `ReactiveRequestHolder.getHeaders`.
|
||||
|
||||
#### OAP-Backend
|
||||
* Allow user-defined `JAVA_OPTS` in the startup script.
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons;
|
|||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
|
||||
|
|
@ -37,7 +38,11 @@ public class ReactiveRequestHolder implements RequestHolder {
|
|||
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(final String headerName) {
|
||||
return Collections.enumeration(this.serverHttpRequest.getHeaders().get(headerName));
|
||||
List<String> values = this.serverHttpRequest.getHeaders().get(headerName);
|
||||
if (values == null) {
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
return Collections.enumeration(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue