You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/07/08 12:04:31 UTC

[tomcat] 04/04: Use enhanced for-loops. Based on PR #177 by Govinda Sakhare.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 2edb9b000e77967b651fe78df81d47ac5fb828fb
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 79f2a8b..79628e0 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -679,11 +679,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);
@@ -732,11 +732,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org