nikhiln64 opened a new pull request, #6899: URL: https://github.com/apache/shenyu/pull/6899
Fixes #6884 desensitizeShenyuRequestLog unconditionally calls toString on three boxed numeric fields of ShenyuRequestLog. For byte type media appendResponse invokes logResponse with a null writer, so a chunked response with no Content-Length header reaches desensitize with responseContentLength still null and the collector throws an NPE inside the response doFinally, losing the access log for that request. status and upstreamResponseTime are nullable on the same class of paths. This change guards each of the three fields with Objects.nonNull before desensitizing, matching the null tolerance the String fields already get from StringUtils.hasLength inside desensitizeForSingleWord. Added AbstractLogCollectorTest covering the null case (chunked byte response shape) and the populated case (values preserved when keywords do not match them). Note for reviewers, the issue body on #6884 describes a different bug due to an off by one paste in the Aug 4 batch, the analysis matching this title is in the body of #6883, details in my comment on the issue. Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true` (module scoped build of shenyu-plugin-logging-common with tests). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
