polish
This commit is contained in:
@@ -133,6 +133,9 @@ public class OgnlExpressionParser implements ExpressionParser {
|
||||
|
||||
public Expression parseExpression(String expressionString, ParserContext context) throws ParserException {
|
||||
Assert.notNull(expressionString, "The expression string to parse is required");
|
||||
if (expressionString.length() == 0) {
|
||||
return parseEmptyExpressionString(context);
|
||||
}
|
||||
Expression[] expressions = parseExpressions(expressionString, context);
|
||||
if (expressions.length == 1) {
|
||||
return expressions[0];
|
||||
@@ -192,6 +195,19 @@ public class OgnlExpressionParser implements ExpressionParser {
|
||||
|
||||
// helper methods
|
||||
|
||||
/**
|
||||
* Helper that handles a empty expression string.
|
||||
*/
|
||||
private Expression parseEmptyExpressionString(ParserContext context) {
|
||||
if (allowUndelimitedEvalExpressions) {
|
||||
// let the parser handle it
|
||||
return doParseExpression("", context);
|
||||
} else {
|
||||
// return a literal expression containing the empty string
|
||||
return new LiteralExpression("");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper that parses given expression string using the configured parser. The expression string can contain any
|
||||
* number of expressions all contained in "${...}" markers. For instance: "foo${expr0}bar${expr1}". The static
|
||||
|
||||
Reference in New Issue
Block a user