diff options
author | Robert Antoni Buj i Gelonch <robert.buj@gmail.com> | 2014-10-11 17:08:23 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-19 10:10:59 +0000 |
commit | a8e723ed3eed44a85714abf1cb04b74178d2424f (patch) | |
tree | 7c7ac79e1a2420d8446c0f847cd643dd7db19cd5 /qadevOOo | |
parent | ddac8522821ae288d4ce1533f9ebe8daf9e2d935 (diff) |
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>
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/runner/helper/CfgParser.java | 19 | ||||
-rw-r--r-- | qadevOOo/runner/org/openoffice/Runner.java | 10 | ||||
-rw-r--r-- | qadevOOo/runner/stats/SQLExecution.java | 10 |
3 files changed, 21 insertions, 18 deletions
diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java index 6c77461c3880..d6cf0e60a762 100644 --- a/qadevOOo/runner/helper/CfgParser.java +++ b/qadevOOo/runner/helper/CfgParser.java @@ -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); } } diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index d833a4fb56e1..ff1bff4109b5 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -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)) { diff --git a/qadevOOo/runner/stats/SQLExecution.java b/qadevOOo/runner/stats/SQLExecution.java index bb50dce7b1a5..34f8949b7772 100644 --- a/qadevOOo/runner/stats/SQLExecution.java +++ b/qadevOOo/runner/stats/SQLExecution.java @@ -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]); |