use of lucee.transformer.cfml.evaluator.EvaluatorException in project Lucee by lucee.
the class Output method evaluate.
@Override
public void evaluate(Tag tag, TagLibTag libTag, FunctionLib[] flibs) throws EvaluatorException {
TagOutput output = (TagOutput) tag;
// check if inside a query tag
TagOutput parent = output;
// encodeFor
Attribute encodeFor = tag.getAttribute("encodefor");
if (encodeFor != null) {
Expression encodeForValue = CastString.toExprString(encodeFor.getValue());
if (encodeForValue instanceof Literal) {
Literal l = (Literal) encodeForValue;
short df = (short) -1;
short encType = ESAPIEncode.toEncodeType(l.getString(), df);
if (encType != df)
encodeForValue = encodeForValue.getFactory().createLitInteger(encType);
}
addEncodeToChildren(tag.getBody().getStatements().iterator(), encodeForValue, getEncodeForFunction(flibs));
}
// query
boolean hasParentWithGroup = false;
boolean hasParentWithQuery = false;
boolean hasQuery = tag.containsAttribute("query");
while ((parent = getParentTagOutput(parent)) != null) {
if (!hasParentWithQuery)
hasParentWithQuery = parent.hasQuery();
if (!hasParentWithGroup)
hasParentWithGroup = parent.hasGroup();
if (hasParentWithQuery && hasParentWithGroup)
break;
}
if (hasQuery && hasParentWithQuery)
throw new EvaluatorException("Nesting of tags cfoutput with attribute query is not allowed");
if (hasQuery)
output.setType(TagOutput.TYPE_QUERY);
else if (tag.containsAttribute("group") && hasParentWithQuery)
output.setType(TagOutput.TYPE_GROUP);
else if (hasParentWithQuery) {
if (hasParentWithGroup)
output.setType(TagOutput.TYPE_INNER_GROUP);
else
output.setType(TagOutput.TYPE_INNER_QUERY);
} else
output.setType(TagOutput.TYPE_NORMAL);
// attribute maxrows and endrow not allowd at the same time
if (tag.containsAttribute("maxrows") && tag.containsAttribute("endrow"))
throw new EvaluatorException("Wrong Context, you cannot use attribute maxrows and endrow at the same time.");
}
use of lucee.transformer.cfml.evaluator.EvaluatorException in project Lucee by lucee.
the class ProcParam method evaluate.
@Override
public void evaluate(Tag tag, TagLibTag libTag) throws EvaluatorException {
String ns = libTag.getTagLib().getNameSpaceAndSeparator();
String name = ns + "storedproc";
// check if tag is direct inside if
if (!ASMUtil.hasAncestorTag(tag, name))
throw new EvaluatorException("Wrong Context, tag " + libTag.getFullName() + " must be inside a " + name + " tag");
}
use of lucee.transformer.cfml.evaluator.EvaluatorException in project Lucee by lucee.
the class ProcResult method evaluate.
@Override
public void evaluate(Tag tag, TagLibTag libTag) throws EvaluatorException {
String ns = libTag.getTagLib().getNameSpaceAndSeparator();
String name = ns + "storedproc";
// check if tag is direct inside if
if (!ASMUtil.hasAncestorTag(tag, name))
throw new EvaluatorException("Wrong Context, tag " + libTag.getFullName() + " must be inside a " + name + " tag");
}
use of lucee.transformer.cfml.evaluator.EvaluatorException in project Lucee by lucee.
the class Property method getComponentName.
public static String getComponentName(Tag tag) throws EvaluatorException {
Page page;
try {
page = ASMUtil.getAncestorPage(tag);
} catch (TransformerException e) {
throw new EvaluatorException(e.getMessage());
}
String ns = tag.getTagLibTag().getTagLib().getNameSpaceAndSeparator();
String compName = ns + (page.getSourceCode().getDialect() == CFMLEngine.DIALECT_CFML ? Constants.CFML_COMPONENT_TAG_NAME : Constants.LUCEE_COMPONENT_TAG_NAME);
return compName;
}
use of lucee.transformer.cfml.evaluator.EvaluatorException in project Lucee by lucee.
the class QueryParam method evaluate.
@Override
public void evaluate(Tag tag, TagLibTag libTag) throws EvaluatorException {
String ns = libTag.getTagLib().getNameSpaceAndSeparator();
String queryName = ns + "query";
if (!ASMUtil.hasAncestorTag(tag, queryName))
throw new EvaluatorException("Wrong Context, tag " + libTag.getFullName() + " must be inside a " + queryName + " tag");
}
Aggregations