Copilot commented on code in PR #6385:
URL: https://github.com/apache/shenyu/pull/6385#discussion_r3417999466
##########
shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/config/WebsocketConfig.java:
##########
@@ -92,6 +114,7 @@ public String toString() {
+ urls
+ ", allowOrigin='"
+ allowOrigin
+ + ", token='******"
+ '}';
}
Review Comment:
`toString()` currently produces a malformed representation (missing closing
quotes around `urls`/`allowOrigin` and `token`). Since this is used for
logging/debugging, it should be a syntactically consistent string while still
masking the token value.
##########
shenyu-sync-data-center/shenyu-sync-data-websocket/src/test/java/org/apache/shenyu/plugin/sync/data/websocket/config/WebsocketConfigTest.java:
##########
@@ -64,13 +70,14 @@ public void testEquals() {
@Test
public void testHashCode() {
- assertEquals(Objects.hash(websocketConfig.getUrls(),
websocketConfig.getAllowOrigin()), websocketConfig.hashCode());
+ assertEquals(Objects.hash(websocketConfig.getUrls(),
websocketConfig.getAllowOrigin(), websocketConfig.getToken()),
websocketConfig.hashCode());
}
@Test
public void testToString() {
- String toString = "WebsocketConfig{urls='%s, allowOrigin='%s}";
+ String toString = "WebsocketConfig{urls='%s, allowOrigin='%s,
token='******}";
Review Comment:
This expected `toString()` format is coupled to the current malformed
`WebsocketConfig.toString()` output. If `WebsocketConfig.toString()` is
corrected to include proper quoting while still masking the token, update the
expected string here to match.
--
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]