Skip to content

Commit 9c3aad6

Browse files
merksakurtakov
authored andcommitted
Ensure o.a.tools.ant.util FileUtils is initialized before JavaEnvUtils
#2605
1 parent 2f23f2b commit 9c3aad6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.apache.tools.ant.Target;
5353
import org.apache.tools.ant.TaskAdapter;
5454
import org.apache.tools.ant.XmlLogger;
55+
import org.apache.tools.ant.util.FileUtils;
5556
import org.apache.tools.ant.util.JavaEnvUtils;
5657
import org.eclipse.ant.core.AntCorePlugin;
5758
import org.eclipse.ant.core.AntCorePreferences;
@@ -88,6 +89,9 @@ public class InternalAntRunner {
8889
private static boolean isSecurityManagerAllowed() {
8990
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
9091
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
92+
// There is a circularity problem if JavaEnvUtils is initialized before FileUtils on Windows
93+
// https://github.com/eclipse-platform/eclipse.platform/issues/2605
94+
FileUtils.getFileUtils();
9195
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
9296
}
9397
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set

ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public class InternalAntRunner {
6464
private static boolean isSecurityManagerAllowed() {
6565
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
6666
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
67+
// There is a circularity problem if JavaEnvUtils is initialized before FileUtils on Windows
68+
// https://github.com/eclipse-platform/eclipse.platform/issues/2605
69+
FileUtils.getFileUtils();
6770
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
6871
}
6972
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set

ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.apache.tools.ant.Task;
5050
import org.apache.tools.ant.TaskAdapter;
5151
import org.apache.tools.ant.UnknownElement;
52+
import org.apache.tools.ant.util.FileUtils;
5253
import org.apache.tools.ant.util.JavaEnvUtils;
5354
import org.eclipse.ant.core.AntCorePlugin;
5455
import org.eclipse.ant.core.AntCorePreferences;
@@ -95,6 +96,9 @@ public class AntModel implements IAntModel {
9596
private static boolean isSecurityManagerAllowed() {
9697
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
9798
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
99+
// There is a circularity problem if JavaEnvUtils is initialized before FileUtils on Windows
100+
// https://github.com/eclipse-platform/eclipse.platform/issues/2605
101+
FileUtils.getFileUtils();
98102
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
99103
}
100104
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set

0 commit comments

Comments
 (0)