Java Code Examples for org.apache.velocity.util.introspection.Info#getLine()

The following examples show how to use org.apache.velocity.util.introspection.Info#getLine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgnVelocityUberspector.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Checks method call or property accesses (which are performed by calling getter or setter).
 * 
 * @param method called method
 * @param args arguments
 * @param info information on template
 * 
 * @throws VelocityCheckerException 
 */
private void checkMethodAccess( Method method, Object[] args, Info info) {
	List<ParameterAnnotationDescriptor> list = annotationIntrospector.getParameterAnnotation( method, VelocityCheck.class);
	
	if( logger.isInfoEnabled()) {
		logger.info( "Check access for method " + method.getName());
		for( ParameterAnnotationDescriptor pad : list) {
			logger.info( "Annotation for parameter " + pad.getParameterIndex() + " is " + pad.getAnnotation().annotationType().getName());
		}
		
	}

	try {
		performChecksOnParameters( method, args, list);
	} catch( VelocityCheckerException e) {
		logger.fatal( "Runtime check of Velocity script failed! (" + info + ")", e);
		
		if( isAbortScriptsEnabled()) {
			logger.info( "Aborting script by exception");
			throw new MethodInvocationException( "Aborting Velocity script", e, method.getName(), info.getTemplateName(), info.getLine(), info.getColumn());
		}
	} 
}
 
Example 2
Source File: ParseErrorException.java    From velocity-engine with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 3
Source File: ParseErrorException.java    From velocity-engine with Apache License 2.0 5 votes vote down vote up
/**
 * 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 2.2
 */
public ParseErrorException(String exceptionMessage, Info info, String[] stacktrace)
{
    super(exceptionMessage, null, stacktrace);
    columnNumber = info.getColumn();
    lineNumber = info.getLine();
    templateName = info.getTemplateName();
}
 
Example 4
Source File: ParseErrorException.java    From velocity-engine with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: EventHandler.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Object invalidGetMethod(Context context, String s, Object o, String s1, Info info) {
    String str = "Error in line " + info.getLine() + ", column " + info.getColumn() + ": ";
    errors.add(str,new ActionMessage(str + "Null reference " + s + "."));
    return null;
}
 
Example 6
Source File: EventHandler.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Object invalidMethod(Context context, String s, Object o, String s1, Info info) {
    String str = "Error in line " + info.getLine() + ", column " + info.getColumn() + ": ";
    errors.add(str, new ActionMessage(str + "Invalid method "+s+"."));
    return null;
}
 
Example 7
Source File: VelocityParsingError.java    From ApprovalTests.Java with Apache License 2.0 4 votes vote down vote up
public static String getInfoText(Info i)
{
  return " at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName();
}
 
Example 8
Source File: InvalidReferenceInfo.java    From velocity-engine with Apache License 2.0 4 votes vote down vote up
public InvalidReferenceInfo(String invalidReference, Info info)
{
    super(info.getTemplateName(),info.getLine(),info.getColumn());
    this.invalidReference = invalidReference;
}