Skip to content

Conversation

injectives
Copy link
Contributor

@injectives injectives commented Jun 21, 2023

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 the Logger.warn(String, Object...) method. Example: log.warn(message).

Some implementations of the Logger interface supply the values given directly to the String.format(String, Object...) method. Given that the first argument is considered to be a format string, an IllegalFormatException may be thrown. That used to happen when the log message contained the scoped IP version 6 getHostAddress() 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.

@injectives injectives changed the title Bugfix Fix logging IP version 6 addresses with scope in RediscoveryImpl Jun 21, 2023
@injectives injectives force-pushed the bugfix/logging branch 6 times, most recently from 485041a to faa473b Compare June 21, 2023 20:11
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 the `Logger.warn(String, Object...)` method. Example: `log.warn(message)`.

Some implementations of the `Logger` interface supply the values given directly to the `String.format(String, Object...)` method. Given that the first argument is considered to be a format string, an `IllegalFormatException` may be thrown. That used to happen when the log message contained the scoped IP version 6 `getHostAddress()` 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.
@injectives injectives merged commit c5bf627 into neo4j:5.0 Jun 22, 2023
@injectives injectives deleted the bugfix/logging branch June 22, 2023 07:46
injectives added a commit to injectives/neo4j-java-driver that referenced this pull request Dec 19, 2023
…4j#1435)

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 the `Logger.warn(String, Object...)` method. Example: `log.warn(message)`.

Some implementations of the `Logger` interface supply the values given directly to the `String.format(String, Object...)` method. Given that the first argument is considered to be a format string, an `IllegalFormatException` may be thrown. That used to happen when the log message contained the scoped IP version 6 `getHostAddress()` 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants