Skip to content

IPv6 support for org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert #2678

Closed
@TheTweak

Description

@TheTweak

Hello, when IPv6 network stack is used, org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert can not convert the response from Redis CLUSTER NODES command and throws NumberFormatException.

Input to convert() in this case is:
67adfe3df1058896e3cb49d2863e0f70e7e159fa 2a02:6b8:c67:9c:0:6d8b:33da:5a2c:6380@16380,redis-master master,nofailover - 0 1692108412315 1 connected 0-5460
and then Integer.parseInt("6b8:c67:9c:0:6d8b:33da:5a2c:6380") fails https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/convert/Converters.java#L577

Discovered when using RedisHealthIndicator from Spring Data Redis module, and when connection to cluster is done via IPv6 network.

Expected behaviour:

  • org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert returns RedisClusterNode object

Actual behaviour:

  • NumberFormatException is thrown

Spring Data Redis version: 3.1.1

Possible fix could be to split on the last occurrence of : here https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/convert/Converters.java#L563

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions