Kaydet (Commit) a8e723ed authored tarafından Robert Antoni Buj i Gelonch's avatar Robert Antoni Buj i Gelonch Kaydeden (comit) Noel Grandin

runner: Iterate over each Entry in a Map

Change-Id: I48de54ea88e7fd9f2d903c172eb2b6e1a5b73edd
Reviewed-on: https://gerrit.libreoffice.org/11918Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst ddac8522
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
package helper; package helper;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import lib.TestParameters; import lib.TestParameters;
...@@ -102,20 +105,20 @@ public class CfgParser ...@@ -102,20 +105,20 @@ public class CfgParser
if (os != null && os.length() > 1) if (os != null && os.length() > 1)
{ {
//found something that could be a prefix Map<String, Object> aux = new HashMap<String, Object>();
//check all parameters for this for (Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator(); it.hasNext();)
Iterator<String> keys = param.keySet().iterator();
while (keys.hasNext())
{ {
String key = keys.next(); Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
if (key.startsWith(os)) if (key.startsWith(os))
{ {
Object oldValue = param.get(key); Object oldValue = entry.getValue();
String newKey = key.substring(os.length() + 1); String newKey = key.substring(os.length() + 1);
param.remove(key); it.remove();
param.put(newKey, oldValue); aux.put(newKey, oldValue);
} }
} }
param.putAll(aux);
} }
} }
......
...@@ -22,6 +22,7 @@ import helper.ClParser; ...@@ -22,6 +22,7 @@ import helper.ClParser;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
...@@ -116,13 +117,12 @@ public class Runner ...@@ -116,13 +117,12 @@ public class Runner
bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim); bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim);
// ----- check all TestParameters ----- // ----- check all TestParameters -----
Iterator<String> aIter = _aParams.keySet().iterator(); for (Map.Entry<String, Object> entry : _aParams.entrySet())
while (aIter.hasNext())
{ {
String sKey = aIter.next(); String sKey = entry.getKey();
if (_aParams.get(sKey) instanceof String) if (entry.getValue() instanceof String)
{ {
String sValue = (String) _aParams.get(sKey); String sValue = (String) entry.getValue();
if (checkVariableForCygwin(sValue)) if (checkVariableForCygwin(sValue))
{ {
......
...@@ -22,9 +22,10 @@ import java.sql.DriverManager; ...@@ -22,9 +22,10 @@ import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
...@@ -229,10 +230,9 @@ public class SQLExecution { ...@@ -229,10 +230,9 @@ public class SQLExecution {
execute(sqlCommand.get(i), sqlOutput, update); execute(sqlCommand.get(i), sqlOutput, update);
// merge output with input // merge output with input
if (!update && mergeOutputIntoInput) { if (!update && mergeOutputIntoInput) {
Iterator<String> keys = sqlOutput.keySet().iterator(); for (Map.Entry<String, String[]> entry : sqlOutput.entrySet()) {
while(keys.hasNext()) { String key = entry.getKey();
String key = keys.next(); String[] val = entry.getValue();
String[]val = sqlOutput.get(key);
if (val != null && val.length != 0) { if (val != null && val.length != 0) {
if (val.length == 1) if (val.length == 1)
sqlInput.put(key, val[0]); sqlInput.put(key, val[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment