-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SslBundle implementations do not provide useful toString() results #39137
SslBundle implementations do not provide useful toString() results #39137
Conversation
…s of SslBundle
…s of SslBundle
What about keystore type, keystore location, truststore type and location, those would also be beneficial to know, no? |
I have added keystore type and truststore type (if truststore is not null, otherwise it would throw NullPointerException) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the PR, @amparab.
There's a utility in Spring Framework, ToStringCreator
, that we like to use for this sort of thing. Here's one existing example in Spring Boot's code of how it's used:
Lines 162 to 170 in 4fa47aa
@Override | |
public String toString() { | |
ToStringCreator creator = new ToStringCreator(this); | |
creator.append("type", this.type); | |
creator.append("value", (this.value != null) ? "provided" : "none"); | |
creator.append("annotations", this.annotations); | |
creator.append("bindMethod", this.bindMethod); | |
return creator.toString(); | |
} |
Would you like to update your proposal to use it? Please don't worry if you don't have time, we can always take care of it as part of merging the change.
Could you transport that location info (add it to the code) just for that purpose maybe? |
That's a much broader and more complex change, particularly as some values can either be a location from which something is loaded or something inlined directly. As a first pass, for this PR let's focus on the things that are readily available. We can then perhaps consider a second pass that does something more complex, possibly through implementation of the |
Sounds good :) |
Hello @wilkinsona. I have updated the PR :-) Please let me know if any other changes. |
@amparab thank you very much for making your first contribution to Spring Boot |
Fixes #39057
Change proposed :
I have added a toString() method in the implementations for SslBundle interface.
There were two implementations :
This toString() method prints the following attributes of the respective class:
Attaching a screenshot of the line printed when object is logged :