Switching to enumeration for collecting properties.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1296956 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2012-03-05 08:26:54 +00:00
parent 6e7c2c441b
commit 0eb091b2ca
1 changed files with 4 additions and 6 deletions

View File

@ -1,9 +1,7 @@
package org.apache.lucene.util;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.TreeMap;
import java.util.*;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@ -34,9 +32,9 @@ public class SystemPropertiesRestoreRule implements TestRule {
static TreeMap<String,String> cloneAsMap(Properties properties) {
TreeMap<String,String> result = new TreeMap<String,String>();
for (Entry<Object,Object> e : properties.entrySet()) {
// We can be sure it's always strings, can't we?
result.put((String) e.getKey(), (String) e.getValue());
for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
String key = (String) e.nextElement();
result.put(key, (String) properties.get(key));
}
return result;
}