public static Properties readPropertiesFromCredentials ( String credentials ) { Properties props = new Properties ( ) ; File propFD = new File ( credentials ) ; if ( ! propFD . exists ( ) || ! propFD . isFile ( ) || ! propFD . canRead ( ) ) { throw new IllegalArgumentException ( "Credentials file " + credentials + " is not a read accessible file" ) ; } else { FileReader fr = null ; try { fr = new FileReader ( credentials ) ; props . load ( fr ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( "Credential file not found or permission denied." ) ; } } return props ; }
Get username and password from credentials file .