From cd02e2101cf2013c2f879477ef53b2be74092673 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Tue, 15 Mar 2005 16:08:33 +0000 Subject: [PATCH] I get these epiphanies lying in bed Saturday mornings... such as "Properties won't sort under an alternate implementation of Properties.store()," such as might be encountered on Kaffe... git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277987 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/taskdefs/optional/EchoProperties.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java index 18405b88d..f392cbbd7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java @@ -31,6 +31,10 @@ import java.util.Properties; import java.util.Vector; import java.util.List; import java.util.ArrayList; +import java.util.Comparator; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import java.util.Collections; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; @@ -43,6 +47,7 @@ import org.apache.tools.ant.types.PropertySet; import org.apache.tools.ant.util.CollectionUtils; import org.apache.tools.ant.util.DOMElementWriter; import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.JavaEnvUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -344,6 +349,24 @@ public class EchoProperties extends Task { public Enumeration keys() { return CollectionUtils.asEnumeration(keyList.iterator()); } + public Set entrySet() { + Set result = super.entrySet(); + if (JavaEnvUtils.isKaffe()) { + TreeSet t = new TreeSet(new Comparator() { + public boolean equals(Object o) { + return false; + } + public int compare(Object o1, Object o2) { + String key1 = (String) ((Map.Entry) o1).getKey(); + String key2 = (String) ((Map.Entry) o2).getKey(); + return key1.compareTo(key2); + } + }); + t.addAll(result); + result = t; + } + return result; + } }; for (int i = 0; i < keyList.size(); i++) { String name = keyList.get(i).toString();