Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ant/org.eclipse.ant.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ant.core; singleton:=true
Bundle-Version: 3.7.500.qualifier
Bundle-Version: 3.7.600.qualifier
Bundle-Activator: org.eclipse.ant.core.AntCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.tools.ant.Target;
import org.apache.tools.ant.TaskAdapter;
import org.apache.tools.ant.XmlLogger;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.eclipse.ant.core.AntCorePlugin;
import org.eclipse.ant.core.AntCorePreferences;
import org.eclipse.ant.core.AntSecurityException;
Expand Down Expand Up @@ -82,6 +83,17 @@
@SuppressWarnings("removal") // SecurityManager
public class InternalAntRunner {

private static final boolean IS_SECURITY_MANAGER_SUPPORTED = isSecurityManagerAllowed();

private static boolean isSecurityManagerAllowed() {
String sm = System.getProperty("java.security.manager"); //$NON-NLS-1$
if (sm == null) { // default is 'disallow' since 18 and was 'allow' before
return !JavaEnvUtils.isAtLeastJavaVersion("18"); //$NON-NLS-1$
}
// Value is either 'disallow' or 'allow' or specifies the SecurityManager class to set
return !"disallow".equals(sm); //$NON-NLS-1$
}

private IProgressMonitor monitor;
private ArrayList<String> buildListeners;
private String buildFileLocation;
Expand Down Expand Up @@ -695,12 +707,11 @@ private void run(List<String> argList) {
if (extraArguments != null) {
printArguments(getCurrentProject());
}
try {
if (IS_SECURITY_MANAGER_SUPPORTED) {
// TODO: call SecurityManagerUtil.isSecurityManagerAllowed() once it's more fine-grained,
// i.e. once https://github.com/apache/ant/pull/216 is available.
System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread()));
}
catch (UnsupportedOperationException ex) {
AntCorePlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, 0, InternalAntMessages.InternalAntRunner_SecurityManagerError, ex));
}
if (targets == null) {
targets = new Vector<>(1);
}
Expand Down Expand Up @@ -1432,9 +1443,7 @@ protected void loadPropertyFiles() {
}
try {
List<Properties> allProperties = AntCoreUtil.loadPropertyFiles(propertyFiles, currentProject.getUserProperty("basedir"), getBuildFileLocation()); //$NON-NLS-1$
Iterator<Properties> iter = allProperties.iterator();
while (iter.hasNext()) {
Properties props = iter.next();
for (Properties props : allProperties) {
Enumeration<?> propertyNames = props.propertyNames();
while (propertyNames.hasMoreElements()) {
String name = (String) propertyNames.nextElement();
Expand Down
2 changes: 1 addition & 1 deletion ant/org.eclipse.ant.tests.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ant.tests.core; singleton:=true
Bundle-Version: 3.7.500.qualifier
Bundle-Version: 3.7.600.qualifier
Bundle-ClassPath: anttestscore.jar
Bundle-Activator: org.eclipse.ant.tests.core.testplugin.AntTestPlugin
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.ant.tests.core.testplugin;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;

Expand Down Expand Up @@ -219,7 +220,7 @@ public String getUserProperty(String name) {
}

public List<String> getMessages() {
return messages;
return Collections.unmodifiableList(messages);
}

public List<String> getListeners() {
Expand Down
Loading