/** * Throws out a {@link ConfigurationException} with message specified. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(String message, Object... args) { throw new ConfigurationException(message, args); }
boolean hasConfiguration(ConfigKey key) { Object o = data.get(key); if (null != o && NULL != o) { return true; } try { o = key.val(raw); if (null == o) { return false; } return true; } catch (ConfigurationException e) { Throwable t = e.getCause(); if (t instanceof UnexpectedNewInstanceException) { // assume this is caused by certain `.impl` setting which are not a class return true; } // we don't know what it is so just rethrow it throw e; } }
/** * Throws out a {@link ConfigurationException} with cause and message specified. * @param cause * the cause of the configuration error. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) { throw new ConfigurationException(cause, message, args); }
boolean hasConfiguration(ConfigKey key) { Object o = data.get(key); if (null != o && NULL != o) { return true; } try { o = key.val(raw); if (null == o) { return false; } return true; } catch (ConfigurationException e) { Throwable t = e.getCause(); if (t instanceof UnexpectedNewInstanceException) { // assume this is caused by certain `.impl` setting which are not a class return true; } // we don't know what it is so just rethrow it throw e; } }
/** * Throws out a {@link ConfigurationException} with message specified. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(String message, Object... args) { throw new ConfigurationException(message, args); }
/** * Throws out a {@link ConfigurationException} with cause and message specified. * @param cause * the cause of the configuration error. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) { throw new ConfigurationException(cause, message, args); }
public int httpMaxParams() { if (-1 == httpMaxParams) { httpMaxParams = getInteger(HTTP_MAX_PARAMS, 128); if (httpMaxParams < 0) { throw new ConfigurationException("http.params.max setting cannot be negative number. Found: %s", httpMaxParams); } } return httpMaxParams; }
public int httpMaxParams() { if (-1 == httpMaxParams) { httpMaxParams = getInteger(HTTP_MAX_PARAMS, 128); if (httpMaxParams < 0) { throw new ConfigurationException("http.params.max setting cannot be negative number. Found: %s", httpMaxParams); } } return httpMaxParams; }
private WebRenderExt getWebRenderExt(String clsName) { try { return Act.app().getInstance(clsName); } catch (Exception ex) { throw new ConfigurationException(ex, "Error loading WebRenderExt: %s", ex.getMessage()); } }
throw new ConfigurationException(e, "Error reading file configuration %s", key);
private void _defPasswordSpec(String spec) { try { defPasswordValidator = PasswordSpec.parse(spec); } catch (IllegalArgumentException e) { // try to check if the spec is a PasswordValidator try { defPasswordValidator = app.getInstance(spec); } catch (Exception e2) { throw new ConfigurationException("Password spec unrecognized: " + spec); } } }
throw new ConfigurationException(e, "Error reading file configuration %s", key);
<T> T getImpl(Map<String, ?> configuration, String key, String suffix, $.F0<?> defVal) { Object v = getValFromAliases(configuration, key, "impl", defVal); if (null == v) return null; if (v instanceof Class) { try { return instanceOf((Class<T>) v); } catch (Exception e) { throw new ConfigurationException(e, "Error getting implementation configuration: %s", key); } } if (!(v instanceof String)) return (T) v; String clsName = (String) v; try { return instanceOf(clsName); } catch (Exception e) { throw new ConfigurationException(e, "Error getting implementation configuration: %s", key); } }
public ReturnValueAdvice globalReturnValueAdvice() { if (null != globalReturnValueAdviceSet) { return globalReturnValueAdvice; } String s = get(GLOBAL_RETURN_VALUE_ADVICE, null); if (null != s) { try { globalReturnValueAdvice = app.getInstance(s); } catch (Exception e) { throw new ConfigurationException("Error loading global returnValueAdvice: " + s); } } globalReturnValueAdviceSet = true; return globalReturnValueAdvice; }
private void _defPasswordSpec(String spec) { try { defPasswordValidator = PasswordSpec.parse(spec); } catch (IllegalArgumentException e) { // try to check if the spec is a PasswordValidator try { defPasswordValidator = app.getInstance(spec); } catch (Exception e2) { throw new ConfigurationException("Password spec unrecognized: " + spec); } } }
<T> T getImpl(Map<String, ?> configuration, String key, String suffix, $.F0<?> defVal) { Object v = getValFromAliases(configuration, key, "impl", defVal); if (null == v) return null; if (v instanceof Class) { try { return instanceOf((Class<T>) v); } catch (Exception e) { throw new ConfigurationException(e, "Error getting implementation configuration: %s", key); } } if (!(v instanceof String)) return (T) v; String clsName = (String) v; try { return instanceOf(clsName); } catch (Exception e) { throw new ConfigurationException(e, "Error getting implementation configuration: %s", key); } }
Throwable t = e.getCause(); if (null != t && t.getMessage().contains("Address already in use")) { throw new ConfigurationException("Cannot start app, port[%s] already occupied. Possible cause: another app instance is running", port); throw new ConfigurationException(e, "Cannot start CLI server on port: %s", port);
public ValidateViolationAdvice globalValidateViolationAdvice() { if (null != globalValidateViolationAdviceSet) { return globalValidateViolationAdvice; } String s = get(GLOBAL_VALIDATE_VIOLATION_ADVICE, null); if (null != s) { try { globalValidateViolationAdvice = app.getInstance(s); } catch (Exception e) { throw new ConfigurationException("Error loading global returnValueAdvice: " + s); } } globalValidateViolationAdviceSet = true; return globalValidateViolationAdvice; }
public ReturnValueAdvice globalReturnValueAdvice() { if (null != globalReturnValueAdviceSet) { return globalReturnValueAdvice; } String s = get(GLOBAL_RETURN_VALUE_ADVICE, null); if (null != s) { try { globalReturnValueAdvice = app.getInstance(s); } catch (Exception e) { throw new ConfigurationException("Error loading global returnValueAdvice: " + s); } } globalReturnValueAdviceSet = true; return globalReturnValueAdvice; }
public ValidateViolationAdvice globalValidateViolationAdvice() { if (null != globalValidateViolationAdviceSet) { return globalValidateViolationAdvice; } String s = get(GLOBAL_VALIDATE_VIOLATION_ADVICE, null); if (null != s) { try { globalValidateViolationAdvice = app.getInstance(s); } catch (Exception e) { throw new ConfigurationException("Error loading global returnValueAdvice: " + s); } } globalValidateViolationAdviceSet = true; return globalValidateViolationAdvice; }