runner: Iterate over each Entry in a Map
Change-Id: I48de54ea88e7fd9f2d903c172eb2b6e1a5b73edd Reviewed-on: https://gerrit.libreoffice.org/11918 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
ddac852282
commit
a8e723ed3e
@@ -18,8 +18,11 @@
|
||||
package helper;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import lib.TestParameters;
|
||||
@@ -102,20 +105,20 @@ public class CfgParser
|
||||
if (os != null && os.length() > 1)
|
||||
{
|
||||
|
||||
//found something that could be a prefix
|
||||
//check all parameters for this
|
||||
Iterator<String> keys = param.keySet().iterator();
|
||||
while (keys.hasNext())
|
||||
Map<String, Object> aux = new HashMap<String, Object>();
|
||||
for (Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
String key = keys.next();
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
String key = entry.getKey();
|
||||
if (key.startsWith(os))
|
||||
{
|
||||
Object oldValue = param.get(key);
|
||||
Object oldValue = entry.getValue();
|
||||
String newKey = key.substring(os.length() + 1);
|
||||
param.remove(key);
|
||||
param.put(newKey, oldValue);
|
||||
it.remove();
|
||||
aux.put(newKey, oldValue);
|
||||
}
|
||||
}
|
||||
param.putAll(aux);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import helper.ClParser;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -116,13 +117,12 @@ public class Runner
|
||||
bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim);
|
||||
|
||||
// ----- check all TestParameters -----
|
||||
Iterator<String> aIter = _aParams.keySet().iterator();
|
||||
while (aIter.hasNext())
|
||||
for (Map.Entry<String, Object> entry : _aParams.entrySet())
|
||||
{
|
||||
String sKey = aIter.next();
|
||||
if (_aParams.get(sKey) instanceof String)
|
||||
String sKey = entry.getKey();
|
||||
if (entry.getValue() instanceof String)
|
||||
{
|
||||
String sValue = (String) _aParams.get(sKey);
|
||||
String sValue = (String) entry.getValue();
|
||||
|
||||
if (checkVariableForCygwin(sValue))
|
||||
{
|
||||
|
@@ -22,9 +22,10 @@ import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.Statement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
@@ -229,10 +230,9 @@ public class SQLExecution {
|
||||
execute(sqlCommand.get(i), sqlOutput, update);
|
||||
// merge output with input
|
||||
if (!update && mergeOutputIntoInput) {
|
||||
Iterator<String> keys = sqlOutput.keySet().iterator();
|
||||
while(keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
String[]val = sqlOutput.get(key);
|
||||
for (Map.Entry<String, String[]> entry : sqlOutput.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String[] val = entry.getValue();
|
||||
if (val != null && val.length != 0) {
|
||||
if (val.length == 1)
|
||||
sqlInput.put(key, val[0]);
|
||||
|
Reference in New Issue
Block a user