aws / amazon-redshift-jdbc-driver

Redshift JDBC Driver. It supports JDBC 4.2 specification.
Apache License 2.0
63 stars 31 forks source link

Problem in Driver class when performing the lookup for JDBC ini file in Windows environments #78

Open maxrabbi opened 1 year ago

maxrabbi commented 1 year ago

Driver version

2.1.0.10

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.44903

Client Operating System

Windows 10

JAVA/JVM version

Temurin-11.0.17+8

Table schema

N/A

Problem description

The problem is caused by the line 920 of the Driver class (https://github.com/aws/amazon-redshift-jdbc-driver/blob/v2.1.0.10/src/main/java/com/amazon/redshift/Driver.java). When the Driver class is loaded from a path location Windows like (i.e C:\\redshift-jdbc42-2.1.0.10.jar), line 917, the next 920 fails to properly perform the substring operation since there is not / character. This leads to a java.lang.StringIndexOutOfBoundsException exception.

JDBC trace logs

N/A

Reproduction code

N/A

Brooke-white commented 1 year ago

Hi @maxrabbi, thanks for reaching out to us about this issue. it sounds like we need to look into modifying this line 920 to use an approach compatible with both windows and *nix platforms. mentioned line

You're more than welcome to open a PR with the fix for this since you've identified the issue, otherwise a member of our driver team can work to implement the fix. Just let us know your preference :) cc: @bhvkshah

maxrabbi commented 1 year ago

Hi sorry for the late reply. I think it's probably better you work on that. I'm not sure I will be able to look at the PR process and submit it earlier than next mid-week. Regards, Massimo.