You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/09/23 15:49:09 UTC
svn commit: r1389084 - in
/incubator/easyant/core/trunk/src/main/java/org/apache/easyant:
core/EasyAntEngine.java core/EasyAntMain.java
core/parser/EasyAntConfigParser.java tasks/LoadModule.java
Author: jlboudart
Date: Sun Sep 23 15:49:08 2012
New Revision: 1389084
URL: http://svn.apache.org/viewvc?rev=1389084&view=rev
Log:
Fix java 5 compatibily with Property.stringPropertyNames() method
Modified:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1389084&r1=1389083&r2=1389084&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java Sun Sep 23 15:49:08 2012
@@ -402,7 +402,9 @@ public class EasyAntEngine {
public void initProject(Project project) {
project.init();
// set user-define properties
- for (String arg : configuration.getDefinedProps().stringPropertyNames()) {
+ Enumeration<?> properties = configuration.getDefinedProps().propertyNames();
+ while (properties.hasMoreElements()) {
+ String arg = (String) properties.nextElement();
String value = (String) configuration.getDefinedProps().get(arg);
project.setUserProperty(arg, value);
}
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java?rev=1389084&r1=1389083&r2=1389084&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java Sun Sep 23 15:49:08 2012
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -152,7 +153,9 @@ public class EasyAntMain implements AntM
}
if (additionalUserProperties != null) {
- for (String key : additionalUserProperties.stringPropertyNames()) {
+ Enumeration<?> properties = additionalUserProperties.propertyNames();
+ while (properties.hasMoreElements()) {
+ String key = (String) properties.nextElement();
String property = additionalUserProperties.getProperty(key);
easyAntConfiguration.getDefinedProps().put(key, property);
}
@@ -393,7 +396,9 @@ public class EasyAntMain implements AntM
}
// ensure that -D properties take precedence
- for (String name : props.stringPropertyNames()) {
+ Enumeration<?> properties = props.propertyNames();
+ while (properties.hasMoreElements()) {
+ String name = (String) properties.nextElement();
if (easyAntConfiguration.getDefinedProps().getProperty(name) == null) {
easyAntConfiguration.getDefinedProps().put(name, props.getProperty(name));
}
@@ -488,7 +493,8 @@ public class EasyAntMain implements AntM
* The maximum length of the names of the targets. If descriptions are given, they are padded to this
* position so they line up (so long as the names really <i>are</i> shorter than this).
*/
- private static void printTargets(Project project, List<String> names, List<String> descriptions, String heading, int maxlen) {
+ private static void printTargets(Project project, List<String> names, List<String> descriptions, String heading,
+ int maxlen) {
if (names.size() > 0) {
// now, start printing the targets and their descriptions
String lSep = System.getProperty("line.separator");
@@ -544,15 +550,15 @@ public class EasyAntMain implements AntM
// maintain a sorted list of targets
if (currentTarget instanceof ExtensionPoint && !currentTarget.getName().contains(":")) {
int pos = findTargetPosition(highLevelTargets, targetName);
- highLevelTargets.add(pos,targetName);
- highLevelTargetsDescriptions.add(pos,targetDescription);
+ highLevelTargets.add(pos, targetName);
+ highLevelTargetsDescriptions.add(pos, targetDescription);
} else if (targetDescription != null) {
int pos = findTargetPosition(topNames, targetName);
- topNames.add(pos,targetName);
- topDescriptions.add(pos,targetDescription);
+ topNames.add(pos, targetName);
+ topDescriptions.add(pos, targetDescription);
} else {
int pos = findTargetPosition(subNames, targetName);
- subNames.add(pos,targetName);
+ subNames.add(pos, targetName);
}
if (targetName.length() > maxLength) {
maxLength = targetName.length();
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java?rev=1389084&r1=1389083&r2=1389084&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java Sun Sep 23 15:49:08 2012
@@ -23,6 +23,7 @@ import java.io.InputStream;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
@@ -200,7 +201,9 @@ public class EasyAntConfigParser {
properties.load(is);
is.close();
}
- for (String key : properties.stringPropertyNames()) {
+ Enumeration<?> propertiesEnum = properties.propertyNames();
+ while (propertiesEnum.hasMoreElements()) {
+ String key = (String) propertiesEnum.nextElement();
easyAntConfiguration.getDefinedProps().put(key, properties.get(key));
}
} catch (Exception e) {
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java?rev=1389084&r1=1389083&r2=1389084&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java Sun Sep 23 15:49:08 2012
@@ -422,6 +422,7 @@ public class LoadModule extends Abstract
private void configureBuildRepository(IvyAntSettings projectSettings) throws BuildException {
ConfigureBuildScopedRepository configureBuildScopedRepository = new ConfigureBuildScopedRepository();
configureBuildScopedRepository.setName(EasyAntConstants.BUILD_SCOPE_REPOSITORY);
+ configureBuildScopedRepository.setSettingsRef(IvyInstanceHelper.buildProjectIvyReference(getProject()));
initTask(configureBuildScopedRepository).execute();
}