You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Marc Ewert (JIRA)" <ji...@apache.org> on 2015/12/01 15:36:11 UTC

[jira] [Created] (GROOVY-7697) GroovyScriptEngine.loadScriptByName doesn't support environment variable "groovy.ast"

Marc Ewert created GROOVY-7697:
----------------------------------

             Summary: GroovyScriptEngine.loadScriptByName doesn't support environment variable "groovy.ast"
                 Key: GROOVY-7697
                 URL: https://issues.apache.org/jira/browse/GROOVY-7697
             Project: Groovy
          Issue Type: Bug
            Reporter: Marc Ewert


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:

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

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)