Skip to content

Commit 0e20066

Browse files
committed
Prepare version 4.10.1
and hamronize logging
1 parent c1d6329 commit 0e20066

10 files changed

+65
-63
lines changed

Diff for: CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to
55
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## Unreleased
7+
## [4.10.1] - 2023-10-07
8+
### Changed
9+
- Update Apache Commons IO to version 2.14.0.
10+
- Harmonize logging.
811
### Fixed
9-
- Fix multiple issues related the method `findColumn(String)` of `CassandraResultSet` and `CassandraMetadataResultSet`:
12+
- Fix multiple issues related to the method `findColumn(String)` of `CassandraResultSet` and `CassandraMetadataResultSet`:
1013
- Fix issue [#31](https://github.com/ing-bank/cassandra-jdbc-wrapper/issues/31) to return a 1-based index value.
1114
- Return a result even if there's no row in the result set but the column exist in the statement.
1215
- Fix the exception thrown by the method when the given column name does not exist in the result set (was an
@@ -159,6 +162,7 @@ For this version, the changelog lists the main changes comparatively to the late
159162
- Fix logs in `CassandraConnection` constructor.
160163

161164
[original project]: https://github.com/adejanovski/cassandra-jdbc-wrapper/
165+
[4.10.1]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.10.0...v4.10.1
162166
[4.10.0]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.9.1...v4.10.0
163167
[4.9.1]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.9.0...v4.9.1
164168
[4.9.0]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.8.0...v4.9.0

Diff for: pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.ing.data</groupId>
77
<artifactId>cassandra-jdbc-wrapper</artifactId>
8-
<version>4.10.0</version>
8+
<version>4.10.1</version>
99
<packaging>jar</packaging>
1010

1111
<name>Cassandra JDBC Wrapper</name>
@@ -108,7 +108,7 @@
108108
<checkstyle.version>9.3</checkstyle.version>
109109
<caffeine.version>2.9.3</caffeine.version>
110110
<commons-collections.version>4.4</commons-collections.version>
111-
<commons-io.version>2.13.0</commons-io.version>
111+
<commons-io.version>2.14.0</commons-io.version>
112112
<commons-lang3.version>3.13.0</commons-lang3.version>
113113
<datastax.java.driver.version>4.17.0</datastax.java.driver.version>
114114
<jackson.version>2.15.2</jackson.version>

Diff for: src/main/java/com/ing/data/cassandra/jdbc/CassandraPreparedStatement.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public void close() {
189189
try {
190190
this.connection.removeStatement(this);
191191
} catch (final Exception e) {
192-
LOG.warn("Unable to close the prepared statement: " + e.getMessage());
192+
LOG.warn("Unable to close the prepared statement: {}", e.getMessage());
193193
}
194194
}
195195

@@ -198,7 +198,7 @@ private void doExecute() throws SQLException {
198198
try {
199199
resetResults();
200200
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
201-
LOG.trace("CQL: " + this.cql);
201+
LOG.trace("CQL: {}", this.cql);
202202
}
203203
// Force paging to avoid timeout and node harm.
204204
if (this.boundStatement.getPageSize() == 0) {
@@ -248,7 +248,7 @@ public int[] executeBatch() throws SQLException {
248248
try {
249249
final List<CompletionStage<AsyncResultSet>> futures = new ArrayList<>();
250250
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
251-
LOG.trace("CQL statements: " + this.batchStatements.size());
251+
LOG.trace("CQL statements: {}", this.batchStatements.size());
252252
}
253253
for (final BoundStatement statement : this.batchStatements) {
254254
for (int i = 0; i < statement.getPreparedStatement().getVariableDefinitions().size(); i++) {
@@ -258,7 +258,7 @@ public int[] executeBatch() throws SQLException {
258258
}
259259
}
260260
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
261-
LOG.trace("CQL: " + this.cql);
261+
LOG.trace("CQL: {}", this.cql);
262262
}
263263
final BoundStatement boundStatement = statement.setConsistencyLevel(
264264
this.connection.getDefaultConsistencyLevel());

Diff for: src/main/java/com/ing/data/cassandra/jdbc/CassandraStatement.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private void doExecute(final String cql) throws SQLException {
370370

371371
private com.datastax.oss.driver.api.core.cql.ResultSet executeSingleStatement(final String cql) {
372372
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
373-
LOG.debug("CQL: " + cql);
373+
LOG.debug("CQL: {}", cql);
374374
}
375375
SimpleStatement stmt = SimpleStatement.newInstance(cql)
376376
.setConsistencyLevel(this.connection.getDefaultConsistencyLevel())
@@ -407,12 +407,12 @@ public int[] executeBatch() throws SQLException {
407407
final int[] returnCounts = new int[this.batchQueries.size()];
408408
final List<CompletionStage<AsyncResultSet>> futures = new ArrayList<>();
409409
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
410-
LOG.debug("CQL statements: " + this.batchQueries.size());
410+
LOG.debug("CQL statements: {}", this.batchQueries.size());
411411
}
412412

413413
for (final String query : this.batchQueries) {
414414
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
415-
LOG.debug("CQL: " + query);
415+
LOG.debug("CQL: {}", query);
416416
}
417417
SimpleStatement stmt = SimpleStatement.newInstance(query)
418418
.setConsistencyLevel(this.connection.getDefaultConsistencyLevel());

Diff for: src/test/java/com/ing/data/cassandra/jdbc/ConnectionUnitTest.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
import static org.mockito.Mockito.when;
7878

7979
class ConnectionUnitTest extends UsingCassandraContainerTest {
80-
private static final Logger log = LoggerFactory.getLogger(ConnectionUnitTest.class);
80+
private static final Logger LOG = LoggerFactory.getLogger(ConnectionUnitTest.class);
8181

8282
private static final String KEYSPACE = "system";
8383

@@ -427,15 +427,15 @@ void givenConnection_whenGetMetaData_getExpectedResultSet() throws Exception {
427427
assertNotNull(sqlConnection.getMetaData());
428428

429429
final DatabaseMetaData dbMetadata = sqlConnection.getMetaData();
430-
log.debug("====================================================");
431-
log.debug("Connection Metadata");
432-
log.debug("====================================================");
433-
log.debug("Driver name: {}", dbMetadata.getDriverName());
434-
log.debug("Driver version: {}", dbMetadata.getDriverVersion());
435-
log.debug("DB name: {}", dbMetadata.getDatabaseProductName());
436-
log.debug("DB version: {}", dbMetadata.getDatabaseProductVersion());
437-
log.debug("JDBC version: {}.{}", dbMetadata.getJDBCMajorVersion(), dbMetadata.getJDBCMinorVersion());
438-
log.debug("====================================================");
430+
LOG.debug("====================================================");
431+
LOG.debug("Connection Metadata");
432+
LOG.debug("====================================================");
433+
LOG.debug("Driver name: {}", dbMetadata.getDriverName());
434+
LOG.debug("Driver version: {}", dbMetadata.getDriverVersion());
435+
LOG.debug("DB name: {}", dbMetadata.getDatabaseProductName());
436+
LOG.debug("DB version: {}", dbMetadata.getDatabaseProductVersion());
437+
LOG.debug("JDBC version: {}.{}", dbMetadata.getJDBCMajorVersion(), dbMetadata.getJDBCMinorVersion());
438+
LOG.debug("====================================================");
439439

440440
assertEquals("Cassandra JDBC Driver", dbMetadata.getDriverName());
441441
assertNotEquals(0, dbMetadata.getDriverMajorVersion());

Diff for: src/test/java/com/ing/data/cassandra/jdbc/DbaasAstraIntegrationTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
@TestMethodOrder(org.junit.jupiter.api.MethodOrderer.OrderAnnotation.class)
4141
class DbaasAstraIntegrationTest {
4242

43-
private static final Logger log = LoggerFactory.getLogger(DbaasAstraIntegrationTest.class);
43+
private static final Logger LOG = LoggerFactory.getLogger(DbaasAstraIntegrationTest.class);
4444
private static final String ASTRA_DB_TOKEN_ENV_VARIABLE = "ASTRA_DB_APPLICATION_TOKEN";
4545
private static final String ASTRA_DB_TOKEN_PATTERN = "Astra.*";
4646
private static final String DATABASE_NAME = "test_cassandra_jdbc";
@@ -51,13 +51,13 @@ class DbaasAstraIntegrationTest {
5151
@BeforeAll
5252
static void setupAstra() throws Exception {
5353
if (System.getenv(ASTRA_DB_TOKEN_ENV_VARIABLE) != null) {
54-
log.debug("ASTRA_DB_APPLICATION_TOKEN is provided, AstraDB tests are executed.");
54+
LOG.debug("ASTRA_DB_APPLICATION_TOKEN is provided, AstraDB tests are executed.");
5555

5656
/*
5757
* Devops API Client (create database, resume, delete)
5858
*/
5959
final AstraDbClient astraDbClient = new AstraDbClient(TestUtils.getAstraToken());
60-
log.debug("Connected the DBaaS API.");
60+
LOG.debug("Connected the DBaaS API.");
6161

6262
/*
6363
* Set up a Database in Astra: create if not exist, resume if needed.
@@ -67,7 +67,7 @@ static void setupAstra() throws Exception {
6767
String dbId = TestUtils.setupVectorDatabase(DATABASE_NAME, KEYSPACE_NAME);
6868
Assertions.assertTrue(astraDbClient.findById(dbId).isPresent());
6969
Assertions.assertEquals(DatabaseStatusType.ACTIVE, astraDbClient.findById(dbId).get().getStatus());
70-
log.debug("Database ready.");
70+
LOG.debug("Database ready.");
7171

7272
/*
7373
* Download cloud secure bundle to connect to the database.
@@ -77,7 +77,7 @@ static void setupAstra() throws Exception {
7777
astraDbClient
7878
.database(dbId)
7979
.downloadDefaultSecureConnectBundle("/tmp/" + DATABASE_NAME + "_scb.zip");
80-
log.debug("Connection bundle downloaded.");
80+
LOG.debug("Connection bundle downloaded.");
8181

8282
/*
8383
* Building jdbcUrl and sqlConnection.
@@ -90,7 +90,7 @@ static void setupAstra() throws Exception {
9090
"&consistency=" + "LOCAL_QUORUM" +
9191
"&secureconnectbundle=/tmp/" + DATABASE_NAME + "_scb.zip");
9292
} else {
93-
log.debug("ASTRA_DB_APPLICATION_TOKEN is not defined, skipping AstraDB tests.");
93+
LOG.debug("ASTRA_DB_APPLICATION_TOKEN is not defined, skipping AstraDB tests.");
9494
}
9595
}
9696

Diff for: src/test/java/com/ing/data/cassandra/jdbc/JdbcRegressionUnitTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
* <a href="https://github.com/adejanovski/cassandra-jdbc-wrapper/">original project from GitHub</a>.
6666
*/
6767
class JdbcRegressionUnitTest extends UsingCassandraContainerTest {
68-
private static final Logger log = LoggerFactory.getLogger(JdbcRegressionUnitTest.class);
6968

7069
private static final String KEYSPACE = "test_keyspace3";
7170
private static final String TABLE = "regressions_test";

Diff for: src/test/java/com/ing/data/cassandra/jdbc/MetadataResultSetsUnitTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
class MetadataResultSetsUnitTest extends UsingCassandraContainerTest {
5050

51-
private static final Logger log = LoggerFactory.getLogger(MetadataResultSetsUnitTest.class);
51+
private static final Logger LOG = LoggerFactory.getLogger(MetadataResultSetsUnitTest.class);
5252

5353
private static final String KEYSPACE = "test_keyspace";
5454
private static final String ANOTHER_KEYSPACE = "test_keyspace2";
@@ -285,18 +285,18 @@ void givenStatement_whenGetResultMetadata_returnExpectedValues() throws Exceptio
285285
assertTrue(result.next());
286286
assertEquals(6, result.getMetaData().getColumnCount());
287287
for (int i = 1; i <= result.getMetaData().getColumnCount(); i++) {
288-
log.debug("getColumnName : " + result.getMetaData().getColumnName(i));
289-
log.debug("getCatalogName : " + result.getMetaData().getCatalogName(i));
290-
log.debug("getColumnClassName : " + result.getMetaData().getColumnClassName(i));
291-
log.debug("getColumnDisplaySize : " + result.getMetaData().getColumnDisplaySize(i));
292-
log.debug("getColumnLabel : " + result.getMetaData().getColumnLabel(i));
293-
log.debug("getColumnType : " + result.getMetaData().getColumnType(i));
294-
log.debug("getColumnTypeName : " + result.getMetaData().getColumnTypeName(i));
295-
log.debug("getPrecision : " + result.getMetaData().getPrecision(i));
296-
log.debug("getScale : " + result.getMetaData().getScale(i));
297-
log.debug("getSchemaName : " + result.getMetaData().getSchemaName(i));
298-
log.debug("getTableName : " + result.getMetaData().getTableName(i));
299-
log.debug("==========================");
288+
LOG.debug("getColumnName : {}", result.getMetaData().getColumnName(i));
289+
LOG.debug("getCatalogName : {}", result.getMetaData().getCatalogName(i));
290+
LOG.debug("getColumnClassName : {}", result.getMetaData().getColumnClassName(i));
291+
LOG.debug("getColumnDisplaySize : {}", result.getMetaData().getColumnDisplaySize(i));
292+
LOG.debug("getColumnLabel : {}", result.getMetaData().getColumnLabel(i));
293+
LOG.debug("getColumnType : {}", result.getMetaData().getColumnType(i));
294+
LOG.debug("getColumnTypeName : {}", result.getMetaData().getColumnTypeName(i));
295+
LOG.debug("getPrecision : {}", result.getMetaData().getPrecision(i));
296+
LOG.debug("getScale : {}", result.getMetaData().getScale(i));
297+
LOG.debug("getSchemaName : {}", result.getMetaData().getSchemaName(i));
298+
LOG.debug("getTableName : {}", result.getMetaData().getTableName(i));
299+
LOG.debug("==========================");
300300
}
301301

302302
assertEquals("part_key", result.getMetaData().getColumnName(1));

Diff for: src/test/java/com/ing/data/cassandra/jdbc/PreparedStatementsUnitTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import static org.junit.jupiter.api.Assertions.assertNotNull;
4141

4242
class PreparedStatementsUnitTest extends UsingCassandraContainerTest {
43-
private static final Logger log = LoggerFactory.getLogger(PreparedStatementsUnitTest.class);
4443

4544
private static final String KEYSPACE = "test_prep_stmt";
4645

0 commit comments

Comments
 (0)