Skip to content

Commit

Permalink
Fixed NPE for keepAlive (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex268 authored Jan 20, 2025
2 parents 1c6c428 + 1e9e8f0 commit f7d1060
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public boolean isValid(YdbValidator validator, int timeout) throws SQLException
try {
KeepAliveSessionSettings settings = new KeepAliveSessionSettings().setTimeout(Duration.ofSeconds(timeout));
Session.State keepAlive = validator.call(
"Keep alive: " + tx.txID(), null,
"Keep alive: " + tx.txID(),
() -> session.keepAlive(settings)
);
return keepAlive == Session.State.READY;
Expand Down
10 changes: 10 additions & 0 deletions jdbc/src/test/java/tech/ydb/jdbc/YdbDriverTablesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public void defaultModeTest() throws SQLException {

connection.createStatement().execute(CREATE_TABLE);

Assertions.assertTrue(connection.isValid(10));

LocalDate ld = LocalDate.of(2017, 12, 3);
String prefix = "text-value-";
int idx = 0;
Expand Down Expand Up @@ -141,6 +143,8 @@ public void customQueriesTest() throws SQLException {

conn.createStatement().execute(CREATE_TABLE);

Assertions.assertTrue(conn.isValid(10));

LocalDate ld = LocalDate.of(2017, 12, 3);
String prefix = "text-value-";
int idx = 0;
Expand Down Expand Up @@ -219,6 +223,8 @@ public void forceScanAndBulkTest() throws SQLException {

conn.createStatement().execute(CREATE_TABLE);

Assertions.assertTrue(conn.isValid(10));

LocalDate ld = LocalDate.of(2017, 12, 3);
String prefix = "text-value-";
int idx = 0;
Expand Down Expand Up @@ -330,6 +336,8 @@ public void streamResultsTest() throws SQLException {

conn.createStatement().execute(CREATE_TABLE);

Assertions.assertTrue(conn.isValid(10));

LocalDate ld = LocalDate.of(2017, 12, 3);
String prefix = "text-value-";
int idx = 0;
Expand Down Expand Up @@ -454,6 +462,8 @@ public void tableServiceModeTest() throws SQLException {

connection.createStatement().execute(CREATE_TABLE);

Assertions.assertTrue(connection.isValid(10));

LocalDate ld = LocalDate.of(2017, 12, 3);
String prefix = "text-value-";
int idx = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ private JdbcConnectionExtention(JdbcUrlHelper jdbcURL) {
public JdbcConnectionExtention(YdbHelperExtension ydb, boolean autoCommit) {
this(new JdbcUrlHelper(ydb)
.withArg("failOnTruncatedResult", "true")
.withArg("enableTxTracer", "true")
.withArg("autoCommit", String.valueOf(autoCommit))
// .withArg("useQueryService", "true")
// .withArg("useQueryService", "false")
);
}

Expand Down

0 comments on commit f7d1060

Please sign in to comment.