Copilot commented on code in PR #7081:
URL: https://github.com/apache/ignite-3/pull/7081#discussion_r2565115078
##########
modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcConnectionFailoverTest.java:
##########
@@ -143,13 +250,19 @@ void testTransactionCannotBeUsedAfterNodeRestart() throws
SQLException {
}
}
- private static Connection getConnection(int nodesCount) throws
SQLException {
+ private static Connection getConnection(int nodesCount, String ... params)
throws SQLException {
String addresses = IntStream.range(0, nodesCount)
.mapToObj(i -> "127.0.0.1:" + (BASE_CLIENT_PORT + i))
.collect(Collectors.joining(","));
+ return getConnection(addresses, params);
+ }
+
+ private static Connection getConnection(String addresses, String ...
params) throws SQLException {
+ String args = String.join("&", params);
+
//noinspection CallToDriverManagerGetConnection
- return DriverManager.getConnection("jdbc:ignite:thin://" + addresses);
+ return DriverManager.getConnection("jdbc:ignite:thin://" + addresses +
"?" + args);
Review Comment:
[nitpick] When `params` is empty, the connection string will end with "?"
(e.g., "jdbc:ignite:thin://127.0.0.1:10800?"). Consider only appending "?" when
params is non-empty. For example:
```java
String suffix = args.isEmpty() ? "" : "?" + args;
return DriverManager.getConnection("jdbc:ignite:thin://" + addresses +
suffix);
```
```suggestion
String suffix = args.isEmpty() ? "" : "?" + args;
return DriverManager.getConnection("jdbc:ignite:thin://" + addresses
+ suffix);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]