Package org.springframework.expression.spel

Examples of org.springframework.expression.spel.SpelParseException


  }

  private void pushHexIntToken(char[] data,boolean isLong, int start, int end) {
    if (data.length==0) {
      if (isLong) {       
        throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_A_LONG,expressionString.substring(start,end+1)));
      } else {
        throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_AN_INTEGER,expressionString.substring(start,end)));
      }
    }
    if (isLong) {
      tokens.add(new Token(TokenKind.LITERAL_HEXLONG, data, start, end));
    } else {
View Full Code Here


      tokenStreamLength = tokenStream.size();
      tokenStreamPointer = 0;
      constructedNodes.clear();
      SpelNodeImpl ast = eatExpression();
      if (moreTokens()) {
        throw new SpelParseException(peekToken().startpos,SpelMessage.MORE_INPUT,toString(nextToken()));
      }
      Assert.isTrue(constructedNodes.isEmpty());
      return new SpelExpression(expressionString, ast, configuration)
    }
    catch (InternalParseException ipe) {
View Full Code Here

    return args.toArray(new SpelNodeImpl[args.size()]);
  }
 
  private void eatConstructorArgs(List<SpelNodeImpl> accumulatedArguments) {
    if (!peekToken(TokenKind.LPAREN)) {
      throw new InternalParseException(new SpelParseException(expressionString,positionOf(peekToken()),SpelMessage.MISSING_CONSTRUCTOR_ARGS));
    }
    consumeArguments(accumulatedArguments);
    eatToken(TokenKind.RPAREN);
  }
View Full Code Here

    }
    return tokenStream.get(tokenStreamPointer);
  }

  private void raiseInternalException(int pos, SpelMessage message,Object... inserts) {
    throw new InternalParseException(new SpelParseException(expressionString,pos,message,inserts));   
  }
View Full Code Here

    try {
      int value = Integer.parseInt(numberToken, radix);
      return new IntLiteral(numberToken, pos, value);
    }
    catch (NumberFormatException ex) {
      throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
    }
  }
View Full Code Here

    try {
      long value = Long.parseLong(numberToken, radix);
      return new LongLiteral(numberToken, pos, value);
    }
    catch (NumberFormatException ex) {
      throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_A_LONG, numberToken));
    }
  }
View Full Code Here

        double value = Double.parseDouble(numberToken);
        return new RealLiteral(numberToken, pos, value);
      }
    }
    catch (NumberFormatException ex) {
      throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_A_REAL, numberToken));
    }
  }
View Full Code Here

              pushCharToken(TokenKind.ASSIGN);
            }
            break;
          case '&':
            if (!isTwoCharToken(TokenKind.SYMBOLIC_AND)) {
              throw new InternalParseException(new SpelParseException(
                  this.expressionString, this.pos, SpelMessage.MISSING_CHARACTER,
                  "&"));
            }
            pushPairToken(TokenKind.SYMBOLIC_AND);
            break;
          case '|':
            if (!isTwoCharToken(TokenKind.SYMBOLIC_OR)) {
              throw new InternalParseException(new SpelParseException(
                  this.expressionString, this.pos, SpelMessage.MISSING_CHARACTER,
                  "|"));
            }
            pushPairToken(TokenKind.SYMBOLIC_OR);
            break;
          case '?':
            if (isTwoCharToken(TokenKind.SELECT)) {
              pushPairToken(TokenKind.SELECT);
            }
            else if (isTwoCharToken(TokenKind.ELVIS)) {
              pushPairToken(TokenKind.ELVIS);
            }
            else if (isTwoCharToken(TokenKind.SAFE_NAVI)) {
              pushPairToken(TokenKind.SAFE_NAVI);
            }
            else {
              pushCharToken(TokenKind.QMARK);
            }
            break;
          case '$':
            if (isTwoCharToken(TokenKind.SELECT_LAST)) {
              pushPairToken(TokenKind.SELECT_LAST);
            }
            else {
              lexIdentifier();
            }
            break;
          case '>':
            if (isTwoCharToken(TokenKind.GE)) {
              pushPairToken(TokenKind.GE);
            }
            else {
              pushCharToken(TokenKind.GT);
            }
            break;
          case '<':
            if (isTwoCharToken(TokenKind.LE)) {
              pushPairToken(TokenKind.LE);
            }
            else {
              pushCharToken(TokenKind.LT);
            }
            break;
          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            lexNumericLiteral(ch == '0');
            break;
          case ' ':
          case '\t':
          case '\r':
          case '\n':
            // drift over white space
            this.pos++;
            break;
          case '\'':
            lexQuotedStringLiteral();
            break;
          case '"':
            lexDoubleQuotedStringLiteral();
            break;
          case 0:
            // hit sentinel at end of value
            this.pos++; // will take us to the end
            break;
          case '\\':
            throw new InternalParseException(
                new SpelParseException(this.expressionString, this.pos, SpelMessage.UNEXPECTED_ESCAPE_CHAR));
          default:
            throw new IllegalStateException("Cannot handle (" + Integer.valueOf(ch) + ") '" + ch + "'");
        }
      }
    }
View Full Code Here

        else {
          terminated = true;
        }
      }
      if (ch == 0) {
        throw new InternalParseException(new SpelParseException(this.expressionString, start,
            SpelMessage.NON_TERMINATING_QUOTED_STRING));
      }
    }
    this.pos++;
    this.tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start, this.pos), start, this.pos));
View Full Code Here

        else {
          terminated = true;
        }
      }
      if (ch == 0) {
        throw new InternalParseException(new SpelParseException(this.expressionString,
            start, SpelMessage.NON_TERMINATING_DOUBLE_QUOTED_STRING));
      }
    }
    this.pos++;
    this.tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start, this.pos), start, this.pos));
View Full Code Here

TOP

Related Classes of org.springframework.expression.spel.SpelParseException

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.