@Test public void testGetPropertyThrowsSecureKeyStoreException() throws Throwable { try { new SimpleKeyFile().getProperty("testSimpleKeyFileAlias", "testSimpleKeyFileSubName"); fail("Expected SecureKeyStoreException to be thrown"); } catch (SecureKeyStore.SecureKeyStoreException ex) { assertEquals("Key can't be retrieved. Can't get property: testSimpleKeyFileAlias.testSimpleKeyFileSubName", ex.getMessage(), "ex.getMessage()"); assertNull(ex.getNested(), "ex.getNested()"); } }
public String getProperty (String alias, String subName) throws SecureKeyStoreException { String key = alias + "." + subName; String value = props.getProperty(key); if (value == null) throw new SecureKeyStoreException("Key can't be retrieved. Can't get property: " + key); return value.trim(); }
SimpleKeyFile implements SecureKeyStore, Configurable, LogSource { public String getProperty (String alias, String subName) throws SecureKeyStoreException { String key = alias + "." + subName; String value = props.getProperty(key); if (value == null) throw new SecureKeyStoreException("Key can't be retrieved. Can't get property: " + key); return value.trim(); } }
SimpleKeyFile implements SecureKeyStore, Configurable, LogSource { public String getProperty (String alias, String subName) throws SecureKeyStoreException { String key = alias + "." + subName; String value = props.getProperty(key); if (value == null) throw new SecureKeyStoreException("Key can't be retrieved. Can't get property: " + key); return value.trim(); } SimpleKeyFile();  SimpleKeyFile(String keyFileName); }
SimpleKeyFile implements SecureKeyStore, Configurable, LogSource { public String getProperty (String alias, String subName) throws SecureKeyStoreException { String key = alias + "." + subName; String value = props.getProperty(key); if (value == null) throw new SecureKeyStoreException("Key can't be retrieved. Can't get property: " + key); return value.trim(); } SimpleKeyFile();  SimpleKeyFile(String keyFileName); void init(String keyFileName); @Override void setLogger(Logger logger, String realm); @Override Logger getLogger(); @Override String getRealm(); @Override void setConfiguration(Configuration cfg); @Override synchronized SecureKey getKey(String alias); @Override synchronized void setKey(String alias, SecureKey secureKey); String getProperty(String alias, String subName); void setProperty(String alias, String subName, String value); @Override Map<String, SecureKey> getKeys(); }
SimpleKeyFile implements SecureKeyStore, Configurable, LogSource { public String getProperty (String alias, String subName) throws SecureKeyStoreException { String key = alias + "." + subName; String value = props.getProperty(key); if (value == null) throw new SecureKeyStoreException("Key can't be retrieved. Can't get property: " + key); return value.trim(); } SimpleKeyFile();  SimpleKeyFile(String keyFileName); void init(String keyFileName); @Override void setLogger(Logger logger, String realm); @Override Logger getLogger(); @Override String getRealm(); @Override void setConfiguration(Configuration cfg); @Override synchronized SecureKey getKey(String alias); @Override synchronized void setKey(String alias, SecureKey secureKey); String getProperty(String alias, String subName); void setProperty(String alias, String subName, String value); @Override Map<String, SecureKey> getKeys();  }