yykaue opened a new pull request, #6918:
URL: https://github.com/apache/shenyu/pull/6918

   Fixes #6765
   
   Thanks @Aias00 for reporting this issue.
   
   ## What this PR does
   
   This PR fixes a `ClassCastException` in 
`LoggingServerHttpResponse.logError()` when handling a 
`ResponseStatusException` with a non-standard HTTP status code.
   
   In Spring 6, `ResponseStatusException#getStatusCode()` returns 
`HttpStatusCode`. Non-standard status codes are represented by 
`DefaultHttpStatusCode`, which cannot be cast to the `HttpStatus` enum.
   
   This PR:
   
   - Removes the unsafe cast from `HttpStatusCode` to `HttpStatus`.
   - Uses `HttpStatus.resolve()` to preserve the reason phrase for standard 
status codes.
   - Falls back to the numeric status code for non-standard status codes.
   - Adds a regression test covering HTTP status code `599`.
   - Verifies that the error log is collected successfully with the correct 
status and message.
   
   ## Tests
   
   ```text
   ./mvnw -o -pl 
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common \
     -Dtest=LoggingServerHttpResponseStatusTest test


-- 
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]

Reply via email to