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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 6804b77978 Avoid IDE warning
6804b77978 is described below

commit 6804b779785a00ea9702e0c3b54a84e41b1e1c3e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Nov 27 09:45:01 2024 +0000

    Avoid IDE warning
    
    The IDE can't figure out that service is never null if the loop exits
    without an exception.
---
 .../apache/catalina/startup/TestTomcatStandalone.java    | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/startup/TestTomcatStandalone.java 
b/test/org/apache/catalina/startup/TestTomcatStandalone.java
index ffb18f1f25..b4300c03f9 100644
--- a/test/org/apache/catalina/startup/TestTomcatStandalone.java
+++ b/test/org/apache/catalina/startup/TestTomcatStandalone.java
@@ -252,19 +252,15 @@ public class TestTomcatStandalone extends LoggingBaseTest 
{
 
         Service service = null;
         int i = 0;
-        while (true) {
-            Assert.assertTrue(i++ < 500);
-            if (service == null) {
-                Server server = catalina.getServer();
-                if (server != null && 
catalina.getServer().findServices().length > 0) {
-                    service = catalina.getServer().findServices()[0];
-                }
-            }
-            if (service != null && service.getState() == 
LifecycleState.STARTED) {
-                break;
+        while (i < 500 && (service == null || service.getState() != 
LifecycleState.STARTED)) {
+            Server server = catalina.getServer();
+            if (server != null && catalina.getServer().findServices().length > 
0) {
+                service = catalina.getServer().findServices()[0];
             }
             Thread.sleep(10);
+            i++;
         }
+        Assert.assertNotNull(service);
 
         Connector connector = service.findConnectors()[0];
         res = TomcatBaseTest.getUrl("http://localhost:"; + 
connector.getLocalPort() + "/");


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to