protected static void notNull(Object value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } }
@Override public Set<String> getModuleNames() { try { init(); } catch (InvalidConfException ex) { throw new IllegalStateException( "could not initialize P11CryptServiceFactory: " + ex.getMessage(), ex); } return moduleNames; }
protected static void notNull(Object value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } }
public synchronized P11CryptService getP11CryptService(String moduleName) throws XiSecurityException, P11TokenException { try { init(); } catch (InvalidConfException ex) { throw new IllegalStateException( "could not initialize P11CryptServiceFactory: " + ex.getMessage(), ex); } if (moduleConfs == null) { throw new IllegalStateException("please set pkcs11ConfFile and then call init() first"); } final String name = getModuleName(moduleName); P11ModuleConf conf = moduleConfs.get(name); if (conf == null) { throw new XiSecurityException("PKCS#11 module " + name + " is not defined"); } P11CryptService instance = services.get(name); if (instance == null) { P11Module p11Module = p11ModuleFactoryRegister.getP11Module(conf); instance = new P11CryptService(p11Module); LOG.info("added PKCS#11 module {}\n{}", name, instance.getModule().getDescription()); services.put(name, instance); } return instance; }
protected void exactOne(Object value1, String name1, Object value2, String name2) throws InvalidConfException { if (value1 == null && value2 == null) { throw new InvalidConfException(name1 + " and " + name2 + " may not be both null"); } else if (value1 != null && value2 != null) { throw new InvalidConfException(name1 + " and " + name2 + " may not be both non-null"); } }
} catch (InvalidConfException ex) { LogUtil.error(LOG, ex, "could not marshal CAConf"); throw new CaMgmtException(concat("could not marshal CAConf: ", ex.getMessage()), ex); } finally { bout.flush();
protected void exactOne(Object value1, String name1, Object value2, String name2) throws InvalidConfException { if (value1 == null && value2 == null) { throw new InvalidConfException(name1 + " and " + name2 + " may not be both null"); } else if (value1 != null && value2 != null) { throw new InvalidConfException(name1 + " and " + name2 + " may not be both non-null"); } }
protected static void notEmpty(Collection<?> value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } if (value.isEmpty()) { throw new InvalidConfException(name + " may not be empty"); } }
protected static void notEmpty(String value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } if (value.isEmpty()) { throw new InvalidConfException(name + " may not be empty"); } }
protected static void notEmpty(String value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } if (value.isEmpty()) { throw new InvalidConfException(name + " may not be empty"); } }
protected static void notEmpty(Collection<?> value, String name) throws InvalidConfException { if (value == null) { throw new InvalidConfException(name + " may not be null"); } if (value.isEmpty()) { throw new InvalidConfException(name + " may not be empty"); } }
public final void validate() throws InvalidConfException { if (onlyContainsCaCerts && onlyContainsUserCerts) { throw new InvalidConfException( "onlyContainsCACerts and onlyContainsUserCerts can not be both true"); } if (updateMode == UpdateMode.ONDEMAND) { return; } if (fullCrlIntervals < deltaCrlIntervals) { throw new InvalidConfException( "fullCRLIntervals may not be less than deltaCRLIntervals " + fullCrlIntervals + " < " + deltaCrlIntervals); } if (fullCrlIntervals < 1) { throw new InvalidConfException( "fullCRLIntervals may not be less than 1: " + fullCrlIntervals); } if (deltaCrlIntervals < 0) { throw new InvalidConfException( "deltaCRLIntervals may not be less than 0: " + deltaCrlIntervals); } }
public void validate() throws InvalidConfException { if (onlyContainsCaCerts && onlyContainsUserCerts) { throw new InvalidConfException( "onlyContainsCACerts and onlyContainsUserCerts can not be both true"); } if (updateMode == UpdateMode.ONDEMAND) { return; } if (fullCrlIntervals < deltaCrlIntervals) { throw new InvalidConfException( "fullCRLIntervals must not be less than deltaCRLIntervals " + fullCrlIntervals + " < " + deltaCrlIntervals); } if (fullCrlIntervals < 1) { throw new InvalidConfException( "fullCRLIntervals must not be less than 1: " + fullCrlIntervals); } if (deltaCrlIntervals < 0) { throw new InvalidConfException( "deltaCRLIntervals must not be less than 0: " + deltaCrlIntervals); } }
private static int getIntPermission(List<String> permissions) throws InvalidConfException { int ret = 0; for (String permission : permissions) { Integer ii = PermissionConstants.getPermissionForText(permission); if (ii == null) { throw new InvalidConfException("invalid permission " + permission); } ret |= ii; } return ret; }
private static int getInteger(ConfPairs props, String propKey, int dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { try { return Integer.parseInt(str.trim()); } catch (NumberFormatException ex) { throw new InvalidConfException(propKey + " does not have numeric value: " + str); } } return dfltValue; }
private static int getInteger(ConfPairs props, String propKey, int dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { try { return Integer.parseInt(str.trim()); } catch (NumberFormatException ex) { throw new InvalidConfException(propKey + " does not have numeric value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }