https://bz.apache.org/bugzilla/show_bug.cgi?id=65381

--- Comment #6 from Jaikiran Pai <[email protected]> ---
Hello Stefan,

Thank you for reporting this issue. We have been aware of this change that the
upcoming JDK 17 release is proposing and have noticed this WARNING message
which impacts the STDERR stream content of an application. One of our internal
test case in the Ant project when run against this EA version, runs into this
same issue that you describe here.

This has been brought to the notice of the JDK dev team not just by us but by
all other impacted projects. Most of those discussions can be viewed in the JDK
security-dev mailing list discussions
https://mail.openjdk.java.net/pipermail/security-dev/2021-June/thread.html.
>From my understanding this WARNING message is here to stay, so we (the Ant
project) will have to check our usage of SecurityManager internally in the
project and come up with a plan on how we deal with it in future (note that JDK
17 only deprecates the SecurityManager for future removal and except for the
WARNING message in the STDERR nothing else changes in JDK 17, functionality
wise).

Now coming to the example you posted, if the output of your program on STDOUT
is being impacted (which is what that example is demonstrating) then it's a
simple fix that needs to be done to your build file. Right now, your build file
looks like:

<java classname="Demo" outputproperty="output" classpath="."/>

As per the documentation of this task[1], the outputproperty documentation
reads:

>> The name of a property in which the output of the command should be stored. 
>> Unless the error stream is redirected to a separate file or stream, this 
>> property will include the error output.

So in its current form the "output" property value will include even contents
from STDERR (which is where that WARNING message is being logged). To fix this
and just get back your output from STDOUT of the program, you can either set an
additional "errorproperty" attribute or set the "discardError" attribute (which
is introduced in recently released 1.10.10 version of Ant) to "true". Once you
do that, your "bad" target should start seeing only the value "42" in the
output property value, just like you see in the "good" target.



[1] https://ant.apache.org/manual/Tasks/java.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to