Use foreach instead of manual do while. Available in Java 5 and newer.
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8eb7338a Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8eb7338a Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8eb7338a Branch: refs/heads/master Commit: 8eb7338a97c1f8127604cdcd88282a2a2344c0ed Parents: cb67f0e Author: Otavio Santana <otaviopolianasant...@gmail.com> Authored: Thu Dec 20 08:32:50 2018 -0200 Committer: Otavio Santana <otaviopolianasant...@gmail.com> Committed: Thu Dec 20 08:32:50 2018 -0200 ---------------------------------------------------------------------- .../main/java/org/apache/openejb/config/ReadDescriptors.java | 4 +--- .../openejb/config/rules/CheckIncorrectPropertyNames.java | 5 ++--- .../main/java/org/apache/openejb/core/ivm/naming/NameNode.java | 6 ++---- .../apache/openejb/core/webservices/HandlerResolverImpl.java | 5 ++--- 4 files changed, 7 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/8eb7338a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java index ab482f1..06156d7 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java @@ -474,9 +474,7 @@ public class ReadDescriptors implements DynamicDeployer { } private static void checkDuplicatedByBeansXml(final List<String> list, final List<String> duplicated) { - final Iterator<String> it = list.iterator(); - while (it.hasNext()) { - final String str = it.next(); + for (String str : list) { if (list.indexOf(str) != list.lastIndexOf(str)) { duplicated.add(str); } http://git-wip-us.apache.org/repos/asf/tomee/blob/8eb7338a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java index 8b85bb3..bc856d8 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java @@ -72,9 +72,8 @@ public class CheckIncorrectPropertyNames extends ValidationBase { this.module = appModule; final Properties systemProperties = SystemInstance.get().getProperties(); - final Iterator iterator = incorrectAndCorrectPropNames.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next(); + for (Object o : incorrectAndCorrectPropNames.entrySet()) { + final Map.Entry<String, String> entry = (Map.Entry<String, String>) o; if (systemProperties.containsKey(entry.getKey())) { warn(appModule.toString(), "incorrect.property.name", entry.getKey(), entry.getValue()); } http://git-wip-us.apache.org/repos/asf/tomee/blob/8eb7338a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/NameNode.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/NameNode.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/NameNode.java index c544e9c..e641649 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/NameNode.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/NameNode.java @@ -310,10 +310,8 @@ public class NameNode implements Serializable { } if(myObject instanceof Federation) { - Iterator<Context> federatedContextsIterator = ((Federation) myObject).iterator(); - while(federatedContextsIterator.hasNext()) { - Context current = federatedContextsIterator.next(); - if(IvmContext.class.isInstance(current)) { + for (Context current : ((Federation) myObject)) { + if (IvmContext.class.isInstance(current)) { IvmContext.class.cast(current).setReadOnly(isReadOnly); } } http://git-wip-us.apache.org/repos/asf/tomee/blob/8eb7338a/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/HandlerResolverImpl.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/HandlerResolverImpl.java b/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/HandlerResolverImpl.java index 5ed700f..c4653a4 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/HandlerResolverImpl.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/HandlerResolverImpl.java @@ -158,9 +158,8 @@ public class HandlerResolverImpl implements HandlerResolver { return true; } else { final String actualBindingURI = JaxWsUtils.getBindingURI(binding); - final Iterator iter = bindings.iterator(); - while (iter.hasNext()) { - final String bindingToken = (String) iter.next(); + for (Object binding1 : bindings) { + final String bindingToken = (String) binding1; final String bindingURI = JaxWsUtils.getBindingURI(bindingToken); if (actualBindingURI.equals(bindingURI)) { return true;