Skip to content

[BUG] RewritePlugin placeholder branch drops first character of path-variable value + StringIndexOutOfBounds when regex lacks { #6883

Description

@Aias00

Description

responseContentLength is a boxed Integer (default null). For a byte-type response with no Content-Length header (chunked/streamed), it stays null. When desensitization is enabled, desensitizeShenyuRequestLog calls .toString() on the null boxed value → NPE. Same unguarded .toString() pattern on status (:192) and upstreamResponseTime (:195).

Location

  • shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java:189-190,192,194-195

Impact

NPE thrown inside doFinally on the request thread for desensitization-enabled + byte-type chunked responses; that log lost.

Suggested fix

Null-guard before .toString() (e.g. String.valueOf(logInfo.getResponseContentLength())).

Related existing

None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions