private boolean getYesNo(Expression exp, String s) throws TemplateException { try { return StringUtil.getYesNo(s); } catch (IllegalArgumentException iae) { throw new _MiscTemplateException(exp, "Value must be boolean (or one of these strings: " + "\"n\", \"no\", \"f\", \"false\", \"y\", \"yes\", \"t\", \"true\"), but it was ", new _DelayedJQuote(s), "."); } }
setLocalizedLookup(StringUtil.getYesNo(value)); } else if (STRICT_SYNTAX_KEY_SNAKE_CASE.equals(name) || STRICT_SYNTAX_KEY_CAMEL_CASE.equals(name)) { setStrictSyntaxMode(StringUtil.getYesNo(value)); } else if (WHITESPACE_STRIPPING_KEY_SNAKE_CASE.equals(name) || WHITESPACE_STRIPPING_KEY_CAMEL_CASE.equals(name)) { setWhitespaceStripping(StringUtil.getYesNo(value)); } else if (AUTO_ESCAPING_POLICY_KEY_SNAKE_CASE.equals(name) || AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE.equals(name)) { if ("enable_if_default".equals(value) || "enableIfDefault".equals(value)) { unsetRecognizeStandardFileExtensions(); } else { setRecognizeStandardFileExtensions(StringUtil.getYesNo(value));
private boolean getBoolean(Expression exp, boolean legacyCompat) throws ParseException { TemplateModel tm = null; try { tm = exp.eval(null); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nCould not evaluate expression: " + exp.getCanonicalForm(), exp, e); } if (tm instanceof TemplateBooleanModel) { try { return ((TemplateBooleanModel) tm).getAsBoolean(); } catch (TemplateModelException tme) { } } if (legacyCompat && tm instanceof TemplateScalarModel) { try { return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString()); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nExpecting boolean (true/false), found: " + exp.getCanonicalForm(), exp); } } throw new ParseException("Expecting boolean (true/false) parameter", exp); }
noCache = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_BUFFER_SIZE)) { bufferSize = Integer.valueOf(parseSize(value)); throw new ConflictingInitParamsException(INIT_PARAM_DEBUG, DEPR_INITPARAM_DEBUG); debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_DEBUG)) { debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_CONTENT_TYPE)) { contentType = new ContentType(value); overrideResponseLocale = initParamValueToEnum(value, OverrideResponseLocale.values()); } else if (name.equals(INIT_PARAM_EXCEPTION_ON_MISSING_TEMPLATE)) { exceptionOnMissingTemplate = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_META_INF_TLD_LOCATIONS)) {; metaInfTldSources = parseAsMetaInfTldLocations(value);
setClassicCompatibleAsInt(Integer.parseInt(value)); } else { setClassicCompatible(value != null ? StringUtil.getYesNo(value) : false); } else if (STRICT_BEAN_MODELS_KEY_SNAKE_CASE.equals(name) || STRICT_BEAN_MODELS_KEY_CAMEL_CASE.equals(name)) { setStrictBeanModels(StringUtil.getYesNo(value)); } else if (AUTO_FLUSH_KEY_SNAKE_CASE.equals(name) || AUTO_FLUSH_KEY_CAMEL_CASE.equals(name)) { setAutoFlush(StringUtil.getYesNo(value)); } else if (SHOW_ERROR_TIPS_KEY_SNAKE_CASE.equals(name) || SHOW_ERROR_TIPS_KEY_CAMEL_CASE.equals(name)) { setShowErrorTips(StringUtil.getYesNo(value)); } else if (API_BUILTIN_ENABLED_KEY_SNAKE_CASE.equals(name) || API_BUILTIN_ENABLED_KEY_CAMEL_CASE.equals(name)) { setAPIBuiltinEnabled(StringUtil.getYesNo(value)); } else if (NEW_BUILTIN_CLASS_RESOLVER_KEY_SNAKE_CASE.equals(name) || NEW_BUILTIN_CLASS_RESOLVER_KEY_CAMEL_CASE.equals(name)) { setLogTemplateExceptions(StringUtil.getYesNo(value)); } else if (WRAP_UNCHECKED_EXCEPTIONS_KEY_SNAKE_CASE.equals(name) || WRAP_UNCHECKED_EXCEPTIONS_KEY_CAMEL_CASE.equals(name)) { setWrapUncheckedExceptions(StringUtil.getYesNo(value)); } else if (LAZY_AUTO_IMPORTS_KEY_SNAKE_CASE.equals(name) || LAZY_AUTO_IMPORTS_KEY_CAMEL_CASE.equals(name)) { setLazyAutoImports(value.equals(NULL) ? null : Boolean.valueOf(StringUtil.getYesNo(value))); } else if (LAZY_IMPORTS_KEY_SNAKE_CASE.equals(name) || LAZY_IMPORTS_KEY_CAMEL_CASE.equals(name)) { setLazyImports(StringUtil.getYesNo(value)); } else if (AUTO_INCLUDE_KEY_SNAKE_CASE.equals(name) || AUTO_INCLUDE_KEY_CAMEL_CASE.equals(name)) {
if (parseExp instanceof StringLiteral) { parse = Boolean.valueOf(StringUtil.getYesNo(parseExp.evalAndCoerceToPlainText(null))); } else { try {
private boolean getYesNo(String s) throws ParseException { try { return StringUtil.getYesNo(s); } catch (IllegalArgumentException iae) { throw new ParseException("Error " + getStartLocation() + "\nValue of include parse parameter " + "must be boolean or one of these strings: " + "\"n\", \"no\", \"f\", \"false\", \"y\", \"yes\", \"t\", \"true\"" + "\nFound: " + parseExp, parseExp); } }
private boolean getYesNo(Expression exp, String s) throws TemplateException { try { return StringUtil.getYesNo(s); } catch (IllegalArgumentException iae) { throw new _MiscTemplateException(exp, "Value must be boolean (or one of these strings: " + "\"n\", \"no\", \"f\", \"false\", \"y\", \"yes\", \"t\", \"true\"), but it was ", new _DelayedJQuote(s), "."); } }
private boolean getYesNo(Expression exp, String s) throws TemplateException { try { return StringUtil.getYesNo(s); } catch (IllegalArgumentException iae) { throw new _MiscTemplateException(exp, "Value must be boolean (or one of these strings: " + "\"n\", \"no\", \"f\", \"false\", \"y\", \"yes\", \"t\", \"true\"), but it was ", new _DelayedJQuote(s), "."); } }
nocache = StringUtil.getYesNo(value); } else if (name.equals(DEPR_INITPARAM_DEBUG)) { // BC if (getInitParameter(INITPARAM_DEBUG) != null) { + DEPR_INITPARAM_DEBUG); debug = StringUtil.getYesNo(value); } else if (name.equals(INITPARAM_DEBUG)) { debug = StringUtil.getYesNo(value); } else if (name.equals(INITPARAM_CONTENT_TYPE)) { contentType = value;
try { if (parseExp instanceof StringLiteral) { parse = StringUtil.getYesNo(parseExp.getStringValue(null));
setDefaultEncoding(value); } else if (LOCALIZED_LOOKUP_KEY.equals(key)) { setLocalizedLookup(StringUtil.getYesNo(value)); } else if (STRICT_SYNTAX_KEY.equals(key)) { setStrictSyntaxMode(StringUtil.getYesNo(value)); } else if (WHITESPACE_STRIPPING_KEY.equals(key)) { setWhitespaceStripping(StringUtil.getYesNo(value)); } else if (CACHE_STORAGE_KEY.equals(key)) { if (value.indexOf('.') == -1) {
private boolean getBoolean(Expression exp, boolean legacyCompat) throws ParseException { TemplateModel tm = null; try { tm = exp.eval(null); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nCould not evaluate expression: " + exp.getCanonicalForm(), exp, e); } if (tm instanceof TemplateBooleanModel) { try { return ((TemplateBooleanModel) tm).getAsBoolean(); } catch (TemplateModelException tme) { } } if (legacyCompat && tm instanceof TemplateScalarModel) { try { return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString()); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nExpecting boolean (true/false), found: " + exp.getCanonicalForm(), exp); } } throw new ParseException("Expecting boolean (true/false) parameter", exp); }
private boolean getBoolean(Expression exp, boolean legacyCompat) throws ParseException { TemplateModel tm = null; try { tm = exp.eval(null); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nCould not evaluate expression: " + exp.getCanonicalForm(), exp, e); } if (tm instanceof TemplateBooleanModel) { try { return ((TemplateBooleanModel) tm).getAsBoolean(); } catch (TemplateModelException tme) { } } if (legacyCompat && tm instanceof TemplateScalarModel) { try { return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString()); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nExpecting boolean (true/false), found: " + exp.getCanonicalForm(), exp); } } throw new ParseException("Expecting boolean (true/false) parameter", exp); }
setTimeZone(TimeZone.getTimeZone(value)); } else if (CLASSIC_COMPATIBLE_KEY.equals(key)) { setClassicCompatible(StringUtil.getYesNo(value)); } else if (TEMPLATE_EXCEPTION_HANDLER_KEY.equals(key)) { if (value.indexOf('.') == -1) { setURLEscapingCharset(value); } else if (STRICT_BEAN_MODELS.equals(key)) { setStrictBeanModels(StringUtil.getYesNo(value)); } else if (AUTO_FLUSH_KEY.equals(key)) { setAutoFlush(StringUtil.getYesNo(value)); } else if (NEW_BUILTIN_CLASS_RESOLVER_KEY.equals(key)) { if ("unrestricted".equals(value)) {
noCache = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_BUFFER_SIZE)) { bufferSize = Integer.valueOf(parseSize(value)); throw new ConflictingInitParamsException(INIT_PARAM_DEBUG, DEPR_INITPARAM_DEBUG); debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_DEBUG)) { debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_CONTENT_TYPE)) { contentType = new ContentType(value); overrideResponseLocale = initParamValueToEnum(value, OverrideResponseLocale.values()); } else if (name.equals(INIT_PARAM_EXCEPTION_ON_MISSING_TEMPLATE)) { exceptionOnMissingTemplate = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_META_INF_TLD_LOCATIONS)) {; metaInfTldSources = parseAsMetaInfTldLocations(value);
noCache = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_BUFFER_SIZE)) { bufferSize = Integer.valueOf(parseSize(value)); throw new ConflictingInitParamsException(INIT_PARAM_DEBUG, DEPR_INITPARAM_DEBUG); debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_DEBUG)) { debug = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_CONTENT_TYPE)) { contentType = new ContentType(value); overrideResponseLocale = initParamValueToEnum(value, OverrideResponseLocale.values()); } else if (name.equals(INIT_PARAM_EXCEPTION_ON_MISSING_TEMPLATE)) { exceptionOnMissingTemplate = StringUtil.getYesNo(value); } else if (name.equals(INIT_PARAM_META_INF_TLD_LOCATIONS)) {; metaInfTldSources = parseAsMetaInfTldLocations(value);
private boolean getBoolean(Expression exp) throws ParseException { TemplateModel tm = null; try { tm = exp.getAsTemplateModel(null); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nCould not evaluate expression: " + exp.getCanonicalForm() + exp.getStartLocation(), exp); } if (tm instanceof TemplateBooleanModel) { try { return ((TemplateBooleanModel) tm).getAsBoolean(); } catch (TemplateModelException tme) { } } if (tm instanceof TemplateScalarModel) { try { return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString()); } catch (Exception e) { throw new ParseException(e.getMessage() + "\nExpecting yes/no, found: " + exp.getCanonicalForm() + exp.getStartLocation(), exp); } } throw new ParseException("Expecting boolean (yes/no) parameter" + exp.getStartLocation(), exp); }
if (parseExp instanceof StringLiteral) { parse = Boolean.valueOf(StringUtil.getYesNo(parseExp.evalAndCoerceToPlainText(null))); } else { try {
if (parseExp instanceof StringLiteral) { parse = Boolean.valueOf(StringUtil.getYesNo(parseExp.evalAndCoerceToPlainText(null))); } else { try {