@@ -336,10 +336,10 @@ private static String getCurrentClassPath() throws SQLServerException {
336
336
* if unable to read from the file
337
337
*/
338
338
private static LinkedList <String > readFromFile (String connectionStringProperty ) throws SQLServerException {
339
- String filePath = getCurrentClassPath () ;
339
+ String filePath = "" ;
340
340
LinkedList <String > list = new LinkedList <>();
341
-
342
341
try {
342
+ filePath = getCurrentClassPath ();
343
343
File f = new File (filePath );
344
344
try (BufferedReader buffer = new BufferedReader (new FileReader (f ))) {
345
345
String readLine ;
@@ -354,13 +354,22 @@ private static LinkedList<String> readFromFile(String connectionStringProperty)
354
354
} catch (FileNotFoundException e ) {
355
355
// If the file is not found either A) We're not using CRL OR B) the path is wrong. Do not error out, instead
356
356
// log a message.
357
- if (CONFIGURABLE_RETRY_LOGGER .isLoggable (java .util .logging .Level .FINER )) {
358
- CONFIGURABLE_RETRY_LOGGER .finest ("File not found at path - \" " + filePath + "\" " );
357
+ if (CONFIGURABLE_RETRY_LOGGER .isLoggable (java .util .logging .Level .FINE )) {
358
+ CONFIGURABLE_RETRY_LOGGER .fine ("File not found at path - \" " + filePath + "\" " );
359
+ }
360
+ } catch (InvalidPathException e ) {
361
+ if (CONFIGURABLE_RETRY_LOGGER .isLoggable (java .util .logging .Level .FINE )) {
362
+ CONFIGURABLE_RETRY_LOGGER .fine ("Invalid path specified - \" " + filePath + "\" " );
359
363
}
360
364
} catch (IOException e ) {
361
365
MessageFormat form = new MessageFormat (SQLServerException .getErrString ("R_errorReadingStream" ));
362
366
Object [] msgArgs = {e .getMessage () + ", from path - \" " + filePath + "\" " };
363
367
throw new SQLServerException (form .format (msgArgs ), null , 0 , e );
368
+ } catch (Exception e ) {
369
+ // General exception handling
370
+ if (CONFIGURABLE_RETRY_LOGGER .isLoggable (java .util .logging .Level .FINE )) {
371
+ CONFIGURABLE_RETRY_LOGGER .fine ("An unexpected error occurred while reading from file: " + e .getMessage ());
372
+ }
364
373
}
365
374
return list ;
366
375
}
0 commit comments