(tomcat) branch main updated: testServlets may run second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 10ffbb6333 testServlets may run second
10ffbb6333 is described below

commit 10ffbb6badd14901f2fb1c9d7fe6748103e1
Author: remm 
AuthorDate: Tue Sep 24 16:54:19 2024 +0200

testServlets may run second
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index dbe8c45b8f..adecc38f76 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -58,6 +58,8 @@ public class TestManagerWebapp extends TomcatBaseTest {
  */
 @Test
 public void testServlets() throws Exception {
+// Avoid possible locking failure due to deployment with the manager 
in testDeploy
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.addUser("admin", "sekr3t");


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



(tomcat) 02/02: testServlets may run second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit 9e1fdc68b45ede1a62754246cbe5a1301897df1e
Author: remm 
AuthorDate: Tue Sep 24 16:54:19 2024 +0200

testServlets may run second
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index dbe8c45b8f..adecc38f76 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -58,6 +58,8 @@ public class TestManagerWebapp extends TomcatBaseTest {
  */
 @Test
 public void testServlets() throws Exception {
+// Avoid possible locking failure due to deployment with the manager 
in testDeploy
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.addUser("admin", "sekr3t");


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



(tomcat) branch 11.0.x updated (2f63ba186c -> 9e1fdc68b4)

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


from 2f63ba186c Correctly record request start time
 new 1adfe9f120 Workaround Windows locking issue
 new 9e1fdc68b4 testServlets may run second

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 test/org/apache/catalina/manager/TestManagerWebapp.java | 16 
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 15 insertions(+), 5 deletions(-)


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



(tomcat) 01/02: Workaround Windows locking issue

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit 1adfe9f120aa338498b652b263e531739e24f41d
Author: remm 
AuthorDate: Tue Sep 24 16:32:14 2024 +0200

Workaround Windows locking issue

Manager deploy locking seems a bit difficult to avoid.
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 14 ++
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 0efb515f01..dbe8c45b8f 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -66,8 +66,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.addRole("admin", "manager-jmx");
 tomcat.addRole("admin", "manager-status");
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -194,11 +196,13 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 @Test
 public void testDeploy() throws Exception {
+// Avoid possible locking failure due to deployment with the manager
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
 
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-deploy.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
 writer.write(CONFIG);
 }
@@ -209,8 +213,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 memoryRealm.setPathname(configFile.getAbsolutePath());
 tomcat.getEngine().setRealm(memoryRealm);
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -228,7 +234,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/examples");
+appDir = new File(webappDir, "examples");
 
 client.setRequest(new String[] {
 "GET /manager/text/deploy?war=" + 
URLEncoder.QUERY.encode(appDir.getAbsolutePath(), StandardCharsets.UTF_8) + " 
HTTP/1.1" + CRLF +
diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index 893148b7bf..200978c92f 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -59,6 +59,8 @@ public abstract class LoggingBaseTest {
 
 private List deleteOnTearDown = new ArrayList<>();
 
+protected boolean ignoreTearDown = false;
+
 /**
  * Provides name of the currently executing test method.
  */
@@ -143,7 +145,7 @@ public abstract class LoggingBaseTest {
 }
 deleteOnTearDown.clear();
 
-Assert.assertTrue("Failed to delete at least one file", deleted);
+Assert.assertTrue("Failed to delete at least one file", ignoreTearDown 
|| deleted);
 }
 
 @AfterClass


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



(tomcat) branch main updated: Workaround Windows locking issue

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new fd836d2717 Workaround Windows locking issue
fd836d2717 is described below

commit fd836d2717b4ed5d2f4b006557d9355328b648b4
Author: remm 
AuthorDate: Tue Sep 24 16:32:14 2024 +0200

Workaround Windows locking issue

Manager deploy locking seems a bit difficult to avoid.
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 14 ++
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 0efb515f01..dbe8c45b8f 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -66,8 +66,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.addRole("admin", "manager-jmx");
 tomcat.addRole("admin", "manager-status");
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -194,11 +196,13 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 @Test
 public void testDeploy() throws Exception {
+// Avoid possible locking failure due to deployment with the manager
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
 
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-deploy.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
 writer.write(CONFIG);
 }
@@ -209,8 +213,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 memoryRealm.setPathname(configFile.getAbsolutePath());
 tomcat.getEngine().setRealm(memoryRealm);
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -228,7 +234,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/examples");
+appDir = new File(webappDir, "examples");
 
 client.setRequest(new String[] {
 "GET /manager/text/deploy?war=" + 
URLEncoder.QUERY.encode(appDir.getAbsolutePath(), StandardCharsets.UTF_8) + " 
HTTP/1.1" + CRLF +
diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index 893148b7bf..200978c92f 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -59,6 +59,8 @@ public abstract class LoggingBaseTest {
 
 private List deleteOnTearDown = new ArrayList<>();
 
+protected boolean ignoreTearDown = false;
+
 /**
  * Provides name of the currently executing test method.
  */
@@ -143,7 +145,7 @@ public abstract class LoggingBaseTest {
 }
 deleteOnTearDown.clear();
 
-Assert.assertTrue("Failed to delete at least one file", deleted);
+Assert.assertTrue("Failed to delete at least one file", ignoreTearDown 
|| deleted);
 }
 
 @AfterClass


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



(tomcat) branch 10.1.x updated: Add testing for deploy and storeconfig

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 31ac05f59a Add testing for deploy and storeconfig
31ac05f59a is described below

commit 31ac05f59ad49b56c6605f85ddeca6143c34f149
Author: remm 
AuthorDate: Tue Sep 24 11:16:54 2024 +0200

Add testing for deploy and storeconfig
---
 .../apache/catalina/manager/TestManagerWebapp.java | 210 -
 1 file changed, 200 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index f08532eff7..70464f56c2 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -17,7 +17,10 @@
 package org.apache.catalina.manager;
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import jakarta.servlet.http.HttpServletResponse;
 
@@ -29,9 +32,14 @@ import org.apache.catalina.Context;
 import org.apache.catalina.authenticator.TestBasicAuthParser.BasicAuthHeader;
 import org.apache.catalina.realm.MemoryRealm;
 import org.apache.catalina.realm.MessageDigestCredentialHandler;
+import org.apache.catalina.startup.Catalina;
+import org.apache.catalina.startup.HostConfig;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.storeconfig.StoreConfigLifecycleListener;
+import org.apache.catalina.util.IOTools;
+import org.apache.catalina.util.URLEncoder;
 
 public class TestManagerWebapp extends TomcatBaseTest {
 
@@ -51,6 +59,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 @Test
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
 
 File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
@@ -61,11 +70,11 @@ public class TestManagerWebapp extends TomcatBaseTest {
 MemoryRealm memoryRealm = new MemoryRealm();
 memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
 memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
 File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
-Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
-ctx.setRealm(memoryRealm);
+tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
 
@@ -78,14 +87,6 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-client.setRequest(new String[] {
-"GET /manager/ HTTP/1.1" + CRLF +
-"Host: localhost" + CRLF +
-"Connection: Close" + CRLF + CRLF });
-client.connect();
-client.processRequest(true);
-Assert.assertEquals(HttpServletResponse.SC_FOUND, 
client.getStatusCode());
-
 client.setRequest(new String[] {
 "GET /manager/html HTTP/1.1" + CRLF +
 "Host: localhost" + CRLF +
@@ -196,4 +197,193 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 }
 
+@Test
+public void testDeploy() throws Exception {
+Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
+tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
+
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+try (PrintWriter writer = new PrintWriter(configFile)) {
+writer.write(CONFIG);
+}
+addDeleteOnTearDown(configFile);
+
+MemoryRealm memoryRealm = new MemoryRealm();
+memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
+memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
+
+// Add manager webapp
+File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
+
+// Add host config otherwise there's no JMX deployer bean
+HostConfig hostConfig = new HostConfig();
+ctx.getParent().addLifecycleListener(hostConfig);
+
+tomcat.start();
+
+SimpleHttpClient client = new SimpleHttpClient() {
+@Override
+ 

(tomcat) branch 11.0.x updated: Add testing for deploy and storeconfig

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new d82b94b82d Add testing for deploy and storeconfig
d82b94b82d is described below

commit d82b94b82d3cabbe58e4392139b12f94784b847a
Author: remm 
AuthorDate: Tue Sep 24 11:16:54 2024 +0200

Add testing for deploy and storeconfig
---
 .../apache/catalina/manager/TestManagerWebapp.java | 210 -
 1 file changed, 200 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index f08532eff7..70464f56c2 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -17,7 +17,10 @@
 package org.apache.catalina.manager;
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import jakarta.servlet.http.HttpServletResponse;
 
@@ -29,9 +32,14 @@ import org.apache.catalina.Context;
 import org.apache.catalina.authenticator.TestBasicAuthParser.BasicAuthHeader;
 import org.apache.catalina.realm.MemoryRealm;
 import org.apache.catalina.realm.MessageDigestCredentialHandler;
+import org.apache.catalina.startup.Catalina;
+import org.apache.catalina.startup.HostConfig;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.storeconfig.StoreConfigLifecycleListener;
+import org.apache.catalina.util.IOTools;
+import org.apache.catalina.util.URLEncoder;
 
 public class TestManagerWebapp extends TomcatBaseTest {
 
@@ -51,6 +59,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 @Test
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
 
 File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
@@ -61,11 +70,11 @@ public class TestManagerWebapp extends TomcatBaseTest {
 MemoryRealm memoryRealm = new MemoryRealm();
 memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
 memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
 File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
-Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
-ctx.setRealm(memoryRealm);
+tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
 
@@ -78,14 +87,6 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-client.setRequest(new String[] {
-"GET /manager/ HTTP/1.1" + CRLF +
-"Host: localhost" + CRLF +
-"Connection: Close" + CRLF + CRLF });
-client.connect();
-client.processRequest(true);
-Assert.assertEquals(HttpServletResponse.SC_FOUND, 
client.getStatusCode());
-
 client.setRequest(new String[] {
 "GET /manager/html HTTP/1.1" + CRLF +
 "Host: localhost" + CRLF +
@@ -196,4 +197,193 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 }
 
+@Test
+public void testDeploy() throws Exception {
+Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
+tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
+
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+try (PrintWriter writer = new PrintWriter(configFile)) {
+writer.write(CONFIG);
+}
+addDeleteOnTearDown(configFile);
+
+MemoryRealm memoryRealm = new MemoryRealm();
+memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
+memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
+
+// Add manager webapp
+File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
+
+// Add host config otherwise there's no JMX deployer bean
+HostConfig hostConfig = new HostConfig();
+ctx.getParent().addLifecycleListener(hostConfig);
+
+tomcat.start();
+
+SimpleHttpClient client = new SimpleHttpClient() {
+@Override
+ 

(tomcat) branch 9.0.x updated: Add testing for deploy and storeconfig

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 f17458f83d Add testing for deploy and storeconfig
f17458f83d is described below

commit f17458f83d1dbc4b1134286760aa19c81a54d80e
Author: remm 
AuthorDate: Tue Sep 24 11:16:54 2024 +0200

Add testing for deploy and storeconfig
---
 .../apache/catalina/manager/TestManagerWebapp.java | 210 -
 1 file changed, 200 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 575f933a1f..fceb437d04 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -17,7 +17,10 @@
 package org.apache.catalina.manager;
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -29,9 +32,14 @@ import org.apache.catalina.Context;
 import org.apache.catalina.authenticator.TestBasicAuthParser.BasicAuthHeader;
 import org.apache.catalina.realm.MemoryRealm;
 import org.apache.catalina.realm.MessageDigestCredentialHandler;
+import org.apache.catalina.startup.Catalina;
+import org.apache.catalina.startup.HostConfig;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.storeconfig.StoreConfigLifecycleListener;
+import org.apache.catalina.util.IOTools;
+import org.apache.catalina.util.URLEncoder;
 
 public class TestManagerWebapp extends TomcatBaseTest {
 
@@ -51,6 +59,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 @Test
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
 
 File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
@@ -61,11 +70,11 @@ public class TestManagerWebapp extends TomcatBaseTest {
 MemoryRealm memoryRealm = new MemoryRealm();
 memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
 memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
 File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
-Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
-ctx.setRealm(memoryRealm);
+tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
 
@@ -78,14 +87,6 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-client.setRequest(new String[] {
-"GET /manager/ HTTP/1.1" + CRLF +
-"Host: localhost" + CRLF +
-"Connection: Close" + CRLF + CRLF });
-client.connect();
-client.processRequest(true);
-Assert.assertEquals(HttpServletResponse.SC_FOUND, 
client.getStatusCode());
-
 client.setRequest(new String[] {
 "GET /manager/html HTTP/1.1" + CRLF +
 "Host: localhost" + CRLF +
@@ -196,4 +197,193 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 }
 
+@Test
+public void testDeploy() throws Exception {
+Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
+tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
+
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+try (PrintWriter writer = new PrintWriter(configFile)) {
+writer.write(CONFIG);
+}
+addDeleteOnTearDown(configFile);
+
+MemoryRealm memoryRealm = new MemoryRealm();
+memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
+memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
+
+// Add manager webapp
+File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
+
+// Add host config otherwise there's no JMX deployer bean
+HostConfig hostConfig = new HostConfig();
+ctx.getParent().addLifecycleListener(hostConfig);
+
+tomcat.start();
+
+SimpleHttpClient client = new SimpleHttpClient() {
+@Override
+ 

[Bug 69338] New: Overhead in El processing (AST*)

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69338

Bug ID: 69338
   Summary: Overhead in El processing (AST*)
   Product: Tomcat 9
   Version: 9.0.x
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: EL
  Assignee: dev@tomcat.apache.org
  Reporter: jeng...@amazon.com
  Target Milestone: -

Created attachment 39873
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39873&action=edit
Speed test

I received a report of a minor change to an EL expression causing a latency
penalty and, upon investigation, discovered some ways to simplify the execution
and reduce the effort required to evaluate EL.  I'm not convinced the report
was accurate but these are nevertheless good changes.

The specific change was adding a branch to an if statement, along these lines:





First - the expression "${not empty myNewAttribute}" is turned into five Node
instances: AstCompositeExpression, AstDynamicExpression, AstNot, AstEmpty, and
AstIdentifier. As noted previously, each call to getValue() on each node
triggers a virtual method lookup, so is more expensive than it looks.  Three of
the Nodes also rely on type coercion (AstCompositeExpression, AstNot,
AstEmpty).  Small EL changes such as the report I received can increase this
node depth and therefore noticeably increase the EL processing time. 
Suggestion: create an AstNotEmpty node to handle the frequent case of ${not
empty }.  This will eliminate one Node and only attempt one Boolean
coercion rather than two.

Second - the use of multiple "&&" clauses results in a series of nested AstAnd.
 Each instance adds its own overhead and produces its own Boolean result... and
each parent AstAnd coerces that Boolean into another Boolean.  A
more-than-binary AstAnd would eliminate several layers of Nodes and the
associated coercion.

I've attached the usual standalone perf test, demonstrating a 25% deceleration
when the extra statement is added.  This is linear and therefore expected...
however the test is unusually memory sensitive (I run it with -Xmx3g) so there
may be some kind of effect there.

I expect these changes to reduce the processing time of any EL expression with
2+ "&&" clauses, as well as any expression using "not empty".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 69338] Overhead in El processing (AST*)

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69338

--- Comment #1 from John Engebretson  ---
Created attachment 39874
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39874&action=edit
Support class for the speed test

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Buildbot failure in on tomcat-10.1.x

2024-09-24 Thread buildbot
Build status: BUILD FAILED: failed compile (failure)
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/44/builds/1411
Blamelist: Mark Thomas , remm 
Build Text: failed compile (failure)
Status Detected: new failure
Build Source Stamp: [branch 10.1.x] d4c3260857ac0a3fb4a9ed7ae0165a3c11f55e04


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 2

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



Buildbot success in on tomcat-12.0.x

2024-09-24 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/120/builds/74
Blamelist: Mark Thomas , remm 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch main] d17f24ca548a68c3a7dd7e725d602599398afa2c


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 1

  shell_7: 0

  shell_8: 0

  shell_9: 0

  shell_10: 0

  Rsync docs to nightlies.apache.org: 0

  shell_11: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_12: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



(tomcat) branch main updated: Use the simple realm for testServlets

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 8366de65c6 Use the simple realm for testServlets
8366de65c6 is described below

commit 8366de65c69679a005aa99821c1b184834e6367d
Author: remm 
AuthorDate: Tue Sep 24 15:14:45 2024 +0200

Use the simple realm for testServlets
---
 .../apache/catalina/manager/TestManagerWebapp.java | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 70464f56c2..0efb515f01 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -60,20 +60,14 @@ public class TestManagerWebapp extends TomcatBaseTest {
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
-
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
-try (PrintWriter writer = new PrintWriter(configFile)) {
-writer.write(CONFIG);
-}
-addDeleteOnTearDown(configFile);
-
-MemoryRealm memoryRealm = new MemoryRealm();
-memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
-memoryRealm.setPathname(configFile.getAbsolutePath());
-tomcat.getEngine().setRealm(memoryRealm);
+tomcat.addUser("admin", "sekr3t");
+tomcat.addRole("admin", "manager-gui");
+tomcat.addRole("admin", "manager-script");
+tomcat.addRole("admin", "manager-jmx");
+tomcat.addRole("admin", "manager-status");
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -195,6 +189,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
Assert.assertTrue(client.getResponseBody().contains("/manager:running"));
 
+tomcat.stop();
 }
 
 @Test
@@ -215,7 +210,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -384,6 +379,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.processRequest(true);
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
+tomcat.stop();
 }
 
 }


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



(tomcat) branch main updated: Add some details

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new d17f24ca54 Add some details
d17f24ca54 is described below

commit d17f24ca548a68c3a7dd7e725d602599398afa2c
Author: remm 
AuthorDate: Tue Sep 24 12:55:39 2024 +0200

Add some details
---
 test/org/apache/catalina/startup/LoggingBaseTest.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index bf0ea4038a..893148b7bf 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -135,7 +135,11 @@ public abstract class LoggingBaseTest {
 public void tearDown() throws Exception {
 boolean deleted = true;
 for (File file : deleteOnTearDown) {
-deleted = deleted & ExpandWar.delete(file);
+boolean result = ExpandWar.delete(file);
+if (!result) {
+log.info("Failed to delete [" + file.getAbsolutePath() + "]");
+}
+deleted = deleted & result;
 }
 deleteOnTearDown.clear();
 


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



(tomcat) branch 10.1.x updated: Add some details

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 80967a13e6 Add some details
80967a13e6 is described below

commit 80967a13e6c1cd317a6c3541ca98937c3cda4c34
Author: remm 
AuthorDate: Tue Sep 24 12:55:39 2024 +0200

Add some details
---
 test/org/apache/catalina/startup/LoggingBaseTest.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index bf0ea4038a..893148b7bf 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -135,7 +135,11 @@ public abstract class LoggingBaseTest {
 public void tearDown() throws Exception {
 boolean deleted = true;
 for (File file : deleteOnTearDown) {
-deleted = deleted & ExpandWar.delete(file);
+boolean result = ExpandWar.delete(file);
+if (!result) {
+log.info("Failed to delete [" + file.getAbsolutePath() + "]");
+}
+deleted = deleted & result;
 }
 deleteOnTearDown.clear();
 


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



(tomcat) branch 11.0.x updated: Add some details

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 08d2e57159 Add some details
08d2e57159 is described below

commit 08d2e57159ff58ba1ededee06b08d343dcb9b622
Author: remm 
AuthorDate: Tue Sep 24 12:55:39 2024 +0200

Add some details
---
 test/org/apache/catalina/startup/LoggingBaseTest.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index bf0ea4038a..893148b7bf 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -135,7 +135,11 @@ public abstract class LoggingBaseTest {
 public void tearDown() throws Exception {
 boolean deleted = true;
 for (File file : deleteOnTearDown) {
-deleted = deleted & ExpandWar.delete(file);
+boolean result = ExpandWar.delete(file);
+if (!result) {
+log.info("Failed to delete [" + file.getAbsolutePath() + "]");
+}
+deleted = deleted & result;
 }
 deleteOnTearDown.clear();
 


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



(tomcat) branch 9.0.x updated: Add some details

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 96cdabb9be Add some details
96cdabb9be is described below

commit 96cdabb9be11748f7107253f3eb85b7ff58f0380
Author: remm 
AuthorDate: Tue Sep 24 12:55:39 2024 +0200

Add some details
---
 test/org/apache/catalina/startup/LoggingBaseTest.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index bf0ea4038a..893148b7bf 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -135,7 +135,11 @@ public abstract class LoggingBaseTest {
 public void tearDown() throws Exception {
 boolean deleted = true;
 for (File file : deleteOnTearDown) {
-deleted = deleted & ExpandWar.delete(file);
+boolean result = ExpandWar.delete(file);
+if (!result) {
+log.info("Failed to delete [" + file.getAbsolutePath() + "]");
+}
+deleted = deleted & result;
 }
 deleteOnTearDown.clear();
 


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



[PR] Unit test ensuring that the Expires and Date headers use GMT [tomcat]

2024-09-24 Thread via GitHub


PaulLodge opened a new pull request, #756:
URL: https://github.com/apache/tomcat/pull/756

   This Unit test makes sure that the expires and date headers are consistent 
and both use GMT, as per the bug report 
https://bz.apache.org/bugzilla/show_bug.cgi?id=62476


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



Buildbot success in on tomcat-10.1.x

2024-09-24 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/44/builds/1408
Blamelist: Chenjp , Igal Sapir , Mark Thomas 
, remm 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch 10.1.x] decb2227cb647311165e6f36c895d6b17ca5c3b7


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



(tomcat) branch main updated: Fix BZ 69333 - remove unnecessary code from generated JSPs

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 4e16d8e30d Fix BZ 69333 - remove unnecessary code from generated JSPs
4e16d8e30d is described below

commit 4e16d8e30d2215ca9680edfa29feeaef5e26e91f
Author: Mark Thomas 
AuthorDate: Tue Sep 24 08:54:25 2024 +0100

Fix BZ 69333 - remove unnecessary code from generated JSPs
---
 java/org/apache/jasper/compiler/Generator.java | 39 +++---
 .../apache/jasper/runtime/JspRuntimeLibrary.java   | 10 +-
 2 files changed, 13 insertions(+), 36 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index efbf17588a..f9425d9173 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2144,7 +2144,7 @@ class Generator {
 saveScriptingVars(n, VariableInfo.AT_BEGIN);
 
 String tagHandlerClassName = tagHandlerClass.getCanonicalName();
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
 out.printin(tagHandlerClassName);
 out.print(" ");
 out.print(tagHandlerVar);
@@ -2156,17 +2156,10 @@ class Generator {
 out.print(".get(");
 out.print(tagHandlerClassName);
 out.println(".class);");
-out.printin("boolean ");
-out.print(tagHandlerVar);
-out.println("_reused = false;");
 } else {
 writeNewInstance(tagHandlerVar, tagHandlerClass);
 }
 
-// Wrap use of tag in try/finally to ensure clean-up takes place
-out.printil("try {");
-out.pushIndent();
-
 // includes setting the context
 generateSetters(n, tagHandlerVar, handlerInfo, false);
 
@@ -2353,32 +2346,18 @@ class Generator {
 out.printil("}");
 }
 
-// Print tag reuse
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
+// Print tag reuse
 out.printin(n.getTagHandlerPoolName());
 out.print(".reuse(");
 out.print(tagHandlerVar);
 out.println(");");
-out.printin(tagHandlerVar);
-out.println("_reused = true;");
-}
 
-// Ensure clean-up takes place
-// Use JspRuntimeLibrary to minimise code in _jspService()
-out.popIndent();
-out.printil("} finally {");
-out.pushIndent();
-
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
-out.print(tagHandlerVar);
-out.print(", _jsp_getInstanceManager(), ");
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+// Clean-up
+
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
 out.print(tagHandlerVar);
-out.println("_reused);");
-} else {
-out.println("false);");
+out.println(", _jsp_getInstanceManager());");
 }
-out.popIndent();
-out.printil("}");
 
 // Declare and synchronize AT_END scripting variables (must do this
 // outside the try/catch/finally block)
@@ -2388,6 +2367,12 @@ class Generator {
 restoreScriptingVars(n, VariableInfo.AT_BEGIN);
 }
 
+
+private boolean usePooling(Node.CustomTag n) {
+return isPoolingEnabled && !(n.implementsJspIdConsumer());
+}
+
+
 private void generateCustomDoTag(Node.CustomTag n,
 TagHandlerInfo handlerInfo, String tagHandlerVar)
 throws JasperException {
diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index d705e6cc93..1b6a75fae9 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -1084,15 +1084,7 @@ public class JspRuntimeLibrary {
 }
 
 
-public static void releaseTag(Tag tag, InstanceManager instanceManager, 
boolean reused) {
-// Caller ensures pool is non-null if reuse is true
-if (!reused) {
-releaseTag(tag, instanceManager);
-}
-}
-
-
-protected static void releaseTag(Tag tag, InstanceManager instanceManager) 
{
+public static void releaseTag(Tag tag, InstanceManager instanceManager) {
 try {
 tag.release();
 } catch (Throwable t) {


-
To unsubscribe, e-mail: dev-unsubscr..

(tomcat) branch 10.1.x updated: Avoid backup overwrite if they occur more than once every second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 8a69ea015f Avoid backup overwrite if they occur more than once every 
second
8a69ea015f is described below

commit 8a69ea015fddc21b068f2e194ed247815cd19add
Author: remm 
AuthorDate: Tue Sep 24 09:50:07 2024 +0200

Avoid backup overwrite if they occur more than once every second

This would lose the original file.
---
 java/org/apache/catalina/storeconfig/StoreFileMover.java | 12 
 webapps/docs/changelog.xml   |  4 
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java 
b/java/org/apache/catalina/storeconfig/StoreFileMover.java
index 9e245f5fc0..1e5e5dc775 100644
--- a/java/org/apache/catalina/storeconfig/StoreFileMover.java
+++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java
@@ -150,10 +150,14 @@ public class StoreFileMover {
 }
 }
 String sb = getTimeTag();
-configSave = new File(configFile + sb);
-if (!configSave.isAbsolute()) {
-configSave = new File(getBasename(), configFile + sb);
-}
+int i = 0;
+do {
+configSave = new File(configFile + sb + "-" + String.valueOf(i));
+if (!configSave.isAbsolute()) {
+configSave = new File(getBasename(), configFile + sb + "-" + 
String.valueOf(i));
+}
+i++;
+} while (configSave.exists());
 }
 
 /**
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e765fefb62..a0c40eb70f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -138,6 +138,10 @@
 null if the CallerPrincipalCallback does not
 provide a Principal. (markt)
   
+  
+Avoid store config backup loss when storing one configuration more than
+once per second. (remm)
+  
 
   
   


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



(tomcat) branch 9.0.x updated: Avoid backup overwrite if they occur more than once every second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 a0e377e34f Avoid backup overwrite if they occur more than once every 
second
a0e377e34f is described below

commit a0e377e34fd95a5d1d526131b6a419ed62408baf
Author: remm 
AuthorDate: Tue Sep 24 09:50:07 2024 +0200

Avoid backup overwrite if they occur more than once every second

This would lose the original file.
---
 java/org/apache/catalina/storeconfig/StoreFileMover.java | 12 
 webapps/docs/changelog.xml   |  4 
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java 
b/java/org/apache/catalina/storeconfig/StoreFileMover.java
index 9e245f5fc0..1e5e5dc775 100644
--- a/java/org/apache/catalina/storeconfig/StoreFileMover.java
+++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java
@@ -150,10 +150,14 @@ public class StoreFileMover {
 }
 }
 String sb = getTimeTag();
-configSave = new File(configFile + sb);
-if (!configSave.isAbsolute()) {
-configSave = new File(getBasename(), configFile + sb);
-}
+int i = 0;
+do {
+configSave = new File(configFile + sb + "-" + String.valueOf(i));
+if (!configSave.isAbsolute()) {
+configSave = new File(getBasename(), configFile + sb + "-" + 
String.valueOf(i));
+}
+i++;
+} while (configSave.exists());
 }
 
 /**
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 008f64ce7c..bbc8ca1e61 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,10 @@
 null if the CallerPrincipalCallback does not
 provide a Principal. (markt)
   
+  
+Avoid store config backup loss when storing one configuration more than
+once per second. (remm)
+  
 
   
   


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



(tomcat) branch 11.0.x updated: Fix BZ 69333 - remove unnecessary code from generated JSPs

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new bf9cab350b Fix BZ 69333 - remove unnecessary code from generated JSPs
bf9cab350b is described below

commit bf9cab350b0b12256c17aa7e958109e56bff711d
Author: Mark Thomas 
AuthorDate: Tue Sep 24 08:54:25 2024 +0100

Fix BZ 69333 - remove unnecessary code from generated JSPs
---
 java/org/apache/jasper/compiler/Generator.java | 39 +++---
 .../apache/jasper/runtime/JspRuntimeLibrary.java   | 10 +-
 webapps/docs/changelog.xml |  7 
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index efbf17588a..f9425d9173 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2144,7 +2144,7 @@ class Generator {
 saveScriptingVars(n, VariableInfo.AT_BEGIN);
 
 String tagHandlerClassName = tagHandlerClass.getCanonicalName();
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
 out.printin(tagHandlerClassName);
 out.print(" ");
 out.print(tagHandlerVar);
@@ -2156,17 +2156,10 @@ class Generator {
 out.print(".get(");
 out.print(tagHandlerClassName);
 out.println(".class);");
-out.printin("boolean ");
-out.print(tagHandlerVar);
-out.println("_reused = false;");
 } else {
 writeNewInstance(tagHandlerVar, tagHandlerClass);
 }
 
-// Wrap use of tag in try/finally to ensure clean-up takes place
-out.printil("try {");
-out.pushIndent();
-
 // includes setting the context
 generateSetters(n, tagHandlerVar, handlerInfo, false);
 
@@ -2353,32 +2346,18 @@ class Generator {
 out.printil("}");
 }
 
-// Print tag reuse
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
+// Print tag reuse
 out.printin(n.getTagHandlerPoolName());
 out.print(".reuse(");
 out.print(tagHandlerVar);
 out.println(");");
-out.printin(tagHandlerVar);
-out.println("_reused = true;");
-}
 
-// Ensure clean-up takes place
-// Use JspRuntimeLibrary to minimise code in _jspService()
-out.popIndent();
-out.printil("} finally {");
-out.pushIndent();
-
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
-out.print(tagHandlerVar);
-out.print(", _jsp_getInstanceManager(), ");
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+// Clean-up
+
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
 out.print(tagHandlerVar);
-out.println("_reused);");
-} else {
-out.println("false);");
+out.println(", _jsp_getInstanceManager());");
 }
-out.popIndent();
-out.printil("}");
 
 // Declare and synchronize AT_END scripting variables (must do this
 // outside the try/catch/finally block)
@@ -2388,6 +2367,12 @@ class Generator {
 restoreScriptingVars(n, VariableInfo.AT_BEGIN);
 }
 
+
+private boolean usePooling(Node.CustomTag n) {
+return isPoolingEnabled && !(n.implementsJspIdConsumer());
+}
+
+
 private void generateCustomDoTag(Node.CustomTag n,
 TagHandlerInfo handlerInfo, String tagHandlerVar)
 throws JasperException {
diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index d705e6cc93..1b6a75fae9 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -1084,15 +1084,7 @@ public class JspRuntimeLibrary {
 }
 
 
-public static void releaseTag(Tag tag, InstanceManager instanceManager, 
boolean reused) {
-// Caller ensures pool is non-null if reuse is true
-if (!reused) {
-releaseTag(tag, instanceManager);
-}
-}
-
-
-protected static void releaseTag(Tag tag, InstanceManager instanceManager) 
{
+public static void releaseTag(Tag tag, InstanceManager instanceManager) {
 try {
 tag.release();
 } catch (Throwable t) {
diff --git a/webapps/docs/changelog.xml b/we

(tomcat) branch 10.1.x updated: Fix BZ 69333 - remove unnecessary code from generated JSPs

2024-09-24 Thread markt
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 995625caa2 Fix BZ 69333 - remove unnecessary code from generated JSPs
995625caa2 is described below

commit 995625caa294e5f29b56893db85291d2919d8035
Author: Mark Thomas 
AuthorDate: Tue Sep 24 08:54:25 2024 +0100

Fix BZ 69333 - remove unnecessary code from generated JSPs
---
 java/org/apache/jasper/compiler/Generator.java | 39 +++---
 .../apache/jasper/runtime/JspRuntimeLibrary.java   | 10 +-
 webapps/docs/changelog.xml |  7 
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index addaff3f6b..b3b5da5652 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2163,7 +2163,7 @@ class Generator {
 saveScriptingVars(n, VariableInfo.AT_BEGIN);
 
 String tagHandlerClassName = tagHandlerClass.getCanonicalName();
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
 out.printin(tagHandlerClassName);
 out.print(" ");
 out.print(tagHandlerVar);
@@ -2175,17 +2175,10 @@ class Generator {
 out.print(".get(");
 out.print(tagHandlerClassName);
 out.println(".class);");
-out.printin("boolean ");
-out.print(tagHandlerVar);
-out.println("_reused = false;");
 } else {
 writeNewInstance(tagHandlerVar, tagHandlerClass);
 }
 
-// Wrap use of tag in try/finally to ensure clean-up takes place
-out.printil("try {");
-out.pushIndent();
-
 // includes setting the context
 generateSetters(n, tagHandlerVar, handlerInfo, false);
 
@@ -2372,32 +2365,18 @@ class Generator {
 out.printil("}");
 }
 
-// Print tag reuse
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
+// Print tag reuse
 out.printin(n.getTagHandlerPoolName());
 out.print(".reuse(");
 out.print(tagHandlerVar);
 out.println(");");
-out.printin(tagHandlerVar);
-out.println("_reused = true;");
-}
 
-// Ensure clean-up takes place
-// Use JspRuntimeLibrary to minimise code in _jspService()
-out.popIndent();
-out.printil("} finally {");
-out.pushIndent();
-
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
-out.print(tagHandlerVar);
-out.print(", _jsp_getInstanceManager(), ");
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+// Clean-up
+
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
 out.print(tagHandlerVar);
-out.println("_reused);");
-} else {
-out.println("false);");
+out.println(", _jsp_getInstanceManager());");
 }
-out.popIndent();
-out.printil("}");
 
 // Declare and synchronize AT_END scripting variables (must do this
 // outside the try/catch/finally block)
@@ -2407,6 +2386,12 @@ class Generator {
 restoreScriptingVars(n, VariableInfo.AT_BEGIN);
 }
 
+
+private boolean usePooling(Node.CustomTag n) {
+return isPoolingEnabled && !(n.implementsJspIdConsumer());
+}
+
+
 private void generateCustomDoTag(Node.CustomTag n,
 TagHandlerInfo handlerInfo, String tagHandlerVar)
 throws JasperException {
diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index d705e6cc93..1b6a75fae9 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -1084,15 +1084,7 @@ public class JspRuntimeLibrary {
 }
 
 
-public static void releaseTag(Tag tag, InstanceManager instanceManager, 
boolean reused) {
-// Caller ensures pool is non-null if reuse is true
-if (!reused) {
-releaseTag(tag, instanceManager);
-}
-}
-
-
-protected static void releaseTag(Tag tag, InstanceManager instanceManager) 
{
+public static void releaseTag(Tag tag, InstanceManager instanceManager) {
 try {
 tag.release();
 } catch (Throwable t) {
diff --git a/webapps/docs/changelog.xml b/we

(tomcat) branch 9.0.x updated: Fix BZ 69333 - remove unnecessary code from generated JSPs

2024-09-24 Thread markt
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 397ea8b746 Fix BZ 69333 - remove unnecessary code from generated JSPs
397ea8b746 is described below

commit 397ea8b7461bdeaad8b7f005fca3cdd31df4be2a
Author: Mark Thomas 
AuthorDate: Tue Sep 24 08:54:25 2024 +0100

Fix BZ 69333 - remove unnecessary code from generated JSPs
---
 java/org/apache/jasper/compiler/Generator.java | 39 +++---
 .../apache/jasper/runtime/JspRuntimeLibrary.java   | 10 +-
 webapps/docs/changelog.xml |  7 
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 6264782134..814c8bb9fe 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2395,7 +2395,7 @@ class Generator {
 saveScriptingVars(n, VariableInfo.AT_BEGIN);
 
 String tagHandlerClassName = tagHandlerClass.getCanonicalName();
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
 out.printin(tagHandlerClassName);
 out.print(" ");
 out.print(tagHandlerVar);
@@ -2407,17 +2407,10 @@ class Generator {
 out.print(".get(");
 out.print(tagHandlerClassName);
 out.println(".class);");
-out.printin("boolean ");
-out.print(tagHandlerVar);
-out.println("_reused = false;");
 } else {
 writeNewInstance(tagHandlerVar, tagHandlerClass);
 }
 
-// Wrap use of tag in try/finally to ensure clean-up takes place
-out.printil("try {");
-out.pushIndent();
-
 // includes setting the context
 generateSetters(n, tagHandlerVar, handlerInfo, false);
 
@@ -2604,32 +2597,18 @@ class Generator {
 out.printil("}");
 }
 
-// Print tag reuse
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+if (usePooling(n)) {
+// Print tag reuse
 out.printin(n.getTagHandlerPoolName());
 out.print(".reuse(");
 out.print(tagHandlerVar);
 out.println(");");
-out.printin(tagHandlerVar);
-out.println("_reused = true;");
-}
 
-// Ensure clean-up takes place
-// Use JspRuntimeLibrary to minimise code in _jspService()
-out.popIndent();
-out.printil("} finally {");
-out.pushIndent();
-
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
-out.print(tagHandlerVar);
-out.print(", _jsp_getInstanceManager(), ");
-if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+// Clean-up
+
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
 out.print(tagHandlerVar);
-out.println("_reused);");
-} else {
-out.println("false);");
+out.println(", _jsp_getInstanceManager());");
 }
-out.popIndent();
-out.printil("}");
 
 // Declare and synchronize AT_END scripting variables (must do this
 // outside the try/catch/finally block)
@@ -2639,6 +2618,12 @@ class Generator {
 restoreScriptingVars(n, VariableInfo.AT_BEGIN);
 }
 
+
+private boolean usePooling(Node.CustomTag n) {
+return isPoolingEnabled && !(n.implementsJspIdConsumer());
+}
+
+
 private void generateCustomDoTag(Node.CustomTag n,
 TagHandlerInfo handlerInfo, String tagHandlerVar)
 throws JasperException {
diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index 5c674eee4f..d9db53cea3 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -1084,15 +1084,7 @@ public class JspRuntimeLibrary {
 }
 
 
-public static void releaseTag(Tag tag, InstanceManager instanceManager, 
boolean reused) {
-// Caller ensures pool is non-null if reuse is true
-if (!reused) {
-releaseTag(tag, instanceManager);
-}
-}
-
-
-protected static void releaseTag(Tag tag, InstanceManager instanceManager) 
{
+public static void releaseTag(Tag tag, InstanceManager instanceManager) {
 try {
 tag.release();
 } catch (Throwable t) {
diff --git a/webapps/docs/changelog.xml b/weba

(tomcat) branch 11.0.x updated: Avoid backup overwrite if they occur more than once every second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new d30fe62911 Avoid backup overwrite if they occur more than once every 
second
d30fe62911 is described below

commit d30fe629110a03bc2614fb9acf28850910c3850f
Author: remm 
AuthorDate: Tue Sep 24 09:50:07 2024 +0200

Avoid backup overwrite if they occur more than once every second

This would lose the original file.
---
 java/org/apache/catalina/storeconfig/StoreFileMover.java | 12 
 webapps/docs/changelog.xml   |  4 
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java 
b/java/org/apache/catalina/storeconfig/StoreFileMover.java
index 9e245f5fc0..1e5e5dc775 100644
--- a/java/org/apache/catalina/storeconfig/StoreFileMover.java
+++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java
@@ -150,10 +150,14 @@ public class StoreFileMover {
 }
 }
 String sb = getTimeTag();
-configSave = new File(configFile + sb);
-if (!configSave.isAbsolute()) {
-configSave = new File(getBasename(), configFile + sb);
-}
+int i = 0;
+do {
+configSave = new File(configFile + sb + "-" + String.valueOf(i));
+if (!configSave.isAbsolute()) {
+configSave = new File(getBasename(), configFile + sb + "-" + 
String.valueOf(i));
+}
+i++;
+} while (configSave.exists());
 }
 
 /**
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2f12a45e50..eb16032d03 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -138,6 +138,10 @@
 null if the CallerPrincipalCallback does not
 provide a Principal. (markt)
   
+  
+Avoid store config backup loss when storing one configuration more than
+once per second. (remm)
+  
 
   
   


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



[Bug 69333] Unnecessary code in generated JSPs

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69333

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #8 from Mark Thomas  ---
Fixed in:
- 11.0.x for 11.0.0 onwards
- 10.1.x for 10.1.31 onwards
-  9.0.x for  9.0.96 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Buildbot success in on tomcat-11.0.x

2024-09-24 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/112/builds/1289
Blamelist: Igal Sapir , Mark Thomas , remm 

Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch 11.0.x] d82b94b82d3cabbe58e4392139b12f94784b847a


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 1

  shell_7: 0

  shell_8: 0

  shell_9: 0

  shell_10: 0

  Rsync docs to nightlies.apache.org: 0

  shell_11: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_12: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



(tomcat) branch 11.0.x updated: Re-work test to make it more reliable

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 2fcc30b5d9 Re-work test to make it more reliable
2fcc30b5d9 is described below

commit 2fcc30b5d915146708f3f0fc82b380207bace9c7
Author: Mark Thomas 
AuthorDate: Tue Sep 24 09:58:18 2024 +0100

Re-work test to make it more reliable
---
 .../tomcat/util/http/TestFastHttpDateFormat.java   | 80 --
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java 
b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
index fca12e21b6..e50a60cc9f 100644
--- a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
+++ b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
@@ -22,44 +22,52 @@ import org.junit.Test;
 public class TestFastHttpDateFormat {
 
 @Test
-public void testGetCurrentDateInSameSecond() {
-long now = System.currentTimeMillis();
-try {
-Thread.sleep(1000L - now % 1000);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long lastMillisInSameSecond = now - now % 1000 + 900L;
-try {
-Thread.sleep(lastMillisInSameSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertEquals("Two same RFC5322 format dates are expected.", s1, 
s2);
-}
+public void testGetCurrentDate() {
+/*
+ * Run three iterations of the test. The runs are offset by 1300 
seconds to ensure that FastHttpDateFormat is
+ * using a 1s window aligned with the start of a second.
+ */
+for (int i = 0; i < 3; i++) {
+if (i > 0) {
+try {
+Thread.sleep(1300);
+} catch (InterruptedException e) {
+Assert.fail("InterruptedException observed");
+}
+}
+String d1 = FastHttpDateFormat.getCurrentDate();
+long start = System.currentTimeMillis() / 1000;
 
-@Test
-public void testGetCurrentDateNextToAnotherSecond() {
-long now = System.currentTimeMillis();
+long t1 = 0;
+long t2 = 0;
+long t3 = start;
+String d2 = d1;
 
-try {
-Thread.sleep(2000L - now % 1000 + 500L);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long firstMillisOfNextSecond = now - now % 1000 + 1100L;
-try {
-Thread.sleep(firstMillisOfNextSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
+/*
+ * Run this test for 3s. Should normally see 3 changes of date. 
May, very rarely, see 2.
+ */
+int changes = 0;
+while (t3 - start < 3) {
+
+// Copy results to next slot, dropping the oldest (t3 and d2)
+d2 = d1;
+t3 = t2;
+t2 = t1;
 
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertFalse("Two different RFC5322 format dates are expected.", 
s1.equals(s2));
+// Get current results. The date must be obtained before the 
current time.
+d1 = FastHttpDateFormat.getCurrentDate();
+t1 = System.currentTimeMillis() / 1000;
+
+// Has the formatted date changed
+if (!d2.equals(d1)) {
+changes++;
+// Then the second must have changed
+if (t1 == t2 && t2 == t3) {
+Assert.fail("Formatted date changed withint the same 
second");
+}
+}
+}
+Assert.assertTrue("Saw [" + changes + "] in formatted date", 
changes > 1 && changes < 4);
+}
 }
 }


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



(tomcat) branch 10.1.x updated: Re-work test to make it more reliable

2024-09-24 Thread markt
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 decb2227cb Re-work test to make it more reliable
decb2227cb is described below

commit decb2227cb647311165e6f36c895d6b17ca5c3b7
Author: Mark Thomas 
AuthorDate: Tue Sep 24 09:58:18 2024 +0100

Re-work test to make it more reliable
---
 .../tomcat/util/http/TestFastHttpDateFormat.java   | 80 --
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java 
b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
index fca12e21b6..e50a60cc9f 100644
--- a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
+++ b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
@@ -22,44 +22,52 @@ import org.junit.Test;
 public class TestFastHttpDateFormat {
 
 @Test
-public void testGetCurrentDateInSameSecond() {
-long now = System.currentTimeMillis();
-try {
-Thread.sleep(1000L - now % 1000);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long lastMillisInSameSecond = now - now % 1000 + 900L;
-try {
-Thread.sleep(lastMillisInSameSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertEquals("Two same RFC5322 format dates are expected.", s1, 
s2);
-}
+public void testGetCurrentDate() {
+/*
+ * Run three iterations of the test. The runs are offset by 1300 
seconds to ensure that FastHttpDateFormat is
+ * using a 1s window aligned with the start of a second.
+ */
+for (int i = 0; i < 3; i++) {
+if (i > 0) {
+try {
+Thread.sleep(1300);
+} catch (InterruptedException e) {
+Assert.fail("InterruptedException observed");
+}
+}
+String d1 = FastHttpDateFormat.getCurrentDate();
+long start = System.currentTimeMillis() / 1000;
 
-@Test
-public void testGetCurrentDateNextToAnotherSecond() {
-long now = System.currentTimeMillis();
+long t1 = 0;
+long t2 = 0;
+long t3 = start;
+String d2 = d1;
 
-try {
-Thread.sleep(2000L - now % 1000 + 500L);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long firstMillisOfNextSecond = now - now % 1000 + 1100L;
-try {
-Thread.sleep(firstMillisOfNextSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
+/*
+ * Run this test for 3s. Should normally see 3 changes of date. 
May, very rarely, see 2.
+ */
+int changes = 0;
+while (t3 - start < 3) {
+
+// Copy results to next slot, dropping the oldest (t3 and d2)
+d2 = d1;
+t3 = t2;
+t2 = t1;
 
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertFalse("Two different RFC5322 format dates are expected.", 
s1.equals(s2));
+// Get current results. The date must be obtained before the 
current time.
+d1 = FastHttpDateFormat.getCurrentDate();
+t1 = System.currentTimeMillis() / 1000;
+
+// Has the formatted date changed
+if (!d2.equals(d1)) {
+changes++;
+// Then the second must have changed
+if (t1 == t2 && t2 == t3) {
+Assert.fail("Formatted date changed withint the same 
second");
+}
+}
+}
+Assert.assertTrue("Saw [" + changes + "] in formatted date", 
changes > 1 && changes < 4);
+}
 }
 }


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



(tomcat) branch 9.0.x updated: Re-work test to make it more reliable

2024-09-24 Thread markt
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 12529b5336 Re-work test to make it more reliable
12529b5336 is described below

commit 12529b533604c11d5d013aa2b23da21a2fd636b7
Author: Mark Thomas 
AuthorDate: Tue Sep 24 09:58:18 2024 +0100

Re-work test to make it more reliable
---
 .../tomcat/util/http/TestFastHttpDateFormat.java   | 80 --
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java 
b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
index fca12e21b6..e50a60cc9f 100644
--- a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
+++ b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
@@ -22,44 +22,52 @@ import org.junit.Test;
 public class TestFastHttpDateFormat {
 
 @Test
-public void testGetCurrentDateInSameSecond() {
-long now = System.currentTimeMillis();
-try {
-Thread.sleep(1000L - now % 1000);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long lastMillisInSameSecond = now - now % 1000 + 900L;
-try {
-Thread.sleep(lastMillisInSameSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertEquals("Two same RFC5322 format dates are expected.", s1, 
s2);
-}
+public void testGetCurrentDate() {
+/*
+ * Run three iterations of the test. The runs are offset by 1300 
seconds to ensure that FastHttpDateFormat is
+ * using a 1s window aligned with the start of a second.
+ */
+for (int i = 0; i < 3; i++) {
+if (i > 0) {
+try {
+Thread.sleep(1300);
+} catch (InterruptedException e) {
+Assert.fail("InterruptedException observed");
+}
+}
+String d1 = FastHttpDateFormat.getCurrentDate();
+long start = System.currentTimeMillis() / 1000;
 
-@Test
-public void testGetCurrentDateNextToAnotherSecond() {
-long now = System.currentTimeMillis();
+long t1 = 0;
+long t2 = 0;
+long t3 = start;
+String d2 = d1;
 
-try {
-Thread.sleep(2000L - now % 1000 + 500L);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long firstMillisOfNextSecond = now - now % 1000 + 1100L;
-try {
-Thread.sleep(firstMillisOfNextSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
+/*
+ * Run this test for 3s. Should normally see 3 changes of date. 
May, very rarely, see 2.
+ */
+int changes = 0;
+while (t3 - start < 3) {
+
+// Copy results to next slot, dropping the oldest (t3 and d2)
+d2 = d1;
+t3 = t2;
+t2 = t1;
 
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertFalse("Two different RFC5322 format dates are expected.", 
s1.equals(s2));
+// Get current results. The date must be obtained before the 
current time.
+d1 = FastHttpDateFormat.getCurrentDate();
+t1 = System.currentTimeMillis() / 1000;
+
+// Has the formatted date changed
+if (!d2.equals(d1)) {
+changes++;
+// Then the second must have changed
+if (t1 == t2 && t2 == t3) {
+Assert.fail("Formatted date changed withint the same 
second");
+}
+}
+}
+Assert.assertTrue("Saw [" + changes + "] in formatted date", 
changes > 1 && changes < 4);
+}
 }
 }


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



(tomcat) branch main updated: Re-work test to make it more reliable

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 7e4fee2725 Re-work test to make it more reliable
7e4fee2725 is described below

commit 7e4fee2725c3069550bd89bf1a7a0b5eecb01109
Author: Mark Thomas 
AuthorDate: Tue Sep 24 09:58:18 2024 +0100

Re-work test to make it more reliable
---
 .../tomcat/util/http/TestFastHttpDateFormat.java   | 80 --
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java 
b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
index fca12e21b6..e50a60cc9f 100644
--- a/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
+++ b/test/org/apache/tomcat/util/http/TestFastHttpDateFormat.java
@@ -22,44 +22,52 @@ import org.junit.Test;
 public class TestFastHttpDateFormat {
 
 @Test
-public void testGetCurrentDateInSameSecond() {
-long now = System.currentTimeMillis();
-try {
-Thread.sleep(1000L - now % 1000);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long lastMillisInSameSecond = now - now % 1000 + 900L;
-try {
-Thread.sleep(lastMillisInSameSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertEquals("Two same RFC5322 format dates are expected.", s1, 
s2);
-}
+public void testGetCurrentDate() {
+/*
+ * Run three iterations of the test. The runs are offset by 1300 
seconds to ensure that FastHttpDateFormat is
+ * using a 1s window aligned with the start of a second.
+ */
+for (int i = 0; i < 3; i++) {
+if (i > 0) {
+try {
+Thread.sleep(1300);
+} catch (InterruptedException e) {
+Assert.fail("InterruptedException observed");
+}
+}
+String d1 = FastHttpDateFormat.getCurrentDate();
+long start = System.currentTimeMillis() / 1000;
 
-@Test
-public void testGetCurrentDateNextToAnotherSecond() {
-long now = System.currentTimeMillis();
+long t1 = 0;
+long t2 = 0;
+long t3 = start;
+String d2 = d1;
 
-try {
-Thread.sleep(2000L - now % 1000 + 500L);
-} catch (InterruptedException e) {
-// Ignore
-}
-now = System.currentTimeMillis();
-String s1 = FastHttpDateFormat.getCurrentDate();
-long firstMillisOfNextSecond = now - now % 1000 + 1100L;
-try {
-Thread.sleep(firstMillisOfNextSecond - now);
-} catch (InterruptedException e) {
-// Ignore
-}
+/*
+ * Run this test for 3s. Should normally see 3 changes of date. 
May, very rarely, see 2.
+ */
+int changes = 0;
+while (t3 - start < 3) {
+
+// Copy results to next slot, dropping the oldest (t3 and d2)
+d2 = d1;
+t3 = t2;
+t2 = t1;
 
-String s2 = FastHttpDateFormat.getCurrentDate();
-Assert.assertFalse("Two different RFC5322 format dates are expected.", 
s1.equals(s2));
+// Get current results. The date must be obtained before the 
current time.
+d1 = FastHttpDateFormat.getCurrentDate();
+t1 = System.currentTimeMillis() / 1000;
+
+// Has the formatted date changed
+if (!d2.equals(d1)) {
+changes++;
+// Then the second must have changed
+if (t1 == t2 && t2 == t3) {
+Assert.fail("Formatted date changed withint the same 
second");
+}
+}
+}
+Assert.assertTrue("Saw [" + changes + "] in formatted date", 
changes > 1 && changes < 4);
+}
 }
 }


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



Buildbot success in on tomcat-12.0.x

2024-09-24 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/120/builds/71
Blamelist: Chenjp , Igal Sapir , Mark Thomas 
, remm 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch main] 4e16d8e30d2215ca9680edfa29feeaef5e26e91f


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 1

  shell_7: 0

  shell_8: 0

  shell_9: 0

  shell_10: 0

  Rsync docs to nightlies.apache.org: 0

  shell_11: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_12: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



Buildbot failure in on tomcat-12.0.x

2024-09-24 Thread buildbot
Build status: BUILD FAILED: failed Snapshot deployed to ASF Maven snapshot 
repository (failure)
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/120/builds/72
Blamelist: Mark Thomas 
Build Text: failed Snapshot deployed to ASF Maven snapshot repository (failure)
Status Detected: new failure
Build Source Stamp: [branch main] 7e4fee2725c3069550bd89bf1a7a0b5eecb01109


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 1

  shell_7: 0

  shell_8: 0

  shell_9: 2


-- ASF Buildbot


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



[Bug 69339] New: ClassFormatException in Java11 while compiling JSP pages

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69339

Bug ID: 69339
   Summary: ClassFormatException in Java11 while compiling JSP
pages
   Product: Tomcat 9
   Version: 9.0.89
  Hardware: All
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: datti.prudvi...@gmail.com
  Target Milestone: -

There is prey weird behaviour that we are observing. When we import a class in
JSP that does not have any string + operations, it is working fine. But when
the imported class contains these operations, it is failing. For example:


Working class files:

public class App {
public string getName(){
String name = "test**";
return name;
}
}
public class App {
public string getName(){
String name = "test**";
return "test".concat(name);
}
}

Non-working class file:

public class App {
public string getName(){
String name = "test**";
return name + "fail";
}
}


Stacktrace:
MESSAGE:Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.(ClassFileReader.java:298)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:197)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:169)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:119)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:415)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:469)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:333)[44:org.apache.jasper:5.5.17.v200706111724]
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:402)[44:org.apache.jasper:5.5.17.v200706111724]

OSGI based application
Java: Java 11.0.24 (tried with Java 11.0.18 as well)
Tomcat 9.0.89 using ecj-4.20.jar

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 69339] ClassFormatException in Java11 while compiling JSP pages

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69339

--- Comment #1 from Prudviraj  ---
Unable to replicate the issue local setup. Our application is deployed in RHEL
8.9.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



(tomcat) branch 11.0.x updated: Use the simple realm for testServlets

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 712f21da4d Use the simple realm for testServlets
712f21da4d is described below

commit 712f21da4de3e6ead857d479a6d6a017fc1fb0de
Author: remm 
AuthorDate: Tue Sep 24 15:14:45 2024 +0200

Use the simple realm for testServlets
---
 .../apache/catalina/manager/TestManagerWebapp.java | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 70464f56c2..0efb515f01 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -60,20 +60,14 @@ public class TestManagerWebapp extends TomcatBaseTest {
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
-
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
-try (PrintWriter writer = new PrintWriter(configFile)) {
-writer.write(CONFIG);
-}
-addDeleteOnTearDown(configFile);
-
-MemoryRealm memoryRealm = new MemoryRealm();
-memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
-memoryRealm.setPathname(configFile.getAbsolutePath());
-tomcat.getEngine().setRealm(memoryRealm);
+tomcat.addUser("admin", "sekr3t");
+tomcat.addRole("admin", "manager-gui");
+tomcat.addRole("admin", "manager-script");
+tomcat.addRole("admin", "manager-jmx");
+tomcat.addRole("admin", "manager-status");
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -195,6 +189,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
Assert.assertTrue(client.getResponseBody().contains("/manager:running"));
 
+tomcat.stop();
 }
 
 @Test
@@ -215,7 +210,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -384,6 +379,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.processRequest(true);
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
+tomcat.stop();
 }
 
 }


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



(tomcat) branch 9.0.x updated: Use the simple realm for testServlets

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 39da7e47d9 Use the simple realm for testServlets
39da7e47d9 is described below

commit 39da7e47d9b5352cf1f74e755e0d6359b99a4d6a
Author: remm 
AuthorDate: Tue Sep 24 15:14:45 2024 +0200

Use the simple realm for testServlets
---
 .../apache/catalina/manager/TestManagerWebapp.java | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index fceb437d04..23686d8a86 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -60,20 +60,14 @@ public class TestManagerWebapp extends TomcatBaseTest {
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
-
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
-try (PrintWriter writer = new PrintWriter(configFile)) {
-writer.write(CONFIG);
-}
-addDeleteOnTearDown(configFile);
-
-MemoryRealm memoryRealm = new MemoryRealm();
-memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
-memoryRealm.setPathname(configFile.getAbsolutePath());
-tomcat.getEngine().setRealm(memoryRealm);
+tomcat.addUser("admin", "sekr3t");
+tomcat.addRole("admin", "manager-gui");
+tomcat.addRole("admin", "manager-script");
+tomcat.addRole("admin", "manager-jmx");
+tomcat.addRole("admin", "manager-status");
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -195,6 +189,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
Assert.assertTrue(client.getResponseBody().contains("/manager:running"));
 
+tomcat.stop();
 }
 
 @Test
@@ -215,7 +210,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -384,6 +379,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.processRequest(true);
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
+tomcat.stop();
 }
 
 }


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



(tomcat) branch 10.1.x updated: Use the simple realm for testServlets

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 466770ff12 Use the simple realm for testServlets
466770ff12 is described below

commit 466770ff12fa9f659eeeb3212205d429e102247c
Author: remm 
AuthorDate: Tue Sep 24 15:14:45 2024 +0200

Use the simple realm for testServlets
---
 .../apache/catalina/manager/TestManagerWebapp.java | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 70464f56c2..0efb515f01 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -60,20 +60,14 @@ public class TestManagerWebapp extends TomcatBaseTest {
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
-
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
-try (PrintWriter writer = new PrintWriter(configFile)) {
-writer.write(CONFIG);
-}
-addDeleteOnTearDown(configFile);
-
-MemoryRealm memoryRealm = new MemoryRealm();
-memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
-memoryRealm.setPathname(configFile.getAbsolutePath());
-tomcat.getEngine().setRealm(memoryRealm);
+tomcat.addUser("admin", "sekr3t");
+tomcat.addRole("admin", "manager-gui");
+tomcat.addRole("admin", "manager-script");
+tomcat.addRole("admin", "manager-jmx");
+tomcat.addRole("admin", "manager-status");
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -195,6 +189,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
Assert.assertTrue(client.getResponseBody().contains("/manager:running"));
 
+tomcat.stop();
 }
 
 @Test
@@ -215,7 +210,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
-File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+File appDir = new File(getBuildDirectory(), "webapps/manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -384,6 +379,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.processRequest(true);
 Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode());
 
+tomcat.stop();
 }
 
 }


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



Buildbot success in on tomcat-9.0.x

2024-09-24 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/37/builds/1092
Blamelist: Chenjp , Igal Sapir , Mark Thomas 
, remm 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch 9.0.x] 96cdabb9be11748f7107253f3eb85b7ff58f0380


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



(tomcat) 01/02: Workaround Windows locking issue

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit cd0594baea0d5d2ceec15d9ebc3752aa631b1a99
Author: remm 
AuthorDate: Tue Sep 24 16:32:14 2024 +0200

Workaround Windows locking issue

Manager deploy locking seems a bit difficult to avoid.
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 14 ++
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 23686d8a86..8a36003017 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -66,8 +66,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.addRole("admin", "manager-jmx");
 tomcat.addRole("admin", "manager-status");
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -194,11 +196,13 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 @Test
 public void testDeploy() throws Exception {
+// Avoid possible locking failure due to deployment with the manager
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
 
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-deploy.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
 writer.write(CONFIG);
 }
@@ -209,8 +213,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 memoryRealm.setPathname(configFile.getAbsolutePath());
 tomcat.getEngine().setRealm(memoryRealm);
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -228,7 +234,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/examples");
+appDir = new File(webappDir, "examples");
 
 client.setRequest(new String[] {
 "GET /manager/text/deploy?war=" + 
URLEncoder.QUERY.encode(appDir.getAbsolutePath(), StandardCharsets.UTF_8) + " 
HTTP/1.1" + CRLF +
diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index 893148b7bf..200978c92f 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -59,6 +59,8 @@ public abstract class LoggingBaseTest {
 
 private List deleteOnTearDown = new ArrayList<>();
 
+protected boolean ignoreTearDown = false;
+
 /**
  * Provides name of the currently executing test method.
  */
@@ -143,7 +145,7 @@ public abstract class LoggingBaseTest {
 }
 deleteOnTearDown.clear();
 
-Assert.assertTrue("Failed to delete at least one file", deleted);
+Assert.assertTrue("Failed to delete at least one file", ignoreTearDown 
|| deleted);
 }
 
 @AfterClass


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



(tomcat) 01/02: Workaround Windows locking issue

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit 1867d8e7fe0e0bc9c6401fe1b626676e49df9e41
Author: remm 
AuthorDate: Tue Sep 24 16:32:14 2024 +0200

Workaround Windows locking issue

Manager deploy locking seems a bit difficult to avoid.
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 14 ++
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 0efb515f01..dbe8c45b8f 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -66,8 +66,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 tomcat.addRole("admin", "manager-jmx");
 tomcat.addRole("admin", "manager-status");
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
@@ -194,11 +196,13 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 @Test
 public void testDeploy() throws Exception {
+// Avoid possible locking failure due to deployment with the manager
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
 
-File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-deploy.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
 writer.write(CONFIG);
 }
@@ -209,8 +213,10 @@ public class TestManagerWebapp extends TomcatBaseTest {
 memoryRealm.setPathname(configFile.getAbsolutePath());
 tomcat.getEngine().setRealm(memoryRealm);
 
+File webappDir = new File(getBuildDirectory(), "webapps");
+
 // Add manager webapp
-File appDir = new File(getBuildDirectory(), "webapps/manager");
+File appDir = new File(webappDir, "manager");
 Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
 
 // Add host config otherwise there's no JMX deployer bean
@@ -228,7 +234,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/examples");
+appDir = new File(webappDir, "examples");
 
 client.setRequest(new String[] {
 "GET /manager/text/deploy?war=" + 
URLEncoder.QUERY.encode(appDir.getAbsolutePath(), StandardCharsets.UTF_8) + " 
HTTP/1.1" + CRLF +
diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java 
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index 893148b7bf..200978c92f 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -59,6 +59,8 @@ public abstract class LoggingBaseTest {
 
 private List deleteOnTearDown = new ArrayList<>();
 
+protected boolean ignoreTearDown = false;
+
 /**
  * Provides name of the currently executing test method.
  */
@@ -143,7 +145,7 @@ public abstract class LoggingBaseTest {
 }
 deleteOnTearDown.clear();
 
-Assert.assertTrue("Failed to delete at least one file", deleted);
+Assert.assertTrue("Failed to delete at least one file", ignoreTearDown 
|| deleted);
 }
 
 @AfterClass


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



(tomcat) 02/02: testServlets may run second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit d4c3260857ac0a3fb4a9ed7ae0165a3c11f55e04
Author: remm 
AuthorDate: Tue Sep 24 16:54:19 2024 +0200

testServlets may run second
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index dbe8c45b8f..adecc38f76 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -58,6 +58,8 @@ public class TestManagerWebapp extends TomcatBaseTest {
  */
 @Test
 public void testServlets() throws Exception {
+// Avoid possible locking failure due to deployment with the manager 
in testDeploy
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.addUser("admin", "sekr3t");


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



(tomcat) 02/02: testServlets may run second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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

commit 3052417b0952774d67525653251d0af1e7391d52
Author: remm 
AuthorDate: Tue Sep 24 16:54:19 2024 +0200

testServlets may run second
---
 test/org/apache/catalina/manager/TestManagerWebapp.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 8a36003017..ccbff6f58e 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -58,6 +58,8 @@ public class TestManagerWebapp extends TomcatBaseTest {
  */
 @Test
 public void testServlets() throws Exception {
+// Avoid possible locking failure due to deployment with the manager 
in testDeploy
+ignoreTearDown = true;
 Tomcat tomcat = getTomcatInstance();
 tomcat.setAddDefaultWebXmlToWebapp(false);
 tomcat.addUser("admin", "sekr3t");


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



(tomcat) branch 10.1.x updated (9ffba57778 -> d4c3260857)

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


from 9ffba57778 Correctly record request start time
 new 1867d8e7fe Workaround Windows locking issue
 new d4c3260857 testServlets may run second

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 test/org/apache/catalina/manager/TestManagerWebapp.java | 16 
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 15 insertions(+), 5 deletions(-)


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



(tomcat) branch 9.0.x updated (39da7e47d9 -> 3052417b09)

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


from 39da7e47d9 Use the simple realm for testServlets
 new cd0594baea Workaround Windows locking issue
 new 3052417b09 testServlets may run second

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 test/org/apache/catalina/manager/TestManagerWebapp.java | 16 
 test/org/apache/catalina/startup/LoggingBaseTest.java   |  4 +++-
 2 files changed, 15 insertions(+), 5 deletions(-)


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



Re: Coyote Request getRequestId()

2024-09-24 Thread Igal Sapir
Mark,


> On Mon, Sep 23, 2024 at 12:25 AM Mark Thomas  wrote:
>
>> On 23/09/2024 04:28, Igal Sapir wrote:
>> > Hello,
>> >
>> > The current implementation of getRequestId() is optimized for speed and
>> > generates IDs that are unique to a running instance of Tomcat.
>> >
>> > But most server configurations nowadays require uniqueness across the
>> whole
>> > system, and currently we do not offer that as:
>> >
>> > 1. Request IDs are only unique to a running Tomcat instance
>> >
>> > 2. Request IDs are reset to 0 each time Tomcat is restarted
>> >
>> > 3. Request IDs are sometimes generated by another system like a load
>> > balancer or reverse proxy, and passed around via the HTTP header
>> > "X-Request-Id"
>> >
>> > I want to propose a patch that would:
>> >
>> > 1. Check for HTTP header "X-Request-Id" and if valid (e.g. does not
>> attempt
>> > SQL or XSS injection etc.) returns it
>>
>>
>> That is behaviour we'd typically place in a Valve or Filter. Possibly an
>> extension to the RemoteIp[Valve|Filter] ?
>>
>> Rather than us validate it, I'd make processing it optional and the
>> admins responsibility to ensure it is trusted if they opt to process it.
>>
>
Yes, that makes sense.  I can add that part to the RemoteIp[Valve|Filter]
as long as we can add a Setter for requestId that can be called from the
filter/valve.


>
>> > 2. Generates a URL-safe Base64-encoded UUID (22 CaSe sensitive
>> characters)
>>
>> How expensive is that process compared to the existing mechanism?
>>
>
I will run some benchmarks to find out.  While it would almost certainly be
more expensive than AtomicLong.incrementAndGet(), I would think that the
value that it adds can be acceptable up to some arbitrary threshold of
per-request overhead, e.g. 1ms is too much but 50us might be acceptable.

We could also make it lazy-init so that it is only processed when
getRequestId() is called the first time per Request (though I would want it
in the Logs so every request would trigger it in that case), and possibly
and opt-in and pluggable implementation according to the next point below.


>
>>
>> > The value will be set to the requestId private variable to ensure
>> > consistent return value for multiple calls on the same Request.
>> >
>> > I have the code ready, but wanted to discuss the matter here first.
>>
>> The Servlet spec requires only that the ID is unique for the lifetime of
>> the container.
>>
>> How will this interact with ServletRequest.getRequestId() and the
>> associated methods?
>>
>
My idea is that ServletRequest.getRequestId() would still delegate calls to
Coyote's getRequestId(), so the new implementation would be used for it.


>
>> Should we make the request ID generator a pluggable component? If so, of
>> what?
>>
>
That would be great as it would allow us to keep the current behavior as
default, for example, make this enhancement opt-in, and allow for future
implementations e.g. UUIDv7 which allows for natural order sorting.

Which component is a great question.  On one hand I'm thinking that Coyote
is part of the Connectors, but on the other hand we might want to allow
admins to configure different behavior for different Hosts or Contexts?

I personally feel that running multiple Hosts or Contexts in a single
Tomcat deployment is something that was more valuable in the past when
compute resources were much more expensive than they are today.  Nowadays
it is easy to deploy Tomcat in a container like Docker and map the hosts
and ports as needed, and I rarely find myself needing to have different
configurations for different Hosts or Contexts.

Thank you,

Igal



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


(tomcat) branch 11.0.x updated: Correctly record request start time

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 2f63ba186c Correctly record request start time
2f63ba186c is described below

commit 2f63ba186c40af06af9f7e176a9e686f40e070e5
Author: Mark Thomas 
AuthorDate: Tue Sep 24 15:41:43 2024 +0100

Correctly record request start time

(System.nanoTime() can return negative values)
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 5 ++---
 java/org/apache/coyote/http2/Stream.java | 4 +---
 webapps/docs/changelog.xml   | 4 
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 22232913ac..2e6d0e885a 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -335,8 +335,6 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler,
 wrapper.setReadTimeout(keepAliveTimeout);
 }
 if (!fill(false)) {
-// A read is pending, so no longer in initial state
-parsingRequestLinePhase = 1;
 return false;
 }
 // At least one byte of the request has been received.
@@ -358,7 +356,8 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler,
 }
 // Set the start time once we start reading data (even if it is
 // just skipping blank lines)
-if (request.getStartTimeNanos() < 0) {
+if (parsingRequestLinePhase == 0) {
+parsingRequestLinePhase = 1;
 request.setStartTimeNanos(System.nanoTime());
 }
 chr = byteBuffer.get();
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index a070909617..08b1fc8a02 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -157,9 +157,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 this.coyoteResponse.setOutputBuffer(http2OutputBuffer);
 this.coyoteRequest.setResponse(coyoteResponse);
 this.coyoteRequest.protocol().setString("HTTP/2.0");
-if (this.coyoteRequest.getStartTimeNanos() < 0) {
-this.coyoteRequest.setStartTimeNanos(System.nanoTime());
-}
+this.coyoteRequest.setStartTimeNanos(System.nanoTime());
 }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 246567ac36..8b50fceea2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -153,6 +153,10 @@
 input. Prior to this change, the output may have wrong by one second in
 some cases. Pull request 751 provided by Chenjp. (markt)
   
+  
+Request start time may not have been accurately recorded for HTTP/1.1
+requests preceded by a large number of blank lines. (markt)
+  
 
   
   


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



(tomcat) branch 10.1.x updated: Correctly record request start time

2024-09-24 Thread markt
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 9ffba57778 Correctly record request start time
9ffba57778 is described below

commit 9ffba577785c66d7e2481c46ff9de2ff9b96f8ec
Author: Mark Thomas 
AuthorDate: Tue Sep 24 15:41:43 2024 +0100

Correctly record request start time

(System.nanoTime() can return negative values)
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 5 ++---
 java/org/apache/coyote/http2/Stream.java | 4 +---
 webapps/docs/changelog.xml   | 4 
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index af34736a2d..8ea6078f67 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -346,8 +346,6 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
 wrapper.setReadTimeout(keepAliveTimeout);
 }
 if (!fill(false)) {
-// A read is pending, so no longer in initial state
-parsingRequestLinePhase = 1;
 return false;
 }
 // At least one byte of the request has been received.
@@ -369,7 +367,8 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
 }
 // Set the start time once we start reading data (even if it is
 // just skipping blank lines)
-if (request.getStartTimeNanos() < 0) {
+if (parsingRequestLinePhase == 0) {
+parsingRequestLinePhase = 1;
 request.setStartTimeNanos(System.nanoTime());
 }
 chr = byteBuffer.get();
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 2b81241f4d..b2a36fc2e2 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -161,9 +161,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 this.coyoteResponse.setOutputBuffer(http2OutputBuffer);
 this.coyoteRequest.setResponse(coyoteResponse);
 this.coyoteRequest.protocol().setString("HTTP/2.0");
-if (this.coyoteRequest.getStartTimeNanos() < 0) {
-this.coyoteRequest.setStartTimeNanos(System.nanoTime());
-}
+this.coyoteRequest.setStartTimeNanos(System.nanoTime());
 }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4892221b5e..4830b54ce5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -153,6 +153,10 @@
 input. Prior to this change, the output may have wrong by one second in
 some cases. Pull request 751 provided by Chenjp. (markt)
   
+  
+Request start time may not have been accurately recorded for HTTP/1.1
+requests preceded by a large number of blank lines. (markt)
+  
 
   
   


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



(tomcat) branch main updated: Correctly record request start time

2024-09-24 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new f9d77aafd8 Correctly record request start time
f9d77aafd8 is described below

commit f9d77aafd84804a534aa6dd7c31465acd94ed1b4
Author: Mark Thomas 
AuthorDate: Tue Sep 24 15:41:43 2024 +0100

Correctly record request start time

(System.nanoTime() can return negative values)
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 5 ++---
 java/org/apache/coyote/http2/Stream.java | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 22232913ac..2e6d0e885a 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -335,8 +335,6 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler,
 wrapper.setReadTimeout(keepAliveTimeout);
 }
 if (!fill(false)) {
-// A read is pending, so no longer in initial state
-parsingRequestLinePhase = 1;
 return false;
 }
 // At least one byte of the request has been received.
@@ -358,7 +356,8 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler,
 }
 // Set the start time once we start reading data (even if it is
 // just skipping blank lines)
-if (request.getStartTimeNanos() < 0) {
+if (parsingRequestLinePhase == 0) {
+parsingRequestLinePhase = 1;
 request.setStartTimeNanos(System.nanoTime());
 }
 chr = byteBuffer.get();
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index a070909617..08b1fc8a02 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -157,9 +157,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 this.coyoteResponse.setOutputBuffer(http2OutputBuffer);
 this.coyoteRequest.setResponse(coyoteResponse);
 this.coyoteRequest.protocol().setString("HTTP/2.0");
-if (this.coyoteRequest.getStartTimeNanos() < 0) {
-this.coyoteRequest.setStartTimeNanos(System.nanoTime());
-}
+this.coyoteRequest.setStartTimeNanos(System.nanoTime());
 }
 
 


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



(tomcat) branch main updated: Avoid backup overwrite if they occur more than once every second

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new f44b8b64a8 Avoid backup overwrite if they occur more than once every 
second
f44b8b64a8 is described below

commit f44b8b64a8b2b9e764cf0d226277c60e4c4c1cce
Author: remm 
AuthorDate: Tue Sep 24 09:40:15 2024 +0200

Avoid backup overwrite if they occur more than once every second

This would lose the original file.
---
 java/org/apache/catalina/storeconfig/StoreFileMover.java | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java 
b/java/org/apache/catalina/storeconfig/StoreFileMover.java
index 9e245f5fc0..1e5e5dc775 100644
--- a/java/org/apache/catalina/storeconfig/StoreFileMover.java
+++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java
@@ -150,10 +150,14 @@ public class StoreFileMover {
 }
 }
 String sb = getTimeTag();
-configSave = new File(configFile + sb);
-if (!configSave.isAbsolute()) {
-configSave = new File(getBasename(), configFile + sb);
-}
+int i = 0;
+do {
+configSave = new File(configFile + sb + "-" + String.valueOf(i));
+if (!configSave.isAbsolute()) {
+configSave = new File(getBasename(), configFile + sb + "-" + 
String.valueOf(i));
+}
+i++;
+} while (configSave.exists());
 }
 
 /**


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



(tomcat) branch main updated: Add testing for deploy and storeconfig

2024-09-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 1cebe12d21 Add testing for deploy and storeconfig
1cebe12d21 is described below

commit 1cebe12d212712589d8308cf5b37d22aa4787a2f
Author: remm 
AuthorDate: Tue Sep 24 11:16:54 2024 +0200

Add testing for deploy and storeconfig
---
 .../apache/catalina/manager/TestManagerWebapp.java | 210 -
 1 file changed, 200 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java 
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index f08532eff7..70464f56c2 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -17,7 +17,10 @@
 package org.apache.catalina.manager;
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import jakarta.servlet.http.HttpServletResponse;
 
@@ -29,9 +32,14 @@ import org.apache.catalina.Context;
 import org.apache.catalina.authenticator.TestBasicAuthParser.BasicAuthHeader;
 import org.apache.catalina.realm.MemoryRealm;
 import org.apache.catalina.realm.MessageDigestCredentialHandler;
+import org.apache.catalina.startup.Catalina;
+import org.apache.catalina.startup.HostConfig;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.storeconfig.StoreConfigLifecycleListener;
+import org.apache.catalina.util.IOTools;
+import org.apache.catalina.util.URLEncoder;
 
 public class TestManagerWebapp extends TomcatBaseTest {
 
@@ -51,6 +59,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
 @Test
 public void testServlets() throws Exception {
 Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
 
 File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager.xml");
 try (PrintWriter writer = new PrintWriter(configFile)) {
@@ -61,11 +70,11 @@ public class TestManagerWebapp extends TomcatBaseTest {
 MemoryRealm memoryRealm = new MemoryRealm();
 memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
 memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
 
 // Add manager webapp
 File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
-Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
-ctx.setRealm(memoryRealm);
+tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath());
 
 tomcat.start();
 
@@ -78,14 +87,6 @@ public class TestManagerWebapp extends TomcatBaseTest {
 client.setPort(getPort());
 String basicHeader = (new BasicAuthHeader("Basic", "admin", 
"sekr3t")).getHeader().toString();
 
-client.setRequest(new String[] {
-"GET /manager/ HTTP/1.1" + CRLF +
-"Host: localhost" + CRLF +
-"Connection: Close" + CRLF + CRLF });
-client.connect();
-client.processRequest(true);
-Assert.assertEquals(HttpServletResponse.SC_FOUND, 
client.getStatusCode());
-
 client.setRequest(new String[] {
 "GET /manager/html HTTP/1.1" + CRLF +
 "Host: localhost" + CRLF +
@@ -196,4 +197,193 @@ public class TestManagerWebapp extends TomcatBaseTest {
 
 }
 
+@Test
+public void testDeploy() throws Exception {
+Tomcat tomcat = getTomcatInstance();
+tomcat.setAddDefaultWebXmlToWebapp(false);
+tomcat.getServer().addLifecycleListener(new 
StoreConfigLifecycleListener());
+
+File configFile = new File(getTemporaryDirectory(), 
"tomcat-users-manager-delpoy.xml");
+try (PrintWriter writer = new PrintWriter(configFile)) {
+writer.write(CONFIG);
+}
+addDeleteOnTearDown(configFile);
+
+MemoryRealm memoryRealm = new MemoryRealm();
+memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler());
+memoryRealm.setPathname(configFile.getAbsolutePath());
+tomcat.getEngine().setRealm(memoryRealm);
+
+// Add manager webapp
+File appDir = new File(System.getProperty("tomcat.test.basedir"), 
"webapps/manager");
+Context ctx = tomcat.addWebapp(null, "/manager", 
appDir.getAbsolutePath());
+
+// Add host config otherwise there's no JMX deployer bean
+HostConfig hostConfig = new HostConfig();
+ctx.getParent().addLifecycleListener(hostConfig);
+
+tomcat.start();
+
+SimpleHttpClient client = new SimpleHttpClient() {
+@Override
+ 

[Bug 69339] ClassFormatException in Java11 while compiling JSP pages

2024-09-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69339

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Mark Thomas  ---
The stack trace shows you are using a Jasper JAR file from Tomcat 5.5.17 that
is over 17 years old.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org