public MalformedTemplateNameException(String templateName, String malformednessDescription) { super("Malformed template name, " + StringUtil.jQuote(templateName) + ": " + malformednessDescription); this.templateName = templateName; this.malformednessDescription = malformednessDescription; }
private NestedContentNotSupportedException(String description, Exception cause, Environment env) { super( "Nested content (body) not supported." + (description != null ? " " + StringUtil.jQuote(description) : ""), cause, env); }
public UnrecognizedTimeZoneException(String timeZoneName) { super("Unrecognized time zone: " + StringUtil.jQuote(timeZoneName)); this.timeZoneName = timeZoneName; }
/** * Converts the parameter with <code>toString</code> (if it's not <code>null</code>) and passes it to * {@link #jQuote(String)}. */ public static String jQuote(Object obj) { return jQuote(obj != null ? obj.toString() : null); }
private ParseException newInvalidParameterValueException(String name, String value, int valuePos, InvalidParameterValueException e) { return new java.text.ParseException( StringUtil.jQuote(value) + " is an invalid value for the \"" + name + "\" parameter: " + e.message, valuePos); }
@Override protected String dump(boolean canonical) { if (canonical) { return "<#--" + text + "-->"; } else { return "comment " + StringUtil.jQuote(text.trim()); } }
@Override protected String dump(boolean canonical) { if (canonical) { String text = new String(this.text); if (unparsed) { return "<#noparse>" + text + "</#noparse>"; } return text; } else { return "text " + StringUtil.jQuote(new String(text)); } }
public _ObjectBuilderSettingEvaluationException(String expected, String src, int location) { super("Expression syntax error: Expected a(n) " + expected + ", but " + (location < src.length() ? "found character " + StringUtil.jQuote("" + src.charAt(location)) + " at position " + (location + 1) + "." : "the end of the parsed string was reached.") ); }
private static void checkInputStreamNotNull(InputStream ins, Class<?> baseClass, String resource) throws IOException { if (ins == null) { throw new IOException("Class-loader resource not found (shown quoted): " + StringUtil.jQuote(resource) + ". The base class was " + baseClass.getName() + "."); } }
/** * Show class name and some details that are useful in template-not-found errors. * * @since 2.3.21 */ @Override public String toString() { return TemplateLoaderUtils.getClassNameForToString(this) + "(subdirPath=" + StringUtil.jQuote(subdirPath) + ", servletContext={contextPath=" + StringUtil.jQuote(getContextPath()) + ", displayName=" + StringUtil.jQuote(servletContext.getServletContextName()) + "})"; }
private ParseException newUnknownParameterException(String name, int namePos) throws ParseException { StringBuilder sb = new StringBuilder(128); sb.append("Unsupported parameter name, ").append(StringUtil.jQuote(name)); sb.append(". The supported names are: "); Set<String> legalNames = PARAM_HANDLERS.keySet(); String[] legalNameArr = legalNames.toArray(new String[legalNames.size()]); Arrays.sort(legalNameArr); for (int i = 0; i < legalNameArr.length; i++) { if (i != 0) { sb.append(", "); } sb.append(legalNameArr[i]); } return new java.text.ParseException(sb.toString(), namePos); }
@Override protected String doConversion(Object obj) { return StringUtil.jQuote(_ErrorDescriptionBuilder.toString(obj)); }
/** * Returns the joined list of failed TLD-s, or {@code null} if there was none. */ private String getFailedTLDsList() { synchronized (failedTldLocations) { if (failedTldLocations.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < failedTldLocations.size(); i++) { if (i != 0) { sb.append(", "); } sb.append(StringUtil.jQuote(failedTldLocations.get(i))); } return sb.toString(); } }
public static Integer getSystemProperty(final String key, final int defValue) { try { return (Integer) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Integer.getInteger(key, defValue); } }); } catch (AccessControlException e) { LOG.warn("Insufficient permissions to read system property " + StringUtil.jQuote(key) + ", using default value " + defValue); return Integer.valueOf(defValue); } } }
/** * Returns the short description of this format, to be used in error messages. * Override {@link #toStringExtraProperties()} to customize this. */ @Override public final String toString() { String extras = toStringExtraProperties(); return getName() + "(" + "mimeType=" + StringUtil.jQuote(getMimeType()) + ", " + "class=" + ClassUtil.getShortClassNameOfObject(this, true) + (extras.length() != 0 ? ", " : "") + extras + ")"; }
private Object findTemplateSource(String path) throws IOException { final Object result = templateLoader.findTemplateSource(path); if (LOG.isDebugEnabled()) { LOG.debug("TemplateLoader.findTemplateSource(" + StringUtil.jQuote(path) + "): " + (result == null ? "Not found" : "Found")); } return modifyForConfIcI(result); }
protected final TemplateModelException toTemplateModelExceptionOrRethrow(Exception e) throws TemplateModelException { if (e instanceof RuntimeException && !isCommonRuntimeException((RuntimeException) e)) { throw (RuntimeException) e; } if (e instanceof TemplateModelException) { throw (TemplateModelException) e; } if (e instanceof TemplateExceptionWrapperJspException) { return toTemplateModelExceptionOrRethrow(((TemplateExceptionWrapperJspException) e).getCause()); } return new TemplateModelException( "Error while invoking the " + StringUtil.jQuote(tagName) + " JSP custom tag; see cause exception", e instanceof TemplateException, e); }