/** * Return a string that tells the current location of this node. */ protected String getLocation(InternalContextAdapter context) { return Log.formatFileString(this); }
/** * Return a string that tells the current location of this node. */ protected String getLocation(InternalContextAdapter context) { return Log.formatFileString(this); }
/** * @see Exception#getMessage() * @since 1.5 */ public String getMessage() { StringBuffer message = new StringBuffer(); message.append(super.getMessage()); message.append(" at "); message.append(Log.formatFileString(templateName, lineNumber, columnNumber)); return message.toString(); } }
/** * @see Exception#getMessage() * @since 1.5 */ public String getMessage() { StringBuffer message = new StringBuffer(); message.append(super.getMessage()); message.append(" at "); message.append(Log.formatFileString(templateName, lineNumber, columnNumber)); return message.toString(); } }
/** * @param sb * @since 1.5 */ protected void appendTemplateInfo(final StringBuffer sb) { sb.append(Log.formatFileString(getTemplateName(), getLineNumber(), getColumnNumber())); sb.append(eol); } }
/** * @param sb */ protected void appendTemplateInfo(final StringBuffer sb) { sb.append(Log.formatFileString(getTemplateName(), getLineNumber(), getColumnNumber())); sb.append(eol); } }
/** * @param sb * @since 1.5 */ protected void appendTemplateInfo(final StringBuffer sb) { sb.append(Log.formatFileString(getTemplateName(), getLineNumber(), getColumnNumber())); sb.append(eol); } }
/** * @param sb */ protected void appendTemplateInfo(final StringBuffer sb) { sb.append(Log.formatFileString(getTemplateName(), getLineNumber(), getColumnNumber())); sb.append(eol); } }
/** * 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()); } }
/** * Creates a string that formats the template filename with line number * and column of the given Node. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Node node) { return formatFileString(node.getTemplateName(), node.getLine(), node.getColumn()); }
/** * Creates a string that formats the template filename with line number * and column of the given Directive. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Directive directive) { return formatFileString(directive.getTemplateName(), directive.getLine(), directive.getColumn()); }
/** * Creates a string that formats the template filename with line number * and column of the given Node. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Node node) { return formatFileString(node.getTemplateName(), node.getLine(), node.getColumn()); }
@Override @SuppressWarnings("unchecked") public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { Resource fisResource = Util.getResource(context); try { // 添加资源 Like Require fisResource.addResource(node.jjtGetChild(0).value(context).toString()); } catch (Exception err) { writer.write(err.getMessage() + " " + Log.formatFileString(this)); log.warn(err.getStackTrace()); } super.render(context, writer, node); // ResourceManager.unRef(context); return true; }
/** * 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()); } }
/** * Creates a string that formats the template filename with line number * and column of the given Directive. We use this routine to provide a cosistent format for displaying * file errors. */ public static final String formatFileString(Directive directive) { return formatFileString(directive.getTemplateName(), directive.getLine(), directive.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()); }
@Override public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { if ( node.jjtGetNumChildren() == 0 ) { throw new VelocityException("#require(): argument missing at " + Log.formatFileString(this)); } Resource fisResource = Util.getResource(context); try { writer.write(fisResource.getUri(node.jjtGetChild(0).value(context).toString())); } catch (Exception err) { throw new VelocityException(err.getMessage() + Log.formatFileString(this)); } // ResourceManager.unRef(context); return true; } }
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) { super.init(rs, context, node); int kids = node.jjtGetNumChildren(); if (kids > 1) { throw new VelocityException("The #stop directive only accepts a single message parameter at " + Log.formatFileString(this)); } else { hasMessage = (kids == 1); } }
protected void avoidEmbedSelf(Node node) { // style 不能嵌套。 Node parent = node.jjtGetParent(); while (parent != null) { if (parent instanceof ASTDirective && ((ASTDirective)parent).getDirectiveName().equals(this.getName())) { throw new VelocityException("Can\'t embed #"+ this.getName() +" in #"+ this.getName() +" directive " + Log.formatFileString(this)); } parent = parent.jjtGetParent(); } } }