mbenson 2005/03/15 08:08:33
Modified: src/main/org/apache/tools/ant/taskdefs/optional
EchoProperties.java
Log:
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...
Revision Changes Path
1.32 +23 -0
ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
Index: EchoProperties.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- EchoProperties.java 14 Mar 2005 15:31:34 -0000 1.31
+++ EchoProperties.java 15 Mar 2005 16:08:33 -0000 1.32
@@ -31,6 +31,10 @@
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.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 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();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]