public static void checkAccessAndAliasesForKeystore(String storeLocation,String storePassword,boolean shouldNotBeEmpty) throws ConfigurationException {
  final String errorMessage=MessageFormat.format("Could not access or retrieve aliases from {0}",storeLocation);
  try {
    List<String> aliasesInKeystore=SecurityHelper.getAliasesforKeystore(storeLocation,storePassword);
    if (aliasesInKeystore.isEmpty() && shouldNotBeEmpty) {
      throw new ConfigurationException(MessageFormat.format("Keystore / Truststore does not contain any aliases: {0}",storeLocation));
    }
  }
 catch (  KeyStoreException e) {
    throw new ConfigurationException(MessageFormat.format(errorMessage,e));
  }
catch (  NoSuchAlgorithmException e) {
    throw new ConfigurationException(MessageFormat.format(errorMessage,e));
  }
catch (  CertificateException e) {
    throw new ConfigurationException(MessageFormat.format(errorMessage,e));
  }
catch (  IOException e) {
    throw new ConfigurationException(MessageFormat.format(errorMessage,e));
  }
}

public static void checkAccessAndAliasesForKeystore ( String storeLocation , String storePassword , boolean shouldNotBeEmpty ) throws ConfigurationException { final String errorMessage = MessageFormat . format ( "Could not access or retrieve aliases from {0}" , storeLocation ) ; try { List < String > aliasesInKeystore = SecurityHelper . getAliasesforKeystore ( storeLocation , storePassword ) ; if ( aliasesInKeystore . isEmpty ( ) && shouldNotBeEmpty ) { throw new ConfigurationException ( MessageFormat . format ( "Keystore / Truststore does not contain any aliases: {0}" , storeLocation ) ) ; } } catch ( KeyStoreException e ) { throw new ConfigurationException ( MessageFormat . format ( errorMessage , e ) ) ; } catch ( NoSuchAlgorithmException e ) { throw new ConfigurationException ( MessageFormat . format ( errorMessage , e ) ) ; } catch ( CertificateException e ) { throw new ConfigurationException ( MessageFormat . format ( errorMessage , e ) ) ; } catch ( IOException e ) { throw new ConfigurationException ( MessageFormat . format ( errorMessage , e ) ) ; } }
check that the keystore / trustore can be accessed and has non empty list of aliases
