Skip to content

GH-4871: Parse IPv6 application.server host info - #4872

Merged
sobychacko merged 1 commit into
spring-projects:mainfrom
LindseyZ1205:GH-4871
Nov 4, 2026
Merged

sobychacko merged 1 commit into
spring-projects:mainfrom
LindseyZ1205:GH-4871

Conversation

@LindseyZ1205

Copy link
Copy Markdown
Contributor

Fixes: #4871

getCurrentKafkaStreamsApplicationHostInfo() split application.server at the first :, so an IPv6 value such as [::1]:8080 failed with a NumberFormatException.

It now parses the value with HostInfo.buildFromEndpoint(), the same method Kafka Streams uses for this property, so the result matches the active host that Kafka Streams reports for the instance. A blank value still returns null. A value without a port, which used to return null, now throws the same ConfigException that Kafka Streams throws for it when the KafkaStreams instance is created.

Tests:

  • Added currentHostInfoWithIpv6ApplicationServer to KafkaStreamsInteractiveQueryServiceTests. It fails on main (NumberFormatException: For input string: ":1]:8080") and passes with the fix.
  • With application.server temporarily set to [::1]:8080 in the existing test context, getKafkaStreamsApplicationHostInfo(...) and getCurrentKafkaStreamsApplicationHostInfo() both return HostInfo("::1", 8080) (not part of this change).
  • checkstyleMain and checkstyleTest pass (JDK 25). The full :spring-kafka:test run locally: 1272 tests, 4 skipped, 1 failure in AsyncMonoRetryTopicScenarioTests (topic metadata timeout), which passes when run on its own.

Fixes: spring-projects#4871

**Auto-cherry-pick to `4.1.x` & `4.0.x`**

getCurrentKafkaStreamsApplicationHostInfo() split application.server
at the first ':', so an IPv6 value such as [::1]:8080 failed with a
NumberFormatException.

Parse it with HostInfo.buildFromEndpoint(), as Kafka Streams does, so
the result matches the active host that Kafka Streams reports for the
instance.

Signed-off-by: Yingzi Zhang <yingzizhang1205@gmail.com>
@sobychacko
sobychacko merged commit ea3d3c8 into spring-projects:main Nov 4, 2026
3 checks passed
spring-builds pushed a commit that referenced this pull request Nov 4, 2026
Fixes: #4871

getCurrentKafkaStreamsApplicationHostInfo() split application.server
at the first ':', so an IPv6 value such as [::1]:8080 failed with a
NumberFormatException.

Parse it with HostInfo.buildFromEndpoint(), as Kafka Streams does, so
the result matches the active host that Kafka Streams reports for the
instance.

Signed-off-by: Yingzi Zhang <yingzizhang1205@gmail.com>
(cherry picked from commit ea3d3c8)
spring-builds pushed a commit that referenced this pull request Nov 4, 2026
Fixes: #4871

getCurrentKafkaStreamsApplicationHostInfo() split application.server
at the first ':', so an IPv6 value such as [::1]:8080 failed with a
NumberFormatException.

Parse it with HostInfo.buildFromEndpoint(), as Kafka Streams does, so
the result matches the active host that Kafka Streams reports for the
instance.

Signed-off-by: Yingzi Zhang <yingzizhang1205@gmail.com>
(cherry picked from commit ea3d3c8)
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.

getCurrentKafkaStreamsApplicationHostInfo() fails for an IPv6 application.server

2 participants