Skip to content

NumberFormatException parsing spring.redis.cluster.nodes with IPv6 address #2418

@junejwind

Description

@junejwind

excuse me,
when i config redis cluster use appllication.yml like this:

spring:
  redis:
     cluster:
          nodes:
               - "[aaa:bbb:ccc::dd1]:6379"
               - "[aaa:bbb:ccc::dd2]:6379"

start failed:

Caused by: java.lang.NumberFormatException: For input string: "bbb:ccc:xxx::ddd]:6379"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:580)
        at java.lang.Integer.valueOf(Integer.java:766)
        at org.springframework.data.redis.connection.RedisClusterConfiguration.readHostAndPortFromString

RedisClusterConfiguration

image

can also see in RedisSentinelConfiguration

The version is:
Spring Boot version = 2.7.4
spring-data-redis version = 2.7.3

i think the solution will be simliar to #28133
use lastIndexOf(':');

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions