Skip to content

StandardJdbcUrlParser cannot correctly parse the port in IPv6 jdbcUrl #35289

Open
@jaloon

Description

@jaloon

Bug Report

When parsing a jdbcURL containing an IPv6 address using StandardJdbcParser.parse, an incorrect port number was obtained.

e.g.

String url = "jdbc:mysql://[fe80::d114:22b3:a0d9:2b3]:3306/db_test";
JdbcUrl jdbcUrl = new StandardJdbcUrlParser().parse(url);
System.out.println(jdbcUrl.getPort());

Which version of ShardingSphere did you use?

5.5.0 ~ 5.5.2

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

The above example code outputs 3306

Actual behavior

The example code above throws exception
java.lang.NumberFormatException: For input string: ""

Reason analyze (If you can)

Image

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions