You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/07 17:24:12 UTC

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

    [ https://issues.apache.org/jira/browse/GROOVY-7697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275316#comment-15275316 ] 

ASF GitHub Bot commented on GROOVY-7697:
----------------------------------------

GitHub user andresteingress opened a pull request:

    https://github.com/apache/groovy/pull/330

    GROOVY-7697: GroovyScriptEngine.loadScriptByName doesn't support envi…

    …ronment variable "groovy.ast"
    
    This PR fixes an issue where the "groovy.ast" dump (only god, its author and the ticket author knew this existed) would not be saved when a script was loaded by name via the GSE. In that case, the `XStreamUtils` instance was given an URI (String) instead of an absolute path and the code there broke.
    
    Regarding error handling in `XStreamUtils` (as this was also mentioned in the ticket): I did not change anything into that direction as I am not convinced that such a secondary "add-on" feature should in any way influence behaviour in `SourceUnit#convert`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/andresteingress/groovy GROOVY-7697

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/330.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #330
    
----
commit 70fee35eef16dd68128410a5f51e1ed94742b47a
Author: Andre Steingress <me...@andresteingress.com>
Date:   2016-05-07T16:58:39Z

    GROOVY-7697: GroovyScriptEngine.loadScriptByName doesn't support environment variable "groovy.ast"

----


> 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)