org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int

Spring JIRA | Sven Smets | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When I use this tag {noformat} <form:input path="myMap[${entry.key}]..." /> Map<Long, MyViewModel> myMap;{noformat} and entry.key is bigger then an int (ex. 5,000,000,000), I get following error {noformat} org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int at org.springframework.expression.spel.ast.Literal.getIntLiteral(Literal.java:79) at org.springframework.expression.spel.standard.InternalSpelExpressionParser.maybeEatLiteral(InternalSpelExpressionParser.java:688)...{noformat} In the maybeEatLiteral method it seems that Long should be supported, but int is chosen. {noformat} private boolean maybeEatLiteral() { Token t = peekToken(); if (t == null) { return false; } if (t.kind == TokenKind.LITERAL_INT) push(Literal.getIntLiteral(t.data, toPos(t), 10)); else if (t.kind == TokenKind.LITERAL_LONG) push(Literal.getLongLiteral(t.data, toPos(t), 10)); else if (t.kind == TokenKind.LITERAL_HEXINT) push(Literal.getIntLiteral(t.data, toPos(t), 16)); else if (t.kind == TokenKind.LITERAL_HEXLONG) push(Literal.getLongLiteral(t.data, toPos(t), 16)); else if (t.kind == TokenKind.LITERAL_REAL) push(Literal.getRealLiteral(t.data, toPos(t), false)); else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) push(Literal.getRealLiteral(t.data, toPos(t), true)); else if (peekIdentifierToken("true")) push(new BooleanLiteral(t.data, toPos(t), true)); else if (peekIdentifierToken("false")) push(new BooleanLiteral(t.data, toPos(t), false)); else if (t.kind == TokenKind.LITERAL_STRING) push(new StringLiteral(t.data, toPos(t), t.data)); else { return false; } nextToken(); return true; } {noformat} When I add an L to make it a java Long -> 5000000000L {noformat} <form:input path="myMap[${entry.key}L]..." />{noformat} I got an other error: {noformat} java.lang.IllegalArgumentException: The field type is required at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.webflow.mvc.view.ConvertingPropertyEditorAdapter.<init>(ConvertingPropertyEditorAdapter.java:48) at org.springframework.webflow.mvc.view.BindingModel.findSpringConvertingPropertyEditor(BindingModel.java:277) at org.springframework.webflow.mvc.view.BindingModel.findEditor(BindingModel.java:183) at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:125) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)... {noformat}

    Spring JIRA | 3 years ago | Sven Smets
    org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int
  2. 0

    When I use this tag {noformat} <form:input path="myMap[${entry.key}]..." /> Map<Long, MyViewModel> myMap;{noformat} and entry.key is bigger then an int (ex. 5,000,000,000), I get following error {noformat} org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int at org.springframework.expression.spel.ast.Literal.getIntLiteral(Literal.java:79) at org.springframework.expression.spel.standard.InternalSpelExpressionParser.maybeEatLiteral(InternalSpelExpressionParser.java:688)...{noformat} In the maybeEatLiteral method it seems that Long should be supported, but int is chosen. {noformat} private boolean maybeEatLiteral() { Token t = peekToken(); if (t == null) { return false; } if (t.kind == TokenKind.LITERAL_INT) push(Literal.getIntLiteral(t.data, toPos(t), 10)); else if (t.kind == TokenKind.LITERAL_LONG) push(Literal.getLongLiteral(t.data, toPos(t), 10)); else if (t.kind == TokenKind.LITERAL_HEXINT) push(Literal.getIntLiteral(t.data, toPos(t), 16)); else if (t.kind == TokenKind.LITERAL_HEXLONG) push(Literal.getLongLiteral(t.data, toPos(t), 16)); else if (t.kind == TokenKind.LITERAL_REAL) push(Literal.getRealLiteral(t.data, toPos(t), false)); else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) push(Literal.getRealLiteral(t.data, toPos(t), true)); else if (peekIdentifierToken("true")) push(new BooleanLiteral(t.data, toPos(t), true)); else if (peekIdentifierToken("false")) push(new BooleanLiteral(t.data, toPos(t), false)); else if (t.kind == TokenKind.LITERAL_STRING) push(new StringLiteral(t.data, toPos(t), t.data)); else { return false; } nextToken(); return true; } {noformat} When I add an L to make it a java Long -> 5000000000L {noformat} <form:input path="myMap[${entry.key}L]..." />{noformat} I got an other error: {noformat} java.lang.IllegalArgumentException: The field type is required at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.webflow.mvc.view.ConvertingPropertyEditorAdapter.<init>(ConvertingPropertyEditorAdapter.java:48) at org.springframework.webflow.mvc.view.BindingModel.findSpringConvertingPropertyEditor(BindingModel.java:277) at org.springframework.webflow.mvc.view.BindingModel.findEditor(BindingModel.java:183) at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:125) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)... {noformat}

    Spring JIRA | 3 years ago | Sven Smets
    org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int

    Root Cause Analysis

    1. org.springframework.expression.spel.SpelParseException

      EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int

      at org.springframework.expression.spel.ast.Literal.getIntLiteral()
    2. Spring Expression Language (SpEL)
      Literal.getIntLiteral
      1. org.springframework.expression.spel.ast.Literal.getIntLiteral(Literal.java:79)
      1 frame