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

GroovyScriptEngine.loadScriptByName doesn't support environment variable "groovy.ast"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.8
    • None
    • None

    Description

      When setting the environment variable "groovy.ast" to "xml" and calling GroovyScriptEngine.loadScriptByName a FileNotFoundException is thrown (which is caught internally), because a FileWriter is created from a String representation of an URI.

      In class SourceUnit method saveAsXML there should be some code added like:

      FileWriter writer;
      if (name.startsWith("file:")) {
        writer = new FileWriter(new File(new URI(name + ".xml")));
      } else {
        writer = new FileWriter(name + ".xml")
      }
      ...
      

      Or however URIs are handled in Groovy. Exception handling still has to be added.

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              m.ewert Marc Ewert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: