Package org.springframework.expression

Examples of org.springframework.expression.ParseException


          expressions.add(createLiteralExpression(context,expressionString.substring(startIdx, prefixIndex)));
        }
        int afterPrefixIndex = prefixIndex + prefix.length();
        int suffixIndex = skipToCorrectEndSuffix(prefix,suffix,expressionString,afterPrefixIndex);
        if (suffixIndex == -1) {
          throw new ParseException(expressionString, prefixIndex, "No ending suffix '" + suffix +
              "' for expression starting at character " + prefixIndex + ": " +
              expressionString.substring(prefixIndex));
        }
        if (suffixIndex == afterPrefixIndex) {
          throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
              prefix + suffix + "' at character " + prefixIndex);
        } else {
          String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
          expr = expr.trim();
          if (expr.length()==0) {
            throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
                prefix + suffix + "' at character " + prefixIndex);
          }
          expressions.add(doParseExpression(expr, context));
          startIdx = suffixIndex + suffix.length();
        }
View Full Code Here


      case '{': case '[': case '(':
        stack.push(new Bracket(ch,pos));
        break;
      case '}':case ']':case ')':
        if (stack.isEmpty()) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" without an opening '"+Bracket.theOpenBracketFor(ch)+"'");
        }
        Bracket p = stack.pop();
        if (!p.compatibleWithCloseBracket(ch)) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" but most recent opening is '"+p.bracket+"' at position "+p.pos);
        }
        break;
      case '\'':
      case '"':
        // jump to the end of the literal
        int endLiteral = expressionString.indexOf(ch,pos+1);
        if (endLiteral==-1) {
          throw new ParseException(expressionString, pos, "Found non terminating string literal starting at position "+pos);
        }
        pos=endLiteral;
        break;
      }
      pos++;
    }
    if (!stack.isEmpty()) {
      Bracket p = stack.pop();
      throw new ParseException(expressionString, p.pos, "Missing closing '"+Bracket.theCloseBracketFor(p.bracket)+"' for '"+p.bracket+"' at position "+p.pos);
    }
    if (!isSuffixHere(expressionString, pos, suffix)) {
      return -1;
    }
    return pos;
View Full Code Here

          expressions.add(createLiteralExpression(context,expressionString.substring(startIdx, prefixIndex)));
        }
        int afterPrefixIndex = prefixIndex + prefix.length();
        int suffixIndex = skipToCorrectEndSuffix(prefix,suffix,expressionString,afterPrefixIndex);
        if (suffixIndex == -1) {
          throw new ParseException(expressionString, prefixIndex, "No ending suffix '" + suffix +
              "' for expression starting at character " + prefixIndex + ": " +
              expressionString.substring(prefixIndex));
        }
        if (suffixIndex == afterPrefixIndex) {
          throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
              prefix + suffix + "' at character " + prefixIndex);
        } else {
          String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
          expr = expr.trim();
          if (expr.length()==0) {
            throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
                prefix + suffix + "' at character " + prefixIndex);
          }
          expressions.add(doParseExpression(expr, context));
          startIdx = suffixIndex + suffix.length();
        }
View Full Code Here

      case '{': case '[': case '(':
        stack.push(new Bracket(ch,pos));
        break;
      case '}':case ']':case ')':
        if (stack.isEmpty()) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" without an opening '"+Bracket.theOpenBracketFor(ch)+"'");
        }
        Bracket p = stack.pop();
        if (!p.compatibleWithCloseBracket(ch)) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" but most recent opening is '"+p.bracket+"' at position "+p.pos);
        }
        break;
      case '\'':
      case '"':
        // jump to the end of the literal
        int endLiteral = expressionString.indexOf(ch,pos+1);
        if (endLiteral==-1) {
          throw new ParseException(expressionString, pos, "Found non terminating string literal starting at position "+pos);
        }
        pos=endLiteral;
        break;
      }
      pos++;
    }
    if (!stack.isEmpty()) {
      Bracket p = stack.pop();
      throw new ParseException(expressionString, p.pos, "Missing closing '"+Bracket.theCloseBracketFor(p.bracket)+"' for '"+p.bracket+"' at position "+p.pos);
    }
    if (!isSuffixHere(expressionString, pos, suffix)) {
      return -1;
    }
    return pos;
View Full Code Here

          expressions.add(createLiteralExpression(context,expressionString.substring(startIdx, prefixIndex)));
        }
        int afterPrefixIndex = prefixIndex + prefix.length();
        int suffixIndex = skipToCorrectEndSuffix(prefix,suffix,expressionString,afterPrefixIndex);
        if (suffixIndex == -1) {
          throw new ParseException(expressionString, prefixIndex, "No ending suffix '" + suffix +
              "' for expression starting at character " + prefixIndex + ": " +
              expressionString.substring(prefixIndex));
        }
        if (suffixIndex == afterPrefixIndex) {
          throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
              prefix + suffix + "' at character " + prefixIndex);
        } else {
          String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
          expr = expr.trim();
          if (expr.length()==0) {
            throw new ParseException(expressionString, prefixIndex, "No expression defined within delimiter '" +
                prefix + suffix + "' at character " + prefixIndex);
          }
          expressions.add(doParseExpression(expr, context));
          startIdx = suffixIndex + suffix.length();
        }
View Full Code Here

      case '{': case '[': case '(':
        stack.push(new Bracket(ch,pos));
        break;
      case '}':case ']':case ')':
        if (stack.isEmpty()) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" without an opening '"+Bracket.theOpenBracketFor(ch)+"'");
        }
        Bracket p = stack.pop();
        if (!p.compatibleWithCloseBracket(ch)) {
          throw new ParseException(expressionString, pos, "Found closing '"+ch+"' at position "+pos+" but most recent opening is '"+p.bracket+"' at position "+p.pos);
        }
        break;
      case '\'':
      case '"':
        // jump to the end of the literal
        int endLiteral = expressionString.indexOf(ch,pos+1);
        if (endLiteral==-1) {
          throw new ParseException(expressionString, pos, "Found non terminating string literal starting at position "+pos);
        }
        pos=endLiteral;
        break;       
      }
      pos++;
    }
    if (!stack.isEmpty()) {
      Bracket p = stack.pop();
      throw new ParseException(expressionString, p.pos, "Missing closing '"+Bracket.theCloseBracketFor(p.bracket)+"' for '"+p.bracket+"' at position "+p.pos);
    }
    if (!isSuffixHere(expressionString, pos, suffix)) {
      return -1;
    }
    return pos;   
View Full Code Here

        int afterPrefixIndex = prefixIndex + prefix.length();
        int suffixIndex = skipToCorrectEndSuffix(prefix, suffix,
            expressionString, afterPrefixIndex);

        if (suffixIndex == -1) {
          throw new ParseException(expressionString, prefixIndex,
              "No ending suffix '" + suffix
                  + "' for expression starting at character "
                  + prefixIndex + ": "
                  + expressionString.substring(prefixIndex));
        }

        if (suffixIndex == afterPrefixIndex) {
          throw new ParseException(expressionString, prefixIndex,
              "No expression defined within delimiter '" + prefix + suffix
                  + "' at character " + prefixIndex);
        }

        String expr = expressionString.substring(prefixIndex + prefix.length(),
            suffixIndex);
        expr = expr.trim();

        if (expr.length() == 0) {
          throw new ParseException(expressionString, prefixIndex,
              "No expression defined within delimiter '" + prefix + suffix
                  + "' at character " + prefixIndex);
        }

        expressions.add(doParseExpression(expr, context));
View Full Code Here

          break;
        case '}':
        case ']':
        case ')':
          if (stack.isEmpty()) {
            throw new ParseException(expressionString, pos, "Found closing '"
                + ch + "' at position " + pos + " without an opening '"
                + Bracket.theOpenBracketFor(ch) + "'");
          }
          Bracket p = stack.pop();
          if (!p.compatibleWithCloseBracket(ch)) {
            throw new ParseException(expressionString, pos, "Found closing '"
                + ch + "' at position " + pos
                + " but most recent opening is '" + p.bracket
                + "' at position " + p.pos);
          }
          break;
        case '\'':
        case '"':
          // jump to the end of the literal
          int endLiteral = expressionString.indexOf(ch, pos + 1);
          if (endLiteral == -1) {
            throw new ParseException(expressionString, pos,
                "Found non terminating string literal starting at position "
                    + pos);
          }
          pos = endLiteral;
          break;
      }
      pos++;
    }
    if (!stack.isEmpty()) {
      Bracket p = stack.pop();
      throw new ParseException(expressionString, p.pos, "Missing closing '"
          + Bracket.theCloseBracketFor(p.bracket) + "' for '" + p.bracket
          + "' at position " + p.pos);
    }
    if (!isSuffixHere(expressionString, pos, suffix)) {
      return -1;
View Full Code Here

TOP

Related Classes of org.springframework.expression.ParseException

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.