chibenwa commented on code in PR #2386:
URL: https://github.com/apache/james-project/pull/2386#discussion_r1725683721
##########
protocols/imap/src/main/java/org/apache/james/imap/message/response/ImmutableStatusResponse.java:
##########
@@ -72,12 +70,22 @@ public ImapCommand getCommand() {
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("responseCode", responseCode)
- .add("serverResponseType", serverResponseType)
- .add("tag", tag)
- .add("textKey", textKey)
- .add("command", command)
- .toString();
+ final StringBuilder sb = new StringBuilder();
+ if (getResponseCode() != null) {
+ sb.append(' ').append(getResponseCode());
+ }
+ if (getServerResponseType() != null) {
+ sb.append(' ').append(getServerResponseType());
+ }
+ if (getTag() != null) {
+ sb.append(' ').append(getTag());
+ }
+ if (getTextKey() != null) {
+ sb.append(' ').append(getTextKey());
+ }
+ if (getCommand() != null) {
+ sb.append(' ').append(getCommand());
+ }
+ return sb.toString();
Review Comment:
Sorry for getting chatty it is very interesting technical discussions ^^
Given
https://github.com/apache/james-project/pull/2386#discussion_r1725676546 first
this change is no longer needed.
Keeping "toString" standard definitly is valuable: apply the IDE template,
get the same everywhere.
This do not mean we should blindly apply toString to our log statements. We
can apply alternative formats. Here in this case something that kinda
duplicates StatusResponseEncoder behaviour.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]