You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pavel Melnikov (JIRA)" <ji...@apache.org> on 2019/03/05 07:02:00 UTC
[jira] [Updated] (GROOVY-9014) printf does not respect "out"
property
[ https://issues.apache.org/jira/browse/GROOVY-9014?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Melnikov updated GROOVY-9014:
-----------------------------------
Attachment: test.groovy
> printf does not respect "out" property
> --------------------------------------
>
> Key: GROOVY-9014
> URL: https://issues.apache.org/jira/browse/GROOVY-9014
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Environment: Ubuntu 18.04.1,
> Reporter: Pavel Melnikov
> Priority: Major
> Attachments: test.groovy
>
>
> I am using groovy to run dynamic scripts from my Java application. I use JSR223 for this. I am overriding "out" property to redirect script stdout to my own consumer. However, I've noticed that *printf* inside closures does not respect that property (it always prints to stdout) while *println* perfectly complies (and prints to whatever specified).
>
> I beleive this is because of the differences in printf and println in DefaultGroovyMethods.java: in [https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L849]
> println uses closure owner while printf does simple System.out.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)