@ SuppressWarnings ( "resource" ) private InputStream loadFile ( String trustStorePath ) throws FileNotFoundException { InputStream input ; try { input = new FileInputStream ( trustStorePath ) ; } catch ( FileNotFoundException e ) { LOGGER . warn ( "File {} not found. Fallback to classpath." , trustStorePath ) ; input = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( trustStorePath ) ; } if ( input == null ) { throw new FileNotFoundException ( "File " + trustStorePath + " does not exist" ) ; } return input ; }
This method is used to find file from disk or classpath .