Skip to content

Is this a bug in the feign rule for the latest feign-core? #604

@qbwu

Description

@qbwu

In rule/feign/src/main/java/io/opentracing/contrib/specialagent/rule/feign/FeignAgentIntercept.java:

 private static Request inject(final Tracer tracer, final SpanContext spanContext, final Request request) {
    final HashMap<String,Collection<String>> headersWithTracingContext = new HashMap<>(request.headers());
    tracer.inject(spanContext, Format.Builtin.HTTP_HEADERS, new HttpHeadersInjectAdapter(headersWithTracingContext));
    return Request.create(request.method(), request.url(), headersWithTracingContext, request.body(), request.charset());
 }

The ending return statement calls the Request.create, which is a deprecated method for the latest feign-core, and it will create a Request with requestTemplate = null, and when others try to use the RequestTemplate to revise the Request later, it will throw a NPE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions