This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 15127efad5 Avoid IDE warning
15127efad5 is described below
commit 15127efad559b6d392efa26ab1c4b793202ac53d
Author: Mark Thomas <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]