java.lang.IllegalArgumentException: The field type is required

Spring JIRA | Sven Smets | 3 years ago
  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
    java.lang.IllegalArgumentException: The field type is required
  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
    java.lang.IllegalArgumentException: The field type is required
  3. 0

    Given this code: public class Survey { private Map<Question, Response> responses = new HashMap<Question,Response>(); ... } public class QuestionConverter implements Converter<Integer, Question> { ... } <form:input path="responses[1].value" /> During rendering, the expression "responses[1].value" is processed correctly by Spring EL, which converts the integer 1 to a Question, then does a look up in the responses map, and then converts the "value" field to a String. At this point this should be all that is needed. However, the following exception occurs: 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:273) 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:174) Spring MVC's BindStatus tries to find a PropertyEditor but the above expression cannot be processed by the BeanWrapperImpl because it fails to recognize that 1 needs to be converted to a Question. It would be safe if we didn't create a ProperytEditor when the BeanWrapperImpl fails as Spring EL has already formatted the value correctly.

    Spring JIRA | 6 years ago | Rossen Stoyanchev
    java.lang.IllegalArgumentException: The field type is required
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Given this code: public class Survey { private Map<Question, Response> responses = new HashMap<Question,Response>(); ... } public class QuestionConverter implements Converter<Integer, Question> { ... } <form:input path="responses[1].value" /> During rendering, the expression "responses[1].value" is processed correctly by Spring EL, which converts the integer 1 to a Question, then does a look up in the responses map, and then converts the "value" field to a String. At this point this should be all that is needed. However, the following exception occurs: 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:273) 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:174) Spring MVC's BindStatus tries to find a PropertyEditor but the above expression cannot be processed by the BeanWrapperImpl because it fails to recognize that 1 needs to be converted to a Question. It would be safe if we didn't create a ProperytEditor when the BeanWrapperImpl fails as Spring EL has already formatted the value correctly.

    Spring JIRA | 6 years ago | Rossen Stoyanchev
    java.lang.IllegalArgumentException: The field type is required
  6. 0

    Hashmap in Spring form

    Stack Overflow | 3 years ago | user1128017
    java.lang.IllegalArgumentException: The field type is required

  1. batwalrus76 4 times, last 2 weeks ago
  2. serious2monkeys 1 times, last 2 weeks ago
  3. tvrmsmith 1 times, last 4 weeks ago
  4. fima 1 times, last 2 months ago
  5. dafman 2 times, last 2 months ago
8 more registered users
87 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    The field type is required

    at org.springframework.util.Assert.notNull()
  2. Spring Core
    Assert.notNull
    1. org.springframework.util.Assert.notNull(Assert.java:112)
    1 frame
  3. Spring Web Flow
    BindingModel.findEditor
    1. org.springframework.webflow.mvc.view.ConvertingPropertyEditorAdapter.<init>(ConvertingPropertyEditorAdapter.java:48)
    2. org.springframework.webflow.mvc.view.BindingModel.findSpringConvertingPropertyEditor(BindingModel.java:277)
    3. org.springframework.webflow.mvc.view.BindingModel.findEditor(BindingModel.java:183)
    3 frames
  4. Spring MVC
    AbstractDataBoundFormElementTag.getBindStatus
    1. org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:125)
    2. org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
    2 frames