Skip to content

Commit 153cba6

Browse files
authored
Skips SEA check when dbsql version string is blank space (#605)
* init * init * init * init
1 parent f46c957 commit 153cba6

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/main/java/com/databricks/jdbc/common/util/DriverUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static void ensureUpdatedDBSQLVersionInUse(IDatabricksConnection connection)
103103
// Check applicable only for SEA flow
104104
return;
105105
}
106-
String dbsqlVersion = getDBSQLVersionCached(connection);
107-
if (dbsqlVersion == null || dbsqlVersion == "") {
106+
String dbsqlVersion = getDBSQLVersionCached(connection).trim();
107+
if (WildcardUtil.isNullOrEmpty(dbsqlVersion)) {
108108
// If the DBSQL version is not available, we cannot determine if the driver supports SEA.
109109
// Proceeding with the connection.
110110
return;

src/test/java/com/databricks/jdbc/common/util/DriverUtilTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ void setUp() {
3434
}
3535

3636
@ParameterizedTest
37-
@CsvSource({
38-
"2023.99, true",
39-
"2024.30, false",
40-
"2024.29, true",
41-
"2024.31, false",
42-
"2025.0, false",
43-
})
37+
@CsvSource(
38+
value = {
39+
"2023.99, true",
40+
"2024.30, false",
41+
"2024.29, true",
42+
"2024.31, false",
43+
"2025.0, false",
44+
"'', false", // empty string
45+
"' ', false" // string with one space
46+
})
4447
void testDriverSupportInSEA(String dbsqlVersion, boolean throwsError) throws SQLException {
4548
when(connection.getConnectionContext()).thenReturn(connectionContext);
4649
when(connectionContext.getClientType()).thenReturn(DatabricksClientType.SQL_EXEC);

0 commit comments

Comments
 (0)