Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1492

Grails' controller methods are not shown as entered

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 4.0.2
    • 3.3.0
    • Grails Plugin
    • None

      Hello,
      For some reason the method in a controller is marked as not entered even though the content inside is shown to be executed. Please can you help me rationalize/ understand this?

      Please refer to me screenshots:
      index_method_not_executed.png: to see that the index() method is not executed even though its contents are.
      test_for_index_method.png: the test that is run to get the method to run.

        1. cloverController-bug-report-28092014.zip
          25 kB
        2. DashboardController.groovy
          0.9 kB
        3. DashboardControllerTests.groovy
          0.8 kB
        4. index_method_not_executed.PNG
          index_method_not_executed.PNG
          31 kB
        5. test_for_index_method.PNG
          test_for_index_method.PNG
          5 kB

            [CLOV-1492] Grails' controller methods are not shown as entered

            as workaround (if it's really necessary) you can change the access modifier to protected (or private...).

            this issue only happens with public and default.

            Francesco Durbin added a comment - as workaround (if it's really necessary) you can change the access modifier to protected (or private...). this issue only happens with public and default.

            A bug was caused by a fact how AST looks like for controller classes - MethodNode.getCode() has TryCatchStatement instead of a BlockStatement (as for normal methods). I've added handling of this special case in Clover.

            Marek Parfianowicz added a comment - A bug was caused by a fact how AST looks like for controller classes - MethodNode.getCode() has TryCatchStatement instead of a BlockStatement (as for normal methods). I've added handling of this special case in Clover.

            Sam Farmer added a comment -

            Ok. Thanks for the quick response.

            Sam Farmer added a comment - Ok. Thanks for the quick response.

            I don't know any workaround right now.

            Marek Parfianowicz added a comment - I don't know any workaround right now.

            Sam Farmer added a comment -

            Thanks Marek!

            Are there any workarounds?

            Sam Farmer added a comment - Thanks Marek! Are there any workarounds?

            Thanks a lot for a code sample, Sam. I plan to release Clover 4.1 in first quarter of 2015.

            However, due to a fact that I'm working on some Groovy/Grails bugs in an incoming release (4.0.2) I will add this issue to a backlog. In case I find enough time for it, I'll try to make a fix for this bug sooner.

            Marek Parfianowicz added a comment - Thanks a lot for a code sample, Sam. I plan to release Clover 4.1 in first quarter of 2015. However, due to a fact that I'm working on some Groovy/Grails bugs in an incoming release (4.0.2) I will add this issue to a backlog. In case I find enough time for it, I'll try to make a fix for this bug sooner.

            Sam Farmer added a comment -

            And to answer Marek's questions:

            what grails version did you use?
            2.3.11

            did you find this bug only in one controller class or in many of them? always for index() method?
            Every controller. Every method.

            did you perform a build from a clean workspace?
            Yes.

            could you attach code sample?
            Yup. Attached.

            Sam Farmer added a comment - And to answer Marek's questions: what grails version did you use? 2.3.11 did you find this bug only in one controller class or in many of them? always for index() method? Every controller. Every method. did you perform a build from a clean workspace? Yes. could you attach code sample? Yup. Attached.

            Sam Farmer added a comment -

            Hitting same bug on Grails 2.3.11 and its throwing off our code coverage numbers. Can provide sample app with this code if desired.

            Looks like will be fixed in 4.1.

            Any workarounds until then?

            When is 4.1 slotted for?

            Sam Farmer added a comment - Hitting same bug on Grails 2.3.11 and its throwing off our code coverage numbers. Can provide sample app with this code if desired. Looks like will be fixed in 4.1. Any workarounds until then? When is 4.1 slotted for?

            cartman12 added a comment -

            Grails version: 2.3.5
            This was observed in different controllers: in all cases the method name did not have a argument to it. it was observed that if the method name had a argument it was marked correctly.
            The build was performed on a clean workspace
            The test and the grails code is attached.

            cartman12 added a comment - Grails version: 2.3.5 This was observed in different controllers: in all cases the method name did not have a argument to it. it was observed that if the method name had a argument it was marked correctly. The build was performed on a clean workspace The test and the grails code is attached.

            Thank you for reporting this bug. Indeed, it should render a method as marked.

            • what grails version did you use?
            • did you find this bug only in one controller class or in many of them? always for index() method?
            • did you perform a build from a clean workspace?
            • could you attach code sample?

            I'm assigning this bug to the release 4.0.0 backlog.

            Marek Parfianowicz added a comment - Thank you for reporting this bug. Indeed, it should render a method as marked. what grails version did you use? did you find this bug only in one controller class or in many of them? always for index() method? did you perform a build from a clean workspace? could you attach code sample? I'm assigning this bug to the release 4.0.0 backlog.

              mparfianowicz Marek Parfianowicz
              f67dcf827f0e cartman12
              Affected customers:
              2 This affects my team
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: