Uploaded image for project: 'appNG'
  1. appNG
  2. APPNG-2189

LocalizedMessageInterpolator can not handle a ResourceBundleMessageSource with alwaysUseMessageFormat=true

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.18.0
    • Component/s: appng-api
    • Labels:
      None

      Description

      Example message used in RBMS: Value must be between {min} and {max}

      Validation fails with:

      javax.validation.ValidationException: HV000149: An exception occurred during message interpolation
      	at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:404)
      	at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:294)
      	at org.hibernate.validator.internal.engine.ValidationContext.lambda$createConstraintViolations$0(ValidationContext.java:259)
      	...
      Caused by: java.lang.IllegalArgumentException: can't parse argument number: min
      	at java.text.MessageFormat.makeFormat(MessageFormat.java:1429)
      	at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
      	at java.text.MessageFormat.<init>(MessageFormat.java:380)
      	at org.springframework.context.support.MessageSourceSupport.createMessageFormat(MessageSourceSupport.java:159)
      	at org.springframework.context.support.ResourceBundleMessageSource.getMessageFormat(ResourceBundleMessageSource.java:267)
      	at org.springframework.context.support.ResourceBundleMessageSource.resolveCode(ResourceBundleMessageSource.java:150)
      	at org.springframework.context.support.AbstractMessageSource.getMessageInternal(AbstractMessageSource.java:221)
      	at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:151)
      	at org.appng.api.support.MessageSourceChain.getMessage(MessageSourceChain.java:67)
      	at org.springframework.context.support.MessageSourceResourceBundle.handleGetObject(MessageSourceResourceBundle.java:75)
      	at java.util.ResourceBundle.getObject(ResourceBundle.java:441)
      	at java.util.ResourceBundle.getString(ResourceBundle.java:407)
      	at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.resolveParameter(AbstractMessageInterpolator.java:400)
      	at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolateBundleMessage(AbstractMessageInterpolator.java:374)
      	at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolateMessage(AbstractMessageInterpolator.java:275)
      	at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolate(AbstractMessageInterpolator.java:229)
      	at org.appng.api.support.validation.LocalizedMessageInterpolator.interpolate(LocalizedMessageInterpolator.java:72)
      	at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:395)
      	... 46 more
      Caused by: java.lang.NumberFormatException: For input string: "min"
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Integer.parseInt(Integer.java:580)
      	at java.lang.Integer.parseInt(Integer.java:615)
      	at java.text.MessageFormat.makeFormat(MessageFormat.java:1427)
      	... 63 more
      
      

        Attachments

          Activity

            People

            • Assignee:
              mueller.matthias Matthias Müller
              Reporter:
              mueller.matthias Matthias Müller
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: