/** * Helper method to log a warning when a deprecation has been found. * * @param deprecationType the type of deprecation (eg "getter", "setter", "method") * @param object the object that has a deprecation * @param methodName the deprecated method's name * @param info a Velocity {@link org.apache.velocity.util.introspection.Info} object containing information about * where the deprecation was located in the Velocity template file */ private void logWarning(String deprecationType, Object object, String methodName, Info info) { this.log.warn("Deprecated usage of {} [{}] in {}@{},{}", deprecationType, object.getClass() .getCanonicalName() + "." + methodName, info.getTemplateName(), info.getLine(), info.getColumn()); } }
public InvalidReferenceInfo(String invalidReference, Info info) { super(info.getTemplateName(),info.getLine(),info.getColumn()); this.invalidReference = invalidReference; }
public InvalidReferenceInfo(String invalidReference, Info info) { super(info.getTemplateName(),info.getLine(),info.getColumn()); this.invalidReference = invalidReference; }
public InvalidReferenceInfo(String invalidReference, Info info) { super(info.getTemplateName(),info.getLine(),info.getColumn()); this.invalidReference = invalidReference; }
/***********************************************************************/ public static String getInfoText(Info i) { return " at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName(); } public Info getInfo()
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); }
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); }
/** * Helper method to log a warning when a deprecation has been found. * * @param deprecationType the type of deprecation (eg "getter", "setter", "method") * @param object the object that has a deprecation * @param methodName the deprecated method's name * @param info a Velocity {@link org.apache.velocity.util.introspection.Info} object containing information about * where the deprecation was located in the Velocity template file */ private void logWarning(String deprecationType, Object object, String methodName, Info info) { this.log.warn(String.format("Deprecated usage of %s [%s] in %s@%d,%d", deprecationType, object.getClass() .getCanonicalName() + "." + methodName, info.getTemplateName(), info.getLine(), info.getColumn())); } }
/** * Render the method exception, and optionally the exception message and stack trace. * * @param context current context * @param claz the class of the object the method is being applied to * @param method the method * @param e the thrown exception * @param info template name and line, column informations * @return an object to insert in the page */ public Object methodException(Context context, Class claz, String method, Exception e, Info info) { boolean showTemplateInfo = rs.getBoolean(SHOW_TEMPLATE_INFO, false); boolean showStackTrace = rs.getBoolean(SHOW_STACK_TRACE,false); StringBuilder st = new StringBuilder(); st.append("Exception while executing method ").append(claz.toString()).append(".").append(method); st.append(": ").append(e.getClass().getName()).append(": ").append(e.getMessage()); if (showTemplateInfo) { st.append(" at ").append(info.getTemplateName()).append(" (line ").append(info.getLine()).append(", column ").append(info.getColumn()).append(")"); } if (showStackTrace) { st.append(System.lineSeparator()).append(getStackTrace(e)); } return st.toString(); }
/** * Helper method to log a warning when a deprecation has been found. * * @param deprecationType the type of deprecation (eg "getter", "setter", "method") * @param object the object that has a deprecation * @param methodName the deprecated method's name * @param info a Velocity {@link org.apache.velocity.util.introspection.Info} object containing * information about where the deprecation was located in the Velocity template file */ private void logWarning(String deprecationType, Object object, String methodName, Info info) { log.warn(String.format("Deprecated usage of %s [%s] in %s@%d,%d", deprecationType, object .getClass().getCanonicalName() + "." + methodName, info.getTemplateName(), info.getLine(), info.getColumn())); } }
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); }
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @param invalidSyntax the invalid syntax or reference triggering this exception * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info, String invalidSyntax) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); this.invalidSyntax = invalidSyntax; }
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @param invalidSyntax the invalid syntax or reference triggering this exception * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info, String invalidSyntax) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); this.invalidSyntax = invalidSyntax; }
/** * Create a ParseErrorRuntimeException with the given message and info * * @param exceptionMessage the error exception message * @param info an Info object with the current template info * @param invalidSyntax the invalid syntax or reference triggering this exception * @since 1.5 */ public ParseErrorException(String exceptionMessage, Info info, String invalidSyntax) { super(exceptionMessage); columnNumber = info.getColumn(); lineNumber = info.getLine(); templateName = info.getTemplateName(); this.invalidSyntax = invalidSyntax; }
/** * Formats a textual representation of this object as <code>SOURCE * [line X, column Y]</code>. * * @return String representing this object. * @since 1.5 */ public String toString() { return StringUtils.formatFileString(getTemplateName(), getLine(), getColumn()); } }
/** * Simply creates a string that formats the template filename with line number * and column. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Info info) { return formatFileString(info.getTemplateName(), info.getLine(), info.getColumn()); }
/** * Formats a textual representation of this object as <code>SOURCE * [line X, column Y]</code>. * * @return String representing this object. * @since 1.5 */ public String toString() { return Log.formatFileString(getTemplateName(), getLine(), getColumn()); } }
/** * Simply creates a string that formats the template filename with line number * and column. We use this routine to provide a consistent format for displaying * file errors. */ public static String formatFileString(Info info) { return formatFileString(info.getTemplateName(), info.getLine(), info.getColumn()); }
/** * Formats a textual representation of this object as <code>SOURCE * [line X, column Y]</code>. * * @return String representing this object. * @since 1.5 */ public String toString() { return Log.formatFileString(getTemplateName(), getLine(), getColumn()); } }
/** * Simply creates a string that formats the template filename with line number * and column. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Info info) { return formatFileString(info.getTemplateName(), info.getLine(), info.getColumn()); }