Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,17 @@ public static String readVersionFromResource(String resourceFilePath) {
tmpVersion = tmp;
}
} catch (Exception e) {
// ignore
try(InputStream in = ClickHouseClientOption.class.getClassLoader().getResourceAsStream(resourceFilePath)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the exception?
Should we use this way in default branch?

Properties p = new Properties();
p.load(in);

String tmp = p.getProperty("version");
if (tmp != null && !tmp.isEmpty() && !tmp.equals("${revision}")) {
tmpVersion = tmp;
}
} catch (Exception ee) {
// ignore
}
}
return tmpVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
import java.util.Properties;
import java.util.Set;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;

import static org.testng.Assert.*;


public class DatabaseMetaDataTest extends JdbcIntegrationTest {
Expand Down Expand Up @@ -315,4 +311,13 @@ public void testGetClientInfoProperties() throws Exception {
}
}
}

@Test(groups = { "integration" })
public void testGetDriverVersion() throws Exception {
try (Connection conn = getJdbcConnection()) {
DatabaseMetaData dbmd = conn.getMetaData();
String version = dbmd.getDriverVersion();
assertNotEquals(version, "unknown");
}
}
}
Loading