Package org.springframework.binding.expression

Examples of org.springframework.binding.expression.ParserException


    if (context.isTemplate()) {
      return parseTemplate(expressionString, context);
    } else {
      if (expressionString.startsWith(getExpressionPrefix()) && expressionString.endsWith(getExpressionSuffix())) {
        if (!allowDelimitedEvalExpressions) {
          throw new ParserException(
              expressionString,
              "The expression '"
                  + expressionString
                  + "' being parsed is expected be a standard OGNL expression. Do not attempt to enclose such expression strings in ${} delimiters--this is redundant. If you need to parse a template that mixes literal text with evaluatable blocks, set the 'template' parser context attribute to true.",
              null);
View Full Code Here


        } else {
          // another expression exists after this one in the expression string
          suffixIndex = expressionString.lastIndexOf(getExpressionSuffix(), nextPrefixIndex);
        }
        if (suffixIndex < (prefixIndex + getExpressionPrefix().length())) {
          throw new ParserException(expressionString, "No ending suffix '" + getExpressionSuffix()
              + "' for expression starting at character " + prefixIndex + ": "
              + expressionString.substring(prefixIndex), null);
        } else if (suffixIndex == prefixIndex + getExpressionPrefix().length()) {
          throw new ParserException(expressionString, "No expression defined within delimiter '"
              + getExpressionPrefix() + getExpressionSuffix() + "' at character " + prefixIndex, null);
        } else {
          String expr = expressionString.substring(prefixIndex + getExpressionPrefix().length(), suffixIndex);
          expressions.add(doParseExpression(expr, context));
          startIdx = suffixIndex + 1;
View Full Code Here

    try {
      ValueExpression expression = parseValueExpression(expressionString, context);
      ELContextFactory contextFactory = getContextFactory(context.getEvaluationContextType(), expressionString);
      return new ELExpression(contextFactory, expression);
    } catch (ELException e) {
      throw new ParserException(expressionString, e);
    }
  }
View Full Code Here

  }

  private void assertNotDelimited(String expressionString) {
    if ((expressionString.startsWith("#{") && expressionString.endsWith("}"))
        || (expressionString.startsWith("${") && expressionString.endsWith("}"))) {
      throw new ParserException(expressionString, "This expression '" + expressionString
          + "' being parsed is expected be an 'eval' EL expression string. "
          + "Do not attempt to enclose such expression strings in #{} or ${} delimiters. "
          + "If you need to parse a template that mixes literal text with evaluatable blocks, "
          + "set the 'template' parser context attribute to true.", null);
    }
View Full Code Here

    }
  }

  private void assertHasText(String expressionString) {
    if (expressionString.length() == 0) {
      throw new ParserException(expressionString, "The EL eval expression to parse must have text", null);
    }
  }
View Full Code Here

    try {
      return new OgnlExpression(Ognl.parseExpression(expressionString), parseVariableExpressions(context
          .getExpressionVariables()), context.getExpectedEvaluationResultType(), expressionString,
          conversionService);
    } catch (OgnlException e) {
      throw new ParserException(expressionString, e);
    }
  }
View Full Code Here

    if (context.isTemplate()) {
      return parseTemplate(expressionString, context);
    } else {
      if (expressionString.startsWith(getExpressionPrefix()) && expressionString.endsWith(getExpressionSuffix())) {
        if (!allowDelimitedEvalExpressions) {
          throw new ParserException(
              expressionString,
              "The expression '"
                  + expressionString
                  + "' being parsed is expected be a standard OGNL expression. Do not attempt to enclose such expression strings in ${} delimiters--this is redundant. If you need to parse a template that mixes literal text with evaluatable blocks, set the 'template' parser context attribute to true.",
              null);
View Full Code Here

        } else {
          // another expression exists after this one in the expression string
          suffixIndex = expressionString.lastIndexOf(getExpressionSuffix(), nextPrefixIndex);
        }
        if (suffixIndex < (prefixIndex + getExpressionPrefix().length())) {
          throw new ParserException(expressionString, "No ending suffix '" + getExpressionSuffix()
              + "' for expression starting at character " + prefixIndex + ": "
              + expressionString.substring(prefixIndex), null);
        } else if (suffixIndex == prefixIndex + getExpressionPrefix().length()) {
          throw new ParserException(expressionString, "No expression defined within delimiter '"
              + getExpressionPrefix() + getExpressionSuffix() + "' at character " + prefixIndex, null);
        } else {
          String expr = expressionString.substring(prefixIndex + getExpressionPrefix().length(), suffixIndex);
          expressions.add(doParseExpression(expr, context));
          startIdx = suffixIndex + 1;
View Full Code Here

    try {
      return new OgnlExpression(Ognl.parseExpression(expressionString),
          parseVariableExpressions(context.getExpressionVariables()),
          context.getExpectedEvaluationResultType(), expressionString, conversionService);
    } catch (OgnlException e) {
      throw new ParserException(expressionString, e);
    }
  }
View Full Code Here

    try {
      ValueExpression expression = parseValueExpression(expressionString, context);
      ELContextFactory contextFactory = getContextFactory(context.getEvaluationContextType(), expressionString);
      return new ELExpression(contextFactory, expression);
    } catch (ELException e) {
      throw new ParserException(expressionString, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.ParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.