You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2021/11/28 14:36:37 UTC

[ant] 02/02: launch Ant project tests by passing java.security.manager=allow on Java 18

This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git

commit f3e3345e8af2b117e79757690644a04bb584bf82
Author: Jaikiran Pai <ja...@apache.org>
AuthorDate: Sun Nov 28 19:53:20 2021 +0530

    launch Ant project tests by passing java.security.manager=allow on Java 18
---
 build.xml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/build.xml b/build.xml
index cc184a3..8d401aa 100644
--- a/build.xml
+++ b/build.xml
@@ -1756,6 +1756,9 @@ ${antunit.reports}
         <javaversion atleast="9"/>
       </not>
     </condition>
+    <condition property="java.security.manager" value="allow">
+      <javaversion exactly="18"/>
+    </condition>
     <macrodef name="test-junit">
       <element name="junit-nested" implicit="true"/>
       <sequential>
@@ -1806,6 +1809,13 @@ ${antunit.reports}
           <syspropertyset>
             <propertyref name="sun.io.useCanonCaches"/>
           </syspropertyset>
+          <!-- Many JUnit tests, in the Ant project, launch Java programs through Ant's
+           java task, which internally calls System.setSecurityManager(). In Java 18
+           an explicit system property value needs to be set to prevent exception from
+           being thrown from that call -->
+          <syspropertyset>
+            <propertyref name="java.security.manager"/>
+          </syspropertyset>
           <classpath>
             <path refid="tests-runtime-classpath"/>
             <pathelement location="${junit.collector.dir}"/>