Skip to content

Commit 6696c84

Browse files
committed
2 parents b771857 + 02f0a1a commit 6696c84

File tree

135 files changed

+660
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+660
-468
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pipeline {
99
}
1010
tools {
1111
maven 'apache-maven-latest'
12-
jdk 'temurin-jdk17-latest'
12+
jdk 'temurin-jdk21-latest'
1313
}
1414
stages {
1515
stage('Build') {

ant/org.eclipse.ant.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.ant.core; singleton:=true
5-
Bundle-Version: 3.7.500.qualifier
5+
Bundle-Version: 3.7.600.qualifier
66
Bundle-Activator: org.eclipse.ant.core.AntCorePlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

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

Lines changed: 16 additions & 7 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.JavaEnvUtils;
5556
import org.eclipse.ant.core.AntCorePlugin;
5657
import org.eclipse.ant.core.AntCorePreferences;
5758
import org.eclipse.ant.core.AntSecurityException;
@@ -82,6 +83,17 @@
8283
@SuppressWarnings("removal") // SecurityManager
8384
public class InternalAntRunner {
8485

86+
private static final boolean IS_SECURITY_MANAGER_SUPPORTED = isSecurityManagerAllowed();
87+
88+
private static boolean isSecurityManagerAllowed() {
89+
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
90+
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
91+
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
92+
}
93+
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set
94+
return !"disallow".equals(sm); //$NON-NLS-1$
95+
}
96+
8597
private IProgressMonitor monitor;
8698
private ArrayList<String> buildListeners;
8799
private String buildFileLocation;
@@ -695,12 +707,11 @@ private void run(List<String> argList) {
695707
if (extraArguments != null) {
696708
printArguments(getCurrentProject());
697709
}
698-
try {
710+
if (IS_SECURITY_MANAGER_SUPPORTED) {
711+
// TODO: call SecurityManagerUtil.isSecurityManagerAllowed() once it's more fine-grained,
712+
// i.e. once https://github.com/apache/ant/pull/216 is available.
699713
System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread()));
700714
}
701-
catch (UnsupportedOperationException ex) {
702-
AntCorePlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, 0, InternalAntMessages.InternalAntRunner_SecurityManagerError, ex));
703-
}
704715
if (targets == null) {
705716
targets = new Vector<>(1);
706717
}
@@ -1432,9 +1443,7 @@ protected void loadPropertyFiles() {
14321443
}
14331444
try {
14341445
List<Properties> allProperties = AntCoreUtil.loadPropertyFiles(propertyFiles, currentProject.getUserProperty("basedir"), getBuildFileLocation()); //$NON-NLS-1$
1435-
Iterator<Properties> iter = allProperties.iterator();
1436-
while (iter.hasNext()) {
1437-
Properties props = iter.next();
1446+
for (Properties props : allProperties) {
14381447
Enumeration<?> propertyNames = props.propertyNames();
14391448
while (propertyNames.hasMoreElements()) {
14401449
String name = (String) propertyNames.nextElement();

ant/org.eclipse.ant.launching/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
33
Bundle-Localization: plugin
44
Bundle-Name: %pluginName
55
Bundle-SymbolicName: org.eclipse.ant.launching;singleton:=true
6-
Bundle-Version: 1.4.600.qualifier
6+
Bundle-Version: 1.4.700.qualifier
77
Bundle-Activator: org.eclipse.ant.internal.launching.AntLaunching
88
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
99
org.eclipse.debug.core;bundle-version="[3.12.0,4.0.0)",

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.apache.tools.ant.Task;
5151
import org.apache.tools.ant.TaskAdapter;
5252
import org.apache.tools.ant.util.FileUtils;
53+
import org.apache.tools.ant.util.JavaEnvUtils;
5354
import org.eclipse.ant.internal.launching.remote.logger.RemoteAntBuildLogger;
5455

5556
/**
@@ -58,6 +59,17 @@
5859
*/
5960
public class InternalAntRunner {
6061

62+
private static final boolean IS_SECURITY_MANAGER_SUPPORTED = isSecurityManagerAllowed();
63+
64+
private static boolean isSecurityManagerAllowed() {
65+
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
66+
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
67+
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
68+
}
69+
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set
70+
return !"disallow".equals(sm); //$NON-NLS-1$
71+
}
72+
6173
/**
6274
* Message priority for project help messages.
6375
*/
@@ -443,7 +455,9 @@ private void run(List<String> argList) {
443455
printArguments(getCurrentProject());
444456
}
445457
try {
446-
System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread()));
458+
if (IS_SECURITY_MANAGER_SUPPORTED) {
459+
System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread()));
460+
}
447461
}
448462
catch (UnsupportedOperationException ex) {
449463
logMessage(null, RemoteAntMessages.getString("InternalAntRunner.SecurityManagerError"), Project.MSG_WARN); //$NON-NLS-1$

ant/org.eclipse.ant.tests.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.ant.tests.core; singleton:=true
5-
Bundle-Version: 3.7.500.qualifier
5+
Bundle-Version: 3.7.600.qualifier
66
Bundle-ClassPath: anttestscore.jar
77
Bundle-Activator: org.eclipse.ant.tests.core.testplugin.AntTestPlugin
88
Bundle-Vendor: %providerName

ant/org.eclipse.ant.tests.core/test plugin/org/eclipse/ant/tests/core/testplugin/AntTestChecker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package org.eclipse.ant.tests.core.testplugin;
1515

1616
import java.util.ArrayList;
17+
import java.util.Collections;
1718
import java.util.Hashtable;
1819
import java.util.List;
1920

@@ -219,7 +220,7 @@ public String getUserProperty(String name) {
219220
}
220221

221222
public List<String> getMessages() {
222-
return messages;
223+
return Collections.unmodifiableList(messages);
223224
}
224225

225226
public List<String> getListeners() {

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

Lines changed: 24 additions & 18 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.JavaEnvUtils;
5253
import org.eclipse.ant.core.AntCorePlugin;
5354
import org.eclipse.ant.core.AntCorePreferences;
5455
import org.eclipse.ant.core.AntSecurityException;
@@ -89,6 +90,17 @@
8990
@SuppressWarnings("removal") // SecurityManager
9091
public class AntModel implements IAntModel {
9192

93+
private static final boolean IS_SECURITY_MANAGER_SUPPORTED = isSecurityManagerAllowed();
94+
95+
private static boolean isSecurityManagerAllowed() {
96+
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
97+
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
98+
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
99+
}
100+
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set
101+
return !"disallow".equals(sm); //$NON-NLS-1$
102+
}
103+
92104
private static ClassLoader fgClassLoader;
93105
private static int fgInstanceCount = 0;
94106
private static Object loaderLock = new Object();
@@ -363,8 +375,10 @@ private void parseDocument(IDocument input) {
363375
SecurityManager origSM = System.getSecurityManager();
364376
processAntHome(true);
365377
try {
366-
// set a security manager to disallow system exit and system property setting
367-
System.setSecurityManager(new AntSecurityManager(origSM, Thread.currentThread(), false));
378+
if (IS_SECURITY_MANAGER_SUPPORTED) {
379+
// set a security manager to disallow system exit and system property setting
380+
System.setSecurityManager(new AntSecurityManager(origSM, Thread.currentThread(), false));
381+
}
368382
resolveBuildfile();
369383
endReporting();
370384
// clear the additional property-holder(s) to avoid potential memory leaks
@@ -379,7 +393,9 @@ private void parseDocument(IDocument input) {
379393
finally {
380394
Thread.currentThread().setContextClassLoader(originalClassLoader);
381395
getClassLoader(null);
382-
System.setSecurityManager(origSM);
396+
if (System.getSecurityManager() instanceof AntSecurityManager) {
397+
System.setSecurityManager(origSM);
398+
}
383399
project.fireBuildFinished(null); // cleanup (IntrospectionHelper)
384400
}
385401
}
@@ -550,9 +566,7 @@ private void setGlobalProperties(Project project) {
550566

551567
private void resolveBuildfile() {
552568
Collection<AntTaskNode> nodeCopy = new ArrayList<>(fTaskNodes);
553-
Iterator<AntTaskNode> iter = nodeCopy.iterator();
554-
while (iter.hasNext()) {
555-
AntTaskNode node = iter.next();
569+
for (AntTaskNode node : nodeCopy) {
556570
fNodeBeingResolved = node;
557571
fNodeBeingResolvedIndex = -1;
558572
if (node.configure(false)) {
@@ -1439,10 +1453,8 @@ private void reconcileTaskAndTypes() {
14391453
if (fCurrentNodeIdentifiers == null || fDefinerNodeIdentifierToDefinedTasks == null) {
14401454
return;
14411455
}
1442-
Iterator<String> iter = fDefinerNodeIdentifierToDefinedTasks.keySet().iterator();
14431456
ComponentHelper helper = ComponentHelper.getComponentHelper(fProjectNode.getProject());
1444-
while (iter.hasNext()) {
1445-
String key = iter.next();
1457+
for (String key : fDefinerNodeIdentifierToDefinedTasks.keySet()) {
14461458
if (fCurrentNodeIdentifiers.get(key) == null) {
14471459
removeDefinerTasks(key, helper.getAntTypeTable());
14481460
}
@@ -1579,9 +1591,7 @@ public AntElementNode getReferenceNode(String text) {
15791591
}
15801592

15811593
Set<Task> nodes = fTaskToNode.keySet();
1582-
Iterator<Task> iter = nodes.iterator();
1583-
while (iter.hasNext()) {
1584-
Task task = iter.next();
1594+
for (Task task : nodes) {
15851595
Task tmptask = task;
15861596
if (tmptask instanceof UnknownElement) {
15871597
UnknownElement element = (UnknownElement) tmptask;
@@ -1720,9 +1730,7 @@ protected void addDefinedTasks(List<String> newTasks, AntDefiningTaskNode node)
17201730
fCurrentNodeIdentifiers.remove(identifier);
17211731
}
17221732
fDefinerNodeIdentifierToDefinedTasks.put(identifier, newTasks);
1723-
Iterator<String> iter = newTasks.iterator();
1724-
while (iter.hasNext()) {
1725-
String name = iter.next();
1733+
for (String name : newTasks) {
17261734
fTaskNameToDefiningNode.put(name, node);
17271735
}
17281736
}
@@ -1800,9 +1808,7 @@ private String getPrefixMapping(String prefix) {
18001808
private String getUserPrefixMapping(String prefix) {
18011809
if (fNamespacePrefixMappings != null) {
18021810
Set<Entry<String, String>> entrySet = fNamespacePrefixMappings.entrySet();
1803-
Iterator<Entry<String, String>> entries = entrySet.iterator();
1804-
while (entries.hasNext()) {
1805-
Map.Entry<String, String> entry = entries.next();
1811+
for (Entry<String, String> entry : entrySet) {
18061812
if (entry.getValue().equals(prefix)) {
18071813
return entry.getKey();
18081814
}

ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.ant.ui; singleton:=true
5-
Bundle-Version: 3.9.600.qualifier
5+
Bundle-Version: 3.9.700.qualifier
66
Bundle-Activator: org.eclipse.ant.internal.ui.AntUIPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin
-127 Bytes
Loading

0 commit comments

Comments
 (0)