Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1039

Using {} in RegExp pattern causes IllegalArgumentException: unknown format type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M2
    • Fix Version/s: 1.1.0.M2
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      Exception is thrown if a validation error is detected.

      Example pattern (taken from ROO-639):
      @Pattern(regexp="\\b[A-Za-z0-9._%+-]@[A-Za-z0-9.-]
      .[a-zAZ]

      {2,4}
      b")


      Roo Script to reproduce the fault (thanks to Ben):
      // Spring Roo 1.1.0.M2 [rev 41636cd] log opened at 2010-06-28 12:07:21
      project --topLevelPackage ar.com.sample --projectName sample --java 6
      persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT --databaseName sampleDB --userName sa
      logging setup --level INFO
      entity --class ~domain.Person --testAutomatically
      field string --class ~.domain.Person --fieldName email --regexp \b[A-Za-z0-9._%-]@[A-Za-z0-9.-]\.[A-Za-z]{2,4}

      \b
      controller all --package ~.web
      q
      // Spring Roo 1.1.0.M2 [rev 41636cd] log closed at 2010-06-28 12:07:34

      Error logged on validation error (e.g. if not email address is entered):

      ERROR org.springframework.web.servlet.tags.form.ErrorsTag - unknown format type at
      java.lang.IllegalArgumentException: unknown format type at
      at java.text.MessageFormat.makeFormat(MessageFormat.java:1442)
      at java.text.MessageFormat.applyPattern(MessageFormat.java:458)
      at java.text.MessageFormat.<init>(MessageFormat.java:368)
      at org.springframework.context.support.MessageSourceSupport.createMessageFormat(MessageSourceSupport.java:115)
      at org.springframework.context.support.MessageSourceSupport.formatMessage(MessageSourceSupport.java:99)
      at org.springframework.context.support.AbstractMessageSource.renderDefaultMessage(AbstractMessageSource.java:275)
      at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:152)
      at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:1166)
      at org.springframework.web.servlet.support.RequestContext.getMessage(RequestContext.java:559)
      at org.springframework.web.servlet.support.BindStatus.initErrorMessages(BindStatus.java:177)
      at org.springframework.web.servlet.support.BindStatus.getErrorMessages(BindStatus.java:273)
      at org.springframework.web.servlet.tags.form.ErrorsTag.exposeAttributes(ErrorsTag.java:173)
      at org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag.writeTagContent(AbstractHtmlElementBodyTag.java:48)
      at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
      at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
      at org.apache.jsp.tag.web.form.fields.input_tagx.doTag(input_tagx.java:330)
      at org.apache.jsp.WEB_002dINF.views.people.create_jspx._jspx_meth_field_005finput_005f0(create_jspx.java:129)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sschmidt Stefan Schmidt
              Reporter:
              robertoschwald Robert Oschwald
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: