You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2016/01/16 13:33:39 UTC
[jira] [Resolved] (GROOVY-7378) Spaces in JAVA_OPTS env var
prevent launching of groovy
[ https://issues.apache.org/jira/browse/GROOVY-7378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-7378.
---------------------------------------
Resolution: Fixed
Assignee: Pascal Schumacher
Fix Version/s: 2.4.6
Pull request merged. Thanks!
> Spaces in JAVA_OPTS env var prevent launching of groovy
> --------------------------------------------------------
>
> Key: GROOVY-7378
> URL: https://issues.apache.org/jira/browse/GROOVY-7378
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.3
> Environment: Linux
> Reporter: Jeffrey Adamson
> Assignee: Pascal Schumacher
> Fix For: 2.4.6
>
> Attachments: startGroovy.patch
>
>
> Set environment variable JAVA_OPTS to have a system property including spaces/quotes/double-quotes.
> $ export JAVA_OPTS="-Dfoo='bar\" baz\"'"
> $ groovy -e 'println System.getProperty("foo"); println args' 'arg space' "space quote' " "\""
> Expected output would be:
> 'bar" baz"'
> [arg space, space quote' , "]
> Actual output is:
> Error: Could not find or load main class baz"'
> I can not comment on proper way to fix startGroovy.bat (assuming it suffers similarly), but included is diff that fixes startGroovy unix script to handle JAVA_OPTS such that quoted arguments are preserved as expected.
> I modeled the attached change which seems to resolve the issue for *nix on the tomcat `catalina.sh run` script block.
> p.s. A concrete use case that bit me was trying to pass java.io.tmpdir to a groovy script to a path that included a space. There are outside reasons that modifying the script to read the desired value and set the system property is not a practical solution.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)