private char [ ] readKeystorePassword ( String keystorePasswordURL , File policyFile ) throws Exception { // try relative path to policy file File f = new File ( getPolicyFileHome ( policyFile ) , keystorePasswordURL ) ; if ( ! f . exists ( ) ) { // try absoluth path f = new File ( keystorePasswordURL ) ; if ( ! f . exists ( ) ) { throw new Exception ( "ER005: File on keystorePasswordURL doesn't exists!" ) ; } } Reader reader = new FileReader ( f ) ; StringBuilder sb = new StringBuilder ( ) ; char buffer [ ] = new char [ 64 ] ; int len ; while ( ( len = reader . read ( buffer ) ) > 0 ) { sb . append ( buffer , 0 , len ) ; } reader . close ( ) ; return sb . toString ( ) . trim ( ) . toCharArray ( ) ; }
Private method for reading password for keystore from file .