Grails
  1. Grails
  2. GRAILS-8309

Calling the same custom tag with different parameters number causes exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: 2.0-RC2
    • Component/s: TagLib
    • Labels:
      None

      Description

      I'm not sure if this is a bug or some kind of restriction, but I haven't found any details in release notes and it worked in 1.3.7, so...

      Let's consider the following custom tag lib:

      class CustomTagLib {
      	static namespace = "c"
      
      	def linkTo = { attrs ->
      		def mapping = attrs.mapping ?: "test"
      		out << mapping
      	}
      
      }
      

      Then the following use case (in .gsp):

      ${c.linkTo(mapping: 'root')}
      ${c.linkTo()}
      

      The effect is:

         Line | Method
      ->>  26 | doFilter in DevModeSanityFilter.groovy
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
      |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
      |   908 | run . .  in     ''
      ^   680 | run      in java.lang.Thread
      
      Caused by GroovyPagesException: Error evaluating expression [c.linkTo()] on line [106]: wrong number of arguments
      ->> 106 | doCall   in /grails-app/views/index.gsp
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
      
      Caused by IllegalArgumentException: wrong number of arguments
      ->>  55 | doCall   in Users_marcin_Grails_projects_Grails8064Issue_grails_app_views_index_gsp$_run_closure2_closure20
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
      |    67 | run      in Users_marcin_Grails_projects_Grails8064Issue_grails_app_views_index_gsp
      |    26 | doFilter in DevModeSanityFilter.groovy
      |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
      |   908 | run . .  in     ''
      ^   680 | run      in java.lang.Thread
      

      Switching to the same parameters number fixes the issue. Moreover, it is necessary to restart the app, ie. only modifying the view does not help the situation.

      I attach sample project with the issue.

        Issue Links

          Activity

          Hide
          Jeff Scott Brown added a comment -

          I think this was fixed when GRAILS-8208 was resolved.

          Show
          Jeff Scott Brown added a comment - I think this was fixed when GRAILS-8208 was resolved.

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Marcin Świerczyński
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development