Fix logging IP version 6 addresses with scope in RediscoveryImpl #1435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Inet6Address.getHostAddress()
returns a string with%scope-id
at the end if it is scoped. For instance,fe80:0:0:0:ce66:1564:db8q:94b6%6
.The
RediscoveryImpl
error handling logic used to construct a log message with such address that it logged using theLogger.warn(String, Object...)
method. Example:log.warn(message)
.Some implementations of the
Logger
interface supply the values given directly to theString.format(String, Object...)
method. Given that the first argument is considered to be a format string, anIllegalFormatException
may be thrown. That used to happen when the log message contained the scoped IP version 6getHostAddress()
value since the log message was treated as the format string.This update fixes this issue by supplying the format string and the address values individually and letting the logger implementations to do the formatting as the log message should not be seen as the format string value.