Grails
  1. Grails
  2. GRAILS-7360

404 and other error code handling sensitive to whitespace in UrlMappings.groovy

    Details

      Description

      Placing whitespace between "404" and the mapping in UrlMappings.groovy causes grails to silently ignore the mappings. When deployed with tomcat, the default tomcat 404 page will appear.

      Example:

      class UrlMappings {
          static mappings = {
              "404" (controller: "error", action: "notFound") // FAILS
              "404"(controller: "error", action: "notFound") // WORKS
          }
      }
      

      Also related, it will fail if 404 is quoted with single quotes, too.

      The reason it's failing in that an error-page tag is never inserted into the generated web.xml. It looks like grails is using a regexp to match mappings in org.codehaus.groovy.grails.plugins.web.mapping.UrlMappingsGrailsPlugin that doesn't handle these cases.

        Activity

        Hide
        Craig Andrews added a comment -
        Show
        Craig Andrews added a comment - This was fixed in Grails 2.0, see https://github.com/grails/grails-core/commit/8f7c318c5c5e06c7b17c87babb26f54cb1f6f77b
        Hide
        Graeme Rocher added a comment -

        Thanks for verifying

        Show
        Graeme Rocher added a comment - Thanks for verifying

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Taylor
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development