SNOW-1163212: InvalidPathException on Windows due to Nested file path
Closed this issue · 10 comments
-
What version of JDBC driver are you using?
3.14.5 -
What operating system and processor architecture are you using?
Windows 10 x64 -
What version of Java are you using?
17.0.10 OpenJDK -
What did you do?
Customer using the Snowflake driver as part of our product.
When attempting to create the datasource the following error is thrown:
2024-02-26 16:17:56.003.+0000 INFO 1968 --- [oundedElastic-6] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-02-26 16:17:57.692.+0000 ERROR 1968 --- [oundedElastic-6] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
java.nio.file.InvalidPathException: Illegal char <:> at index 6: nested:\C:\<OBFUSCATED>\!BOOT-INF\lib\sf_client_config.json
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[na:na]
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[na:na]
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232) ~[na:na]
at java.base/java.nio.file.Path.of(Path.java:147) ~[na:na]
at java.base/java.nio.file.Paths.get(Paths.java:69) ~[na:na]
at net.snowflake.client.config.SFClientConfigParser.loadSFClientConfig(SFClientConfigParser.java:44) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.setClientConfig(DefaultSFConnectionHandler.java:128) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.initialize(DefaultSFConnectionHandler.java:107) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.initializeConnection(DefaultSFConnectionHandler.java:85) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.SnowflakeConnectionV1.initConnectionWithImpl(SnowflakeConnectionV1.java:116) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.SnowflakeConnectionV1.<init>(SnowflakeConnectionV1.java:96) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at net.snowflake.client.jdbc.SnowflakeDriver.connect(SnowflakeDriver.java:206) ~[snowflake-jdbc-3.14.5.jar!/:3.14.5]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100) ~[HikariCP-5.0.1.jar!/:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-5.0.1.jar!/:na]
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
- What did you expect to see?
Expected to Snowflake driver connect to datasource and retrieve metadata.
-
Can you set logging to DEBUG and collect the logs?
N/A customer execution. -
What is your Snowflake account identifier, if any? (Optional)
n/a Customer instance.
Issue
This issue seems to be a similar problem to #1405.
We have figured out a work around by creating a different sf_client_config and setting it's path using the connection parameter method, however this is still a bug.
In the code SFClientConfigParser.java function getConfigFilePathFromJDBCJarLocation, the error seems to be thrown because the windows path is nested://
the full path is nested:\C:\<OBFUSCATED>\!BOOT-INF\lib\sf_client_config.json
. Best guess would be that the following:
if (updatedPath.startsWith("/")) {
updatedPath = updatedPath.substring(1);
} else if (updatedPath.startsWith("file:\\")) {
updatedPath = updatedPath.substring(6);
}
Needs an additional else if
for the nested://
prefix. The nested prefix is resulted from a mounted windows instance from a corporate network.
Hello @dhrudevaliasolidatus ,
We confirmed this gap and will work on eliminating it. Will keep this thread posted.
Regards,
Sujan
Hello @dhrudevaliasolidatus ,
The fix has been delivered in JDBC 3.15.1, could you please check and let us know if anything.
Regards,
Sujan
closing this issue as there's no feedback; we assume it's working as expected now.
If not, do comment please and we can look.
I just tried out 3.16.0 and the problem is still present:
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 6: nested:\C:\dev\<snip>\build\libs\<snip>-application.jar\!BOOT-INF\lib\sf_client_config.json
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204) ~[?:?]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175) ~[?:?]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[?:?]
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[?:?]
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231) ~[?:?]
at java.base/java.nio.file.Path.of(Path.java:148) ~[?:?]
at java.base/java.nio.file.Paths.get(Paths.java:69) ~[?:?]
at net.snowflake.client.config.SFClientConfigParser.loadSFClientConfig(SFClientConfigParser.java:46) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.setClientConfig(DefaultSFConnectionHandler.java:141) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.initialize(DefaultSFConnectionHandler.java:120) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.DefaultSFConnectionHandler.initializeConnection(DefaultSFConnectionHandler.java:98) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.SnowflakeConnectionV1.initConnectionWithImpl(SnowflakeConnectionV1.java:142) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.SnowflakeConnectionV1.<init>(SnowflakeConnectionV1.java:122) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at net.snowflake.client.jdbc.SnowflakeDriver.connect(SnowflakeDriver.java:214) ~[snowflake-jdbc-3.16.0.jar!/:3.16.0]
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683) ~[java.sql:?]
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:191) ~[java.sql:?]
Apologies for the delay. I can confirm this issue is still present. @sfc-gh-snow-drivers-warsaw-dl @sfc-gh-dszmolka can this ticket be reopened please.
thanks for the feedback; reopened and we'll look further
PR open for review: #1763
edit: if someone wishes to test the change, they can build the driver for themselves (with for example as documented in the README), by checking out the fix branch and building it from there.
i'll keep this thread updated with PR review / release activities.
PR is now merged, and will be part of the next upcoming release cycle, towards end of May 2024
fix released with May 2024 release cycle, version 3.16.1