You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/03/05 09:26:28 UTC

svn commit: r1296955 - /lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java

Author: dweiss
Date: Mon Mar  5 08:26:27 2012
New Revision: 1296955

URL: http://svn.apache.org/viewvc?rev=1296955&view=rev
Log:
Switching to enumeration for collecting properties.

Modified:
    lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java

Modified: lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java?rev=1296955&r1=1296954&r2=1296955&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java (original)
+++ lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/SystemPropertiesRestoreRule.java Mon Mar  5 08:26:27 2012
@@ -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;
@@ -32,9 +30,9 @@ public class SystemPropertiesRestoreRule
   
   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;
   }