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

Groovy 1.0 beta4 BSF implementation does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-4
    • 1.0-beta-5
    • None
    • None
    • all.

    Description

      Groovy's BSF implementation, specifically the exec() method inturn calls eval() method instead of exec. Due to this scripts consisting of class definations having a main method fails to execute.
      For example try running MapFromList example script in the CVS via BSF and it fails with the following error.

      exception from Groovy: groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class MapFromList. Reason: groovy.lang.MissingPropertyException: No such property: foo for class: MapFromList. Reason: groovy.lang.MissingMethodException: No such method: setFoo for class: MapFromList with arguments: [error] org.apache.bsf.BSFException: exception from Groovy: groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class MapFromList. Reason: groovy.lang.MissingPropertyException: No such property: foo for class: MapFromList. Reason: groovy.lang.MissingMethodException: No such method: setFoo for class: MapFromList with arguments:
      at org.codehaus.groovy.bsf.GroovyEngine.exec(GroovyEngine.java:167)
      at org.apache.bsf.BSFManager$6.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.bsf.BSFManager.exec(Unknown Source)
      .....

      Changing the eval() call in GroovyEngine.exec to exec() resolves this.

      Problem 2. Running scripts like AtomTestScript etc via BSF(Don't know if this problem is also there via GroovyShell or groovysh), I get error

      Could not find matching constructor for class: Feed

      Changing the new Feed() to new groovy.script.Feed() resolves this. Is this the correct behaviour?

      Thanks,
      Jiger

      Attachments

        Activity

          People

            jstrachan James Strachan
            jigerjava Jiger Patel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: