This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f3fe6564d2866e5a12d9356ea447505f0f5c1740 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jul 8 13:02:38 2019 +0100 Use enhanced for-loops. Based on PR #177 by Govinda Sakhare. --- java/org/apache/catalina/core/ApplicationContext.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index 433675f..ff9ba95 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -735,11 +735,11 @@ public class ApplicationContext implements ServletContext { } ServletContextAttributeEvent event = new ServletContextAttributeEvent( context.getServletContext(), name, value); - for (int i = 0; i < listeners.length; i++) { - if (!(listeners[i] instanceof ServletContextAttributeListener)) { + for (Object obj : listeners) { + if (!(obj instanceof ServletContextAttributeListener)) { continue; } - ServletContextAttributeListener listener = (ServletContextAttributeListener) listeners[i]; + ServletContextAttributeListener listener = (ServletContextAttributeListener) obj; try { context.fireContainerEvent("beforeContextAttributeRemoved", listener); listener.attributeRemoved(event); @@ -788,11 +788,11 @@ public class ApplicationContext implements ServletContext { event = new ServletContextAttributeEvent(context.getServletContext(), name, value); } - for (int i = 0; i < listeners.length; i++) { - if (!(listeners[i] instanceof ServletContextAttributeListener)) { + for (Object obj : listeners) { + if (!(obj instanceof ServletContextAttributeListener)) { continue; } - ServletContextAttributeListener listener = (ServletContextAttributeListener) listeners[i]; + ServletContextAttributeListener listener = (ServletContextAttributeListener) obj; try { if (replaced) { context.fireContainerEvent("beforeContextAttributeReplaced", listener); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org