Skip to content

Update readFromFile() in ConfigurableRetryLogic to handle filePath related issues #2650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025
Merged
Changes from 1 commit
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 @@ -336,10 +336,10 @@
* if unable to read from the file
*/
private static LinkedList<String> readFromFile(String connectionStringProperty) throws SQLServerException {
String filePath = getCurrentClassPath();
String filePath = "";
LinkedList<String> list = new LinkedList<>();

try {
filePath = getCurrentClassPath();
File f = new File(filePath);
try (BufferedReader buffer = new BufferedReader(new FileReader(f))) {
String readLine;
Expand All @@ -357,6 +357,10 @@
if (CONFIGURABLE_RETRY_LOGGER.isLoggable(java.util.logging.Level.FINER)) {
CONFIGURABLE_RETRY_LOGGER.finest("File not found at path - \"" + filePath + "\"");
}
} catch (InvalidPathException e) {

Check warning on line 360 in src/main/java/com/microsoft/sqlserver/jdbc/ConfigurableRetryLogic.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/ConfigurableRetryLogic.java#L360

Added line #L360 was not covered by tests
if (CONFIGURABLE_RETRY_LOGGER.isLoggable(java.util.logging.Level.FINER)) {
CONFIGURABLE_RETRY_LOGGER.finest("Invalid path specified - \"" + filePath + "\"");

Check warning on line 362 in src/main/java/com/microsoft/sqlserver/jdbc/ConfigurableRetryLogic.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/ConfigurableRetryLogic.java#L362

Added line #L362 was not covered by tests
}
} catch (IOException e) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_errorReadingStream"));
Object[] msgArgs = {e.getMessage() + ", from path - \"" + filePath + "\""};
Expand Down
Loading