Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2491

Concurrency performance changes break closure method resolution in Grails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.5.2
    • 1.6-beta-1
    • None
    • None

    Description

      In Grails markup building content such as this:

      class HelloController {
        render(contentType:"text/xml") {
              helllo("world")
        }
      }
      

      Is broken with latest Groovy as it throws a MissingMethodException when calling hello(..). It seems that the closure is now being resolved against the controller which throws a MissingMethodException instead of the builder which is called within the render method like so:

                         StreamingMarkupBuilder b = new StreamingMarkupBuilder();
                          Closure callable = (Closure)arguments[arguments.length - 1];
                          Writable markup = (Writable)b.bind(callable);
                          try {
                              markup.writeTo(out);
                          } catch (IOException e) {
                              throw new ControllerExecutionException("I/O error executing render method for arguments ["+argMap+"]: " + e.getMessage(),e);
                          }
      

      The test that is broken in Grails is the testRenderXml test in this test case:

      http://svn.grails.codehaus.org/browse/grails/trunk/grails/test/groovy/org/codehaus/groovy/grails/web/servlet/RenderMethodTests.groovy?r=6320

      Attachments

        Activity

          People

            ait Alex Tkachman
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: