(tomcat) branch 10.1.x updated: Switch lock tokens to UUID as recommended by RFC 4918

2024-10-31 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 ecfff720b2 Switch lock tokens to UUID as recommended by RFC 4918
ecfff720b2 is described below

commit ecfff720b24c2af003f12306355dede56c12bb2e
Author: remm 
AuthorDate: Thu Oct 31 10:27:39 2024 +0100

Switch lock tokens to UUID as recommended by RFC 4918

Remove secret init parameter.
Remove some int constants, replaced with an enum for the type of
PROPFIND performed.
Process LOCK request body only if present, to avoid relying on an IOE
(if a body is present and bad, return 400 instead).
---
 .../apache/catalina/servlets/WebdavServlet.java| 148 +
 .../catalina/servlets/TestWebdavServlet.java   |  34 ++---
 webapps/docs/changelog.xml |   5 +
 3 files changed, 85 insertions(+), 102 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 0ba428ca45..748687eff4 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -25,7 +25,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -38,6 +37,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -59,12 +59,10 @@ import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.tomcat.PeriodicEventListener;
 import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.http.WebdavIfHeader;
-import org.apache.tomcat.util.security.ConcurrentMessageDigest;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -175,36 +173,6 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final String METHOD_UNLOCK = "UNLOCK";
 
 
-/**
- * PROPFIND - Specify a property mask.
- */
-private static final int FIND_BY_PROPERTY = 0;
-
-
-/**
- * PROPFIND - Display all properties.
- */
-private static final int FIND_ALL_PROP = 1;
-
-
-/**
- * PROPFIND - Return property names.
- */
-private static final int FIND_PROPERTY_NAMES = 2;
-
-
-/**
- * Create a new lock.
- */
-private static final int LOCK_CREATION = 0;
-
-
-/**
- * Refresh lock.
- */
-private static final int LOCK_REFRESH = 1;
-
-
 /**
  * Default lock timeout value.
  */
@@ -217,6 +185,12 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final int MAX_TIMEOUT = 604800;
 
 
+/**
+ * Default maximum depth.
+ */
+private static final int MAX_DEPTH = 3;
+
+
 /**
  * Default namespace.
  */
@@ -224,11 +198,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Supported locks.
+ * Pre generated raw XML for supported locks.
  */
-protected static final String SUPPORTED_LOCKS = "" + 
"" +
-"" + "" + 
"" +
-"" + 
"" + "";
+protected static final String SUPPORTED_LOCKS =
+"\n  
\n"
 +
+"  
\n";
 
 /**
  * Simple date format for the creation date ISO representation (partial).
@@ -237,6 +211,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 new ConcurrentDateFormat("-MM-dd'T'HH:mm:ss'Z'", Locale.US, 
TimeZone.getTimeZone("GMT"));
 
 
+/**
+ * Lock scheme used.
+ */
+protected static final String LOCK_SCHEME = "urn:uuid:";
+
 // - Instance Variables
 
 /**
@@ -252,15 +231,9 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Secret information used to generate reasonably secure lock ids.
+ * Default depth in spec is infinite.
  */
-private String secret = "catalina";
-
-
-/**
- * Default depth in spec is infinite. Limit depth to 3 by default as 
infinite depth makes operations very expensive.
- */
-private int maxDepth = 3;
+private int maxDepth = MAX_DEPTH;
 
 
 /**
@@ -300,10 +273,6 @@ public class WebdavServlet extends DefaultServ

[Bug 69395] Empty JDBC URI when using a jdbc connection pool

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69395

--- Comment #5 from Mark Thomas  ---
There is nothing in the 9.0.94 to 9.0.95 changes remotely related to JDBC
resources.

The full stack trace for the "Empty JDBC URI" error might be illuminating.

Bisecting the commits (there aren't that many) might be your best option at
this point.

Without evidence pointing to a Tomcat issue or a way for the committers to
reproduce the issue, this is eventually going to get resolved as WORKSFORME.

-- 
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 66406] JULI ClassLoaderLogManager creates multiple loggers named ""

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66406

Master decoder  changed:

   What|Removed |Added

 CC||sabrinat...@gmail.com

--- Comment #4 from Master decoder  ---
Created attachment 39918
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39918&action=edit
Exclusion of groups logging boot

-- 
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 main updated: Avoid using prefix

2024-10-31 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 92eb9a4a9f Avoid using prefix
92eb9a4a9f is described below

commit 92eb9a4a9f8cf47bfc1df87f8cd493624c518d51
Author: remm 
AuthorDate: Thu Oct 31 16:02:42 2024 +0100

Avoid using prefix
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 615b9556c9..75adfb0f51 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2622,9 +2622,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 if (propertyNotFound != null) {
 generatedXML.writeElement("D", propertyNotFound, 
XMLWriter.NO_CONTENT);
 } else {
-
generatedXML.writeElement(propertyNotFoundNode.getPrefix(),
-propertyNotFoundNode.getNamespaceURI(), 
propertyNotFoundNode.getLocalName(),
-XMLWriter.NO_CONTENT);
+generatedXML.writeElement(null, 
propertyNotFoundNode.getNamespaceURI(),
+propertyNotFoundNode.getLocalName(), 
XMLWriter.NO_CONTENT);
 }
 }
 


-
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: Avoid using prefix

2024-10-31 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 91634bcec6 Avoid using prefix
91634bcec6 is described below

commit 91634bcec6a01f9b22fd89df80fe7cbb654f3abc
Author: remm 
AuthorDate: Thu Oct 31 16:02:42 2024 +0100

Avoid using prefix
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 615b9556c9..75adfb0f51 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2622,9 +2622,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 if (propertyNotFound != null) {
 generatedXML.writeElement("D", propertyNotFound, 
XMLWriter.NO_CONTENT);
 } else {
-
generatedXML.writeElement(propertyNotFoundNode.getPrefix(),
-propertyNotFoundNode.getNamespaceURI(), 
propertyNotFoundNode.getLocalName(),
-XMLWriter.NO_CONTENT);
+generatedXML.writeElement(null, 
propertyNotFoundNode.getNamespaceURI(),
+propertyNotFoundNode.getLocalName(), 
XMLWriter.NO_CONTENT);
 }
 }
 


-
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 using prefix

2024-10-31 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 65a9348dc8 Avoid using prefix
65a9348dc8 is described below

commit 65a9348dc8488a6df6b8bf35d219e3bba08a890c
Author: remm 
AuthorDate: Thu Oct 31 16:02:42 2024 +0100

Avoid using prefix
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index ad6338b550..55719089d3 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2621,9 +2621,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 if (propertyNotFound != null) {
 generatedXML.writeElement("D", propertyNotFound, 
XMLWriter.NO_CONTENT);
 } else {
-
generatedXML.writeElement(propertyNotFoundNode.getPrefix(),
-propertyNotFoundNode.getNamespaceURI(), 
propertyNotFoundNode.getLocalName(),
-XMLWriter.NO_CONTENT);
+generatedXML.writeElement(null, 
propertyNotFoundNode.getNamespaceURI(),
+propertyNotFoundNode.getLocalName(), 
XMLWriter.NO_CONTENT);
 }
 }
 


-
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: Avoid using prefix

2024-10-31 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 dbade9c824 Avoid using prefix
dbade9c824 is described below

commit dbade9c824f1595f177357975efb4d049fc0a4dd
Author: remm 
AuthorDate: Thu Oct 31 16:02:42 2024 +0100

Avoid using prefix
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 615b9556c9..75adfb0f51 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2622,9 +2622,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 if (propertyNotFound != null) {
 generatedXML.writeElement("D", propertyNotFound, 
XMLWriter.NO_CONTENT);
 } else {
-
generatedXML.writeElement(propertyNotFoundNode.getPrefix(),
-propertyNotFoundNode.getNamespaceURI(), 
propertyNotFoundNode.getLocalName(),
-XMLWriter.NO_CONTENT);
+generatedXML.writeElement(null, 
propertyNotFoundNode.getNamespaceURI(),
+propertyNotFoundNode.getLocalName(), 
XMLWriter.NO_CONTENT);
 }
 }
 


-
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 69382. Re-use results rather than repeat expensive method calls.

2024-10-31 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 2e04cae91a Fix BZ 69382. Re-use results rather than repeat expensive 
method calls.
2e04cae91a is described below

commit 2e04cae91a8b92429eb8bbb7035ab005c9b6f0dd
Author: Mark Thomas 
AuthorDate: Thu Oct 31 17:04:11 2024 +

Fix BZ 69382. Re-use results rather than repeat expensive method calls.

Patch provided by John Engebretson
---
 java/org/apache/jasper/compiler/Generator.java | 82 --
 webapps/docs/changelog.xml |  6 ++
 2 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 4798ffe4b7..53babe5bfe 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -899,6 +899,8 @@ class Generator {
  */
 private class GenerateVisitor extends Node.Visitor {
 
+private static final String REQUEST_CHARACTER_ENCODING_TEXT = 
"request.getCharacterEncoding()";
+
 /*
  * Map containing introspection information on tag handlers:
  * : tag prefix : Map containing introspection on tag
@@ -971,11 +973,36 @@ class Generator {
  */
 private String attributeValue(Node.JspAttribute attr, boolean encode,
 Class expectedType) {
+// Use the explicit lookup for character encoding
+return attributeValue(attr, encode, expectedType, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+
+/**
+ * Returns an attribute value, optionally URL encoded. If the value is 
a
+ * runtime expression, the result is the expression itself, as a 
string.
+ * If the result is an EL expression, we insert a call to the
+ * interpreter. If the result is a Named Attribute we insert the
+ * generated variable name. Otherwise the result is a string literal,
+ * quoted and escaped.
+ *
+ * @param attr
+ *An JspAttribute object
+ * @param encode
+ *true if to be URL encoded
+ * @param expectedType
+ *the expected type for an EL evaluation (ignored for
+ *attributes that aren't EL expressions)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *or a call to the request
+ */
+private String attributeValue(Node.JspAttribute attr, boolean encode,
+Class expectedType, String requestEncodingText) {
 String v = attr.getValue();
 if (attr.isExpression()) {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf("
-+ v + "), request.getCharacterEncoding())";
++ v + "), " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isELInterpreterInput()) {
@@ -983,7 +1010,7 @@ class Generator {
 expectedType, attr.getEL().getMapName());
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ v + ", request.getCharacterEncoding())";
++ v + ", " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isNamedAttribute()) {
@@ -991,7 +1018,7 @@ class Generator {
 } else {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ quote(v) + ", request.getCharacterEncoding())";
++ quote(v) + ", " + requestEncodingText + ")";
 }
 return quote(v);
 }
@@ -1007,6 +1034,24 @@ class Generator {
  */
 private void printParams(Node n, String pageParam, boolean literal)
 throws JasperException {
+printParams(n, pageParam, literal, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+/**
+ * Prints the attribute value specified in the param action, in the 
form
+ * of name=value string.
+ *
+ * @param n
+ *the parent node for the param action nodes.
+ * @param pageParam
+ *text identifying the JSP to forward/include
+ * @param literal
+ *whether the pageParam is a literal expression (not EL)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *  

(tomcat) branch 10.1.x updated: Fix BZ 69382. Re-use results rather than repeat expensive method calls.

2024-10-31 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 773100bffc Fix BZ 69382. Re-use results rather than repeat expensive 
method calls.
773100bffc is described below

commit 773100bffc35dca5a33ab41010fd106d1ce534a5
Author: Mark Thomas 
AuthorDate: Thu Oct 31 17:04:11 2024 +

Fix BZ 69382. Re-use results rather than repeat expensive method calls.

Patch provided by John Engebretson
---
 java/org/apache/jasper/compiler/Generator.java | 82 --
 webapps/docs/changelog.xml |  6 ++
 2 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 57c3bcbfcb..9e228aa19b 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -910,6 +910,8 @@ class Generator {
  */
 private class GenerateVisitor extends Node.Visitor {
 
+private static final String REQUEST_CHARACTER_ENCODING_TEXT = 
"request.getCharacterEncoding()";
+
 /*
  * Map containing introspection information on tag handlers:
  * : tag prefix : Map containing introspection on tag
@@ -982,11 +984,36 @@ class Generator {
  */
 private String attributeValue(Node.JspAttribute attr, boolean encode,
 Class expectedType) {
+// Use the explicit lookup for character encoding
+return attributeValue(attr, encode, expectedType, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+
+/**
+ * Returns an attribute value, optionally URL encoded. If the value is 
a
+ * runtime expression, the result is the expression itself, as a 
string.
+ * If the result is an EL expression, we insert a call to the
+ * interpreter. If the result is a Named Attribute we insert the
+ * generated variable name. Otherwise the result is a string literal,
+ * quoted and escaped.
+ *
+ * @param attr
+ *An JspAttribute object
+ * @param encode
+ *true if to be URL encoded
+ * @param expectedType
+ *the expected type for an EL evaluation (ignored for
+ *attributes that aren't EL expressions)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *or a call to the request
+ */
+private String attributeValue(Node.JspAttribute attr, boolean encode,
+Class expectedType, String requestEncodingText) {
 String v = attr.getValue();
 if (attr.isExpression()) {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf("
-+ v + "), request.getCharacterEncoding())";
++ v + "), " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isELInterpreterInput()) {
@@ -994,7 +1021,7 @@ class Generator {
 expectedType, attr.getEL().getMapName());
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ v + ", request.getCharacterEncoding())";
++ v + ", " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isNamedAttribute()) {
@@ -1002,7 +1029,7 @@ class Generator {
 } else {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ quote(v) + ", request.getCharacterEncoding())";
++ quote(v) + ", " + requestEncodingText + ")";
 }
 return quote(v);
 }
@@ -1018,6 +1045,24 @@ class Generator {
  */
 private void printParams(Node n, String pageParam, boolean literal)
 throws JasperException {
+printParams(n, pageParam, literal, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+/**
+ * Prints the attribute value specified in the param action, in the 
form
+ * of name=value string.
+ *
+ * @param n
+ *the parent node for the param action nodes.
+ * @param pageParam
+ *text identifying the JSP to forward/include
+ * @param literal
+ *whether the pageParam is a literal expression (not EL)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ * 

[Bug 69382] Inefficient code generated for

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69382

Mark Thomas  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Mark Thomas  ---
Thanks for the analysis and the patch.

Fixed in:
- 11.0.x for 11.0.1 onwards
- 10.1.x for 10.1.32 onwards
-  9.0.x for  9.0.97 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



(tomcat) branch 9.0.x updated: Fix BZ 69382. Re-use results rather than repeat expensive method calls.

2024-10-31 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 a6dee0962a Fix BZ 69382. Re-use results rather than repeat expensive 
method calls.
a6dee0962a is described below

commit a6dee0962a3d7355f4a7158a92b6f39a8fd07968
Author: Mark Thomas 
AuthorDate: Thu Oct 31 17:04:11 2024 +

Fix BZ 69382. Re-use results rather than repeat expensive method calls.

Patch provided by John Engebretson
---
 java/org/apache/jasper/compiler/Generator.java | 82 --
 webapps/docs/changelog.xml |  6 ++
 2 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 5df52c3d7a..9423395659 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -908,6 +908,8 @@ class Generator {
  */
 private class GenerateVisitor extends Node.Visitor {
 
+private static final String REQUEST_CHARACTER_ENCODING_TEXT = 
"request.getCharacterEncoding()";
+
 /*
  * Hashtable containing introspection information on tag handlers:
  * : tag prefix : hashtable containing introspection on tag
@@ -977,11 +979,36 @@ class Generator {
  */
 private String attributeValue(Node.JspAttribute attr, boolean encode,
 Class expectedType) {
+// Use the explicit lookup for character encoding
+return attributeValue(attr, encode, expectedType, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+
+/**
+ * Returns an attribute value, optionally URL encoded. If the value is 
a
+ * runtime expression, the result is the expression itself, as a 
string.
+ * If the result is an EL expression, we insert a call to the
+ * interpreter. If the result is a Named Attribute we insert the
+ * generated variable name. Otherwise the result is a string literal,
+ * quoted and escaped.
+ *
+ * @param attr
+ *An JspAttribute object
+ * @param encode
+ *true if to be URL encoded
+ * @param expectedType
+ *the expected type for an EL evaluation (ignored for
+ *attributes that aren't EL expressions)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *or a call to the request
+ */
+private String attributeValue(Node.JspAttribute attr, boolean encode,
+Class expectedType, String requestEncodingText) {
 String v = attr.getValue();
 if (attr.isExpression()) {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf("
-+ v + "), request.getCharacterEncoding())";
++ v + "), " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isELInterpreterInput()) {
@@ -989,7 +1016,7 @@ class Generator {
 expectedType, attr.getEL().getMapName());
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ v + ", request.getCharacterEncoding())";
++ v + ", " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isNamedAttribute()) {
@@ -997,7 +1024,7 @@ class Generator {
 } else {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ quote(v) + ", request.getCharacterEncoding())";
++ quote(v) + ", " + requestEncodingText + ")";
 }
 return quote(v);
 }
@@ -1013,6 +1040,24 @@ class Generator {
  */
 private void printParams(Node n, String pageParam, boolean literal)
 throws JasperException {
+printParams(n, pageParam, literal, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+/**
+ * Prints the attribute value specified in the param action, in the 
form
+ * of name=value string.
+ *
+ * @param n
+ *the parent node for the param action nodes.
+ * @param pageParam
+ *text identifying the JSP to forward/include
+ * @param literal
+ *whether the pageParam is a literal expression (not EL)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+  

(tomcat) branch main updated: Fix BZ 69382. Re-use results rather than repeat expensive method calls.

2024-10-31 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 6e95775a4b Fix BZ 69382. Re-use results rather than repeat expensive 
method calls.
6e95775a4b is described below

commit 6e95775a4b0f630eb95f4795a7dbcd3e960b2451
Author: Mark Thomas 
AuthorDate: Thu Oct 31 17:04:11 2024 +

Fix BZ 69382. Re-use results rather than repeat expensive method calls.

Patch provided by John Engebretson
---
 java/org/apache/jasper/compiler/Generator.java | 82 --
 1 file changed, 76 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 4798ffe4b7..53babe5bfe 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -899,6 +899,8 @@ class Generator {
  */
 private class GenerateVisitor extends Node.Visitor {
 
+private static final String REQUEST_CHARACTER_ENCODING_TEXT = 
"request.getCharacterEncoding()";
+
 /*
  * Map containing introspection information on tag handlers:
  * : tag prefix : Map containing introspection on tag
@@ -971,11 +973,36 @@ class Generator {
  */
 private String attributeValue(Node.JspAttribute attr, boolean encode,
 Class expectedType) {
+// Use the explicit lookup for character encoding
+return attributeValue(attr, encode, expectedType, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+
+/**
+ * Returns an attribute value, optionally URL encoded. If the value is 
a
+ * runtime expression, the result is the expression itself, as a 
string.
+ * If the result is an EL expression, we insert a call to the
+ * interpreter. If the result is a Named Attribute we insert the
+ * generated variable name. Otherwise the result is a string literal,
+ * quoted and escaped.
+ *
+ * @param attr
+ *An JspAttribute object
+ * @param encode
+ *true if to be URL encoded
+ * @param expectedType
+ *the expected type for an EL evaluation (ignored for
+ *attributes that aren't EL expressions)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *or a call to the request
+ */
+private String attributeValue(Node.JspAttribute attr, boolean encode,
+Class expectedType, String requestEncodingText) {
 String v = attr.getValue();
 if (attr.isExpression()) {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf("
-+ v + "), request.getCharacterEncoding())";
++ v + "), " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isELInterpreterInput()) {
@@ -983,7 +1010,7 @@ class Generator {
 expectedType, attr.getEL().getMapName());
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ v + ", request.getCharacterEncoding())";
++ v + ", " + requestEncodingText + ")";
 }
 return v;
 } else if (attr.isNamedAttribute()) {
@@ -991,7 +1018,7 @@ class Generator {
 } else {
 if (encode) {
 return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
-+ quote(v) + ", request.getCharacterEncoding())";
++ quote(v) + ", " + requestEncodingText + ")";
 }
 return quote(v);
 }
@@ -1007,6 +1034,24 @@ class Generator {
  */
 private void printParams(Node n, String pageParam, boolean literal)
 throws JasperException {
+printParams(n, pageParam, literal, 
REQUEST_CHARACTER_ENCODING_TEXT);
+}
+/**
+ * Prints the attribute value specified in the param action, in the 
form
+ * of name=value string.
+ *
+ * @param n
+ *the parent node for the param action nodes.
+ * @param pageParam
+ *text identifying the JSP to forward/include
+ * @param literal
+ *whether the pageParam is a literal expression (not EL)
+ * @param requestEncodingText
+ *text referring to the request encoding, either a local 
variable
+ *or a call to the request
+ */
+priv

(tomcat) branch main updated: Fix discrepancies in property names list and find by property

2024-10-31 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 d0c0b201e5 Fix discrepancies in property names list and find by 
property
d0c0b201e5 is described below

commit d0c0b201e5e7218ad9a9472be39ac5211372449e
Author: remm 
AuthorDate: Thu Oct 31 11:48:16 2024 +0100

Fix discrepancies in property names list and find by property
---
 .../apache/catalina/servlets/WebdavServlet.java| 35 --
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 748687eff4..615b9556c9 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2489,8 +2489,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
 
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 if (isFile) {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2498,11 +2498,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeProperty("D", "getetag", eTag);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 } else {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.OPENING);
 generatedXML.writeElement("D", "collection", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.CLOSING);
 }
+
 store.propfind(path, null, false, generatedXML);
 
 generatedXML.writeElement("D", "supportedlock", 
XMLWriter.OPENING);
@@ -2526,14 +2526,16 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 generatedXML.writeElement("D", "creationdate", 
XMLWriter.NO_CONTENT);
 if (isFile) {
-generatedXML.writeElement("D", "getcontentlanguage", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "getcontentlength", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+if (contentType != null) {
+generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+}
 generatedXML.writeElement("D", "getetag", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 }
+generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "lockdiscovery", 
XMLWriter.NO_CONTENT);
+generatedXML.writeElement("D", "supportedlock", 
XMLWriter.NO_CONTENT);
 store.propfind(path, null, true, generatedXML);
 
 generatedXML.writeElement("D", "prop", XMLWriter.CLOSING);
@@ -2555,22 +2557,14 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 for (Node propertyNode : properties) {
 String property = getDAVNode(propertyNode);
-if (property == null) {
+boolean protectedProperty =
+property != null && 
(!(property.equals("displayname") || property.equals("getcontentlanguage")));
+if (property == null || !protectedProperty) {
 if (!store.propfind(path, propertyNode, false, 
generatedXML)) {
 propertiesNotFound.add(propertyNode);
 }
 } else if (property.equals("creationdate")) {
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
-} else if (property.equals("displayname")) {
-generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
- 

(tomcat) branch 11.0.x updated: Fix discrepancies in property names list and find by property

2024-10-31 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 2466c4eca0 Fix discrepancies in property names list and find by 
property
2466c4eca0 is described below

commit 2466c4eca0e19f5894c4e597629e0bc92dfcbcfd
Author: remm 
AuthorDate: Thu Oct 31 11:48:16 2024 +0100

Fix discrepancies in property names list and find by property
---
 .../apache/catalina/servlets/WebdavServlet.java| 35 --
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 748687eff4..615b9556c9 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2489,8 +2489,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
 
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 if (isFile) {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2498,11 +2498,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeProperty("D", "getetag", eTag);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 } else {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.OPENING);
 generatedXML.writeElement("D", "collection", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.CLOSING);
 }
+
 store.propfind(path, null, false, generatedXML);
 
 generatedXML.writeElement("D", "supportedlock", 
XMLWriter.OPENING);
@@ -2526,14 +2526,16 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 generatedXML.writeElement("D", "creationdate", 
XMLWriter.NO_CONTENT);
 if (isFile) {
-generatedXML.writeElement("D", "getcontentlanguage", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "getcontentlength", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+if (contentType != null) {
+generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+}
 generatedXML.writeElement("D", "getetag", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 }
+generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "lockdiscovery", 
XMLWriter.NO_CONTENT);
+generatedXML.writeElement("D", "supportedlock", 
XMLWriter.NO_CONTENT);
 store.propfind(path, null, true, generatedXML);
 
 generatedXML.writeElement("D", "prop", XMLWriter.CLOSING);
@@ -2555,22 +2557,14 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 for (Node propertyNode : properties) {
 String property = getDAVNode(propertyNode);
-if (property == null) {
+boolean protectedProperty =
+property != null && 
(!(property.equals("displayname") || property.equals("getcontentlanguage")));
+if (property == null || !protectedProperty) {
 if (!store.propfind(path, propertyNode, false, 
generatedXML)) {
 propertiesNotFound.add(propertyNode);
 }
 } else if (property.equals("creationdate")) {
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
-} else if (property.equals("displayname")) {
-generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
- 

(tomcat) branch 9.0.x updated: Fix discrepancies in property names list and find by property

2024-10-31 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 1b1332d5b4 Fix discrepancies in property names list and find by 
property
1b1332d5b4 is described below

commit 1b1332d5b41db2b3ed023c035717ebc355b4c262
Author: remm 
AuthorDate: Thu Oct 31 11:48:16 2024 +0100

Fix discrepancies in property names list and find by property
---
 .../apache/catalina/servlets/WebdavServlet.java| 35 --
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 42b115d7bb..ad6338b550 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2488,8 +2488,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
 
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 if (isFile) {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2497,11 +2497,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeProperty("D", "getetag", eTag);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 } else {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.OPENING);
 generatedXML.writeElement("D", "collection", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.CLOSING);
 }
+
 store.propfind(path, null, false, generatedXML);
 
 generatedXML.writeElement("D", "supportedlock", 
XMLWriter.OPENING);
@@ -2525,14 +2525,16 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 generatedXML.writeElement("D", "creationdate", 
XMLWriter.NO_CONTENT);
 if (isFile) {
-generatedXML.writeElement("D", "getcontentlanguage", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "getcontentlength", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+if (contentType != null) {
+generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+}
 generatedXML.writeElement("D", "getetag", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 }
+generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "lockdiscovery", 
XMLWriter.NO_CONTENT);
+generatedXML.writeElement("D", "supportedlock", 
XMLWriter.NO_CONTENT);
 store.propfind(path, null, true, generatedXML);
 
 generatedXML.writeElement("D", "prop", XMLWriter.CLOSING);
@@ -2554,22 +2556,14 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 for (Node propertyNode : properties) {
 String property = getDAVNode(propertyNode);
-if (property == null) {
+boolean protectedProperty =
+property != null && 
(!(property.equals("displayname") || property.equals("getcontentlanguage")));
+if (property == null || !protectedProperty) {
 if (!store.propfind(path, propertyNode, false, 
generatedXML)) {
 propertiesNotFound.add(propertyNode);
 }
 } else if (property.equals("creationdate")) {
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
-} else if (property.equals("displayname")) {
-generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
-   

Re: [PR] Reducing memory usage while evaluating reflective EL expressions [tomcat]

2024-10-31 Thread via GitHub


markt-asf commented on PR #770:
URL: https://github.com/apache/tomcat/pull/770#issuecomment-2450753071

   I'm planning on applying this manually to main and then back-porting. So far 
I've made the following changes:
   - refactored the inner test classes to align with the rest of the package
   - ignored the caching code that wasn't (fully) removed
   - Called Util.getMethod() before returning to address some test failures 
caused by visibility issues
   
   Just running the full test suite before committing to check I haven't missed 
anything.


-- 
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



(tomcat) branch main updated: Fix BZ 69398. Avoid repeated allocation of empty arrays.

2024-10-31 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 32cff73576 Fix BZ 69398. Avoid repeated allocation of empty arrays.
32cff73576 is described below

commit 32cff73576ba7b3a4d598ce84b366ed09c0a002b
Author: Mark Thomas 
AuthorDate: Thu Oct 31 21:06:37 2024 +

Fix BZ 69398. Avoid repeated allocation of empty arrays.

Based on a suggestion by John Engebretson.
---
 java/org/apache/jasper/runtime/PageContextImpl.java | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java 
b/java/org/apache/jasper/runtime/PageContextImpl.java
index b38ce953f4..6e0bb13138 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -67,6 +67,8 @@ public class PageContextImpl extends PageContext {
 
 private static final JspFactory jspf = JspFactory.getDefaultFactory();
 
+private static final BodyContentImpl[] EMPTY_BODY_CONTENT_IMPL_ARRAY = new 
BodyContentImpl[0];
+
 private BodyContentImpl[] outs;
 
 private int depth;
@@ -104,11 +106,8 @@ public class PageContextImpl extends PageContext {
 
 private transient JspWriterImpl baseOut;
 
-/*
- * Constructor.
- */
 PageContextImpl() {
-this.outs = new BodyContentImpl[0];
+this.outs = EMPTY_BODY_CONTENT_IMPL_ARRAY;
 this.attributes = new HashMap<>(16);
 this.depth = -1;
 }


-
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: Switch lock tokens to UUID as recommended by RFC 4918

2024-10-31 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 619f2e1644 Switch lock tokens to UUID as recommended by RFC 4918
619f2e1644 is described below

commit 619f2e16440b9fe006b9e2bfc472d96c737fcfa9
Author: remm 
AuthorDate: Thu Oct 31 10:27:39 2024 +0100

Switch lock tokens to UUID as recommended by RFC 4918

Remove secret init parameter.
Remove some int constants, replaced with an enum for the type of
PROPFIND performed.
Process LOCK request body only if present, to avoid relying on an IOE
(if a body is present and bad, return 400 instead).
---
 .../apache/catalina/servlets/WebdavServlet.java| 148 +
 .../catalina/servlets/TestWebdavServlet.java   |  34 ++---
 webapps/docs/changelog.xml |   5 +
 3 files changed, 85 insertions(+), 102 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 0ba428ca45..748687eff4 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -25,7 +25,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -38,6 +37,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -59,12 +59,10 @@ import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.tomcat.PeriodicEventListener;
 import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.http.WebdavIfHeader;
-import org.apache.tomcat.util.security.ConcurrentMessageDigest;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -175,36 +173,6 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final String METHOD_UNLOCK = "UNLOCK";
 
 
-/**
- * PROPFIND - Specify a property mask.
- */
-private static final int FIND_BY_PROPERTY = 0;
-
-
-/**
- * PROPFIND - Display all properties.
- */
-private static final int FIND_ALL_PROP = 1;
-
-
-/**
- * PROPFIND - Return property names.
- */
-private static final int FIND_PROPERTY_NAMES = 2;
-
-
-/**
- * Create a new lock.
- */
-private static final int LOCK_CREATION = 0;
-
-
-/**
- * Refresh lock.
- */
-private static final int LOCK_REFRESH = 1;
-
-
 /**
  * Default lock timeout value.
  */
@@ -217,6 +185,12 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final int MAX_TIMEOUT = 604800;
 
 
+/**
+ * Default maximum depth.
+ */
+private static final int MAX_DEPTH = 3;
+
+
 /**
  * Default namespace.
  */
@@ -224,11 +198,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Supported locks.
+ * Pre generated raw XML for supported locks.
  */
-protected static final String SUPPORTED_LOCKS = "" + 
"" +
-"" + "" + 
"" +
-"" + 
"" + "";
+protected static final String SUPPORTED_LOCKS =
+"\n  
\n"
 +
+"  
\n";
 
 /**
  * Simple date format for the creation date ISO representation (partial).
@@ -237,6 +211,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 new ConcurrentDateFormat("-MM-dd'T'HH:mm:ss'Z'", Locale.US, 
TimeZone.getTimeZone("GMT"));
 
 
+/**
+ * Lock scheme used.
+ */
+protected static final String LOCK_SCHEME = "urn:uuid:";
+
 // - Instance Variables
 
 /**
@@ -252,15 +231,9 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Secret information used to generate reasonably secure lock ids.
+ * Default depth in spec is infinite.
  */
-private String secret = "catalina";
-
-
-/**
- * Default depth in spec is infinite. Limit depth to 3 by default as 
infinite depth makes operations very expensive.
- */
-private int maxDepth = 3;
+private int maxDepth = MAX_DEPTH;
 
 
 /**
@@ -300,10 +273,6 @@ public class WebdavServlet extends DefaultServ

(tomcat) branch 9.0.x updated: Switch lock tokens to UUID as recommended by RFC 4918

2024-10-31 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 5a5b56cb56 Switch lock tokens to UUID as recommended by RFC 4918
5a5b56cb56 is described below

commit 5a5b56cb564216661a97bf68410642b073ac313b
Author: remm 
AuthorDate: Thu Oct 31 10:27:39 2024 +0100

Switch lock tokens to UUID as recommended by RFC 4918

Remove secret init parameter.
Remove some int constants, replaced with an enum for the type of
PROPFIND performed.
Process LOCK request body only if present, to avoid relying on an IOE
(if a body is present and bad, return 400 instead).
---
 .../apache/catalina/servlets/WebdavServlet.java| 148 +
 .../catalina/servlets/TestWebdavServlet.java   |  34 ++---
 webapps/docs/changelog.xml |   5 +
 3 files changed, 85 insertions(+), 102 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 845c60f465..42b115d7bb 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -25,7 +25,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -38,6 +37,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -58,12 +58,10 @@ import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.tomcat.PeriodicEventListener;
 import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.http.WebdavIfHeader;
-import org.apache.tomcat.util.security.ConcurrentMessageDigest;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -174,36 +172,6 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final String METHOD_UNLOCK = "UNLOCK";
 
 
-/**
- * PROPFIND - Specify a property mask.
- */
-private static final int FIND_BY_PROPERTY = 0;
-
-
-/**
- * PROPFIND - Display all properties.
- */
-private static final int FIND_ALL_PROP = 1;
-
-
-/**
- * PROPFIND - Return property names.
- */
-private static final int FIND_PROPERTY_NAMES = 2;
-
-
-/**
- * Create a new lock.
- */
-private static final int LOCK_CREATION = 0;
-
-
-/**
- * Refresh lock.
- */
-private static final int LOCK_REFRESH = 1;
-
-
 /**
  * Default lock timeout value.
  */
@@ -216,6 +184,12 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final int MAX_TIMEOUT = 604800;
 
 
+/**
+ * Default maximum depth.
+ */
+private static final int MAX_DEPTH = 3;
+
+
 /**
  * Default namespace.
  */
@@ -223,11 +197,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Supported locks.
+ * Pre generated raw XML for supported locks.
  */
-protected static final String SUPPORTED_LOCKS = "" + 
"" +
-"" + "" + 
"" +
-"" + 
"" + "";
+protected static final String SUPPORTED_LOCKS =
+"\n  
\n"
 +
+"  
\n";
 
 /**
  * Simple date format for the creation date ISO representation (partial).
@@ -236,6 +210,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 new ConcurrentDateFormat("-MM-dd'T'HH:mm:ss'Z'", Locale.US, 
TimeZone.getTimeZone("GMT"));
 
 
+/**
+ * Lock scheme used.
+ */
+protected static final String LOCK_SCHEME = "urn:uuid:";
+
 // - Instance Variables
 
 /**
@@ -251,15 +230,9 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Secret information used to generate reasonably secure lock ids.
+ * Default depth in spec is infinite.
  */
-private String secret = "catalina";
-
-
-/**
- * Default depth in spec is infinite. Limit depth to 3 by default as 
infinite depth makes operations very expensive.
- */
-private int maxDepth = 3;
+private int maxDepth = MAX_DEPTH;
 
 
 /**
@@ -299,10 +272,6 @@ public class WebdavServlet extends DefaultServle

(tomcat) branch main updated: Switch lock tokens to UUID as recommended by RFC 4918

2024-10-31 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 033d30c717 Switch lock tokens to UUID as recommended by RFC 4918
033d30c717 is described below

commit 033d30c717926216dffb2fd6a475781acd4c7101
Author: remm 
AuthorDate: Thu Oct 31 10:27:39 2024 +0100

Switch lock tokens to UUID as recommended by RFC 4918

Remove secret init parameter.
Remove some int constants, replaced with an enum for the type of
PROPFIND performed.
Process LOCK request body only if present, to avoid relying on an IOE
(if a body is present and bad, return 400 instead).
---
 .../catalina/servlets/LocalStrings.properties  |   1 -
 .../apache/catalina/servlets/WebdavServlet.java| 150 +
 .../catalina/servlets/TestWebdavServlet.java   |  34 ++---
 webapps/docs/changelog.xml |   5 +
 4 files changed, 85 insertions(+), 105 deletions(-)

diff --git a/java/org/apache/catalina/servlets/LocalStrings.properties 
b/java/org/apache/catalina/servlets/LocalStrings.properties
index dd0b8e6ed2..00a830f4c0 100644
--- a/java/org/apache/catalina/servlets/LocalStrings.properties
+++ b/java/org/apache/catalina/servlets/LocalStrings.properties
@@ -57,6 +57,5 @@ webdavservlet.inputstreamclosefail=Failed to close the 
inputStream of [{0}]
 webdavservlet.jaxpfailed=JAXP initialization failed
 webdavservlet.memorystore=Non persistent memory storage will be used for dead 
properties; the 'propertyStore' init parameter of the Servlet may be used to 
configure a custom store implementing the 'WebdavServlet.PropertyStore' 
interface
 webdavservlet.nonWildcardMapping=The mapping [{0}] is not a wildcard mapping 
and should not be used for the WebDAV Servlet
-webdavservlet.noSecret=Generation of secure lock ids need a configured 
'secret' init parameter on the Servlet
 webdavservlet.noStoreParameter=Init parameter [{0}] with value [{1}] was not 
found on the configured store
 webdavservlet.storeError=Error creating store of class [{0}], the default 
memory store will be used instead
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index c775b2aa7a..748687eff4 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -25,7 +25,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -38,6 +37,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -59,12 +59,10 @@ import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.tomcat.PeriodicEventListener;
 import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.http.WebdavIfHeader;
-import org.apache.tomcat.util.security.ConcurrentMessageDigest;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -175,36 +173,6 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final String METHOD_UNLOCK = "UNLOCK";
 
 
-/**
- * PROPFIND - Specify a property mask.
- */
-private static final int FIND_BY_PROPERTY = 0;
-
-
-/**
- * PROPFIND - Display all properties.
- */
-private static final int FIND_ALL_PROP = 1;
-
-
-/**
- * PROPFIND - Return property names.
- */
-private static final int FIND_PROPERTY_NAMES = 2;
-
-
-/**
- * Create a new lock.
- */
-private static final int LOCK_CREATION = 0;
-
-
-/**
- * Refresh lock.
- */
-private static final int LOCK_REFRESH = 1;
-
-
 /**
  * Default lock timeout value.
  */
@@ -217,6 +185,12 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private static final int MAX_TIMEOUT = 604800;
 
 
+/**
+ * Default maximum depth.
+ */
+private static final int MAX_DEPTH = 3;
+
+
 /**
  * Default namespace.
  */
@@ -224,11 +198,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 
 /**
- * Supported locks.
+ * Pre generated raw XML for supported locks.
  */
-protected static final String SUPPORTED_LOCKS = "" + 
"" +
-"" + "" + 
"" +
-

(tomcat) branch 10.1.x updated: Fix discrepancies in property names list and find by property

2024-10-31 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 f5cca95582 Fix discrepancies in property names list and find by 
property
f5cca95582 is described below

commit f5cca95582c2daba0d21a81420f9a209166976df
Author: remm 
AuthorDate: Thu Oct 31 11:48:16 2024 +0100

Fix discrepancies in property names list and find by property
---
 .../apache/catalina/servlets/WebdavServlet.java| 35 --
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 748687eff4..615b9556c9 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2489,8 +2489,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
 
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 if (isFile) {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2498,11 +2498,11 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 generatedXML.writeProperty("D", "getetag", eTag);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 } else {
-generatedXML.writeProperty("D", "getlastmodified", 
FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.OPENING);
 generatedXML.writeElement("D", "collection", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.CLOSING);
 }
+
 store.propfind(path, null, false, generatedXML);
 
 generatedXML.writeElement("D", "supportedlock", 
XMLWriter.OPENING);
@@ -2526,14 +2526,16 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 generatedXML.writeElement("D", "creationdate", 
XMLWriter.NO_CONTENT);
 if (isFile) {
-generatedXML.writeElement("D", "getcontentlanguage", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "getcontentlength", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+if (contentType != null) {
+generatedXML.writeElement("D", "getcontenttype", 
XMLWriter.NO_CONTENT);
+}
 generatedXML.writeElement("D", "getetag", 
XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 }
+generatedXML.writeElement("D", "getlastmodified", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "resourcetype", 
XMLWriter.NO_CONTENT);
 generatedXML.writeElement("D", "lockdiscovery", 
XMLWriter.NO_CONTENT);
+generatedXML.writeElement("D", "supportedlock", 
XMLWriter.NO_CONTENT);
 store.propfind(path, null, true, generatedXML);
 
 generatedXML.writeElement("D", "prop", XMLWriter.CLOSING);
@@ -2555,22 +2557,14 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 
 for (Node propertyNode : properties) {
 String property = getDAVNode(propertyNode);
-if (property == null) {
+boolean protectedProperty =
+property != null && 
(!(property.equals("displayname") || property.equals("getcontentlanguage")));
+if (property == null || !protectedProperty) {
 if (!store.propfind(path, propertyNode, false, 
generatedXML)) {
 propertiesNotFound.add(propertyNode);
 }
 } else if (property.equals("creationdate")) {
 generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
-} else if (property.equals("displayname")) {
-generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
- 

[Bug 69422] New: tomcat 9.0.82 upgrade to tomcat 9.0.96 ncountered a problem JspTagExceptio

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69422

Bug ID: 69422
   Summary: tomcat 9.0.82 upgrade to tomcat 9.0.96 ncountered a
problem JspTagExceptio
   Product: Tomcat 9
   Version: 9.0.96
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: 1147472...@qq.com
  Target Milestone: -

Created attachment 39919
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39919&action=edit
jasper compile jsp to java code

Hi:
  Recently, the project encountered problems when upgrading the tomcat version
to 9.0.96,  But it is normal in version 9.0.82.

 The exception stack in 9.0.96,  is as follows,

 [javax.servlet.jsp.JspTagException]
javax.servlet.jsp.JspTagException

at
org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:249)

at
org.apache.jsp.WEB_002dINF.jsp.ctp.common.enumnew.bindEnumTree_jsp._jspx_meth_c_005fset_005f1(bindEnumTree_jsp.java:1018)

at
org.apache.jsp.WEB_002dINF.jsp.ctp.common.enumnew.bindEnumTree_jsp._jspService(bindEnumTree_jsp.java:242)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:67)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)

at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:376)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:324)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)



JSTL jar info:


version=1.2.1
groupId=org.glassfish.web
artifactId=javax.servlet.jsp.jstl



Therefore, we compared the differences between the two versions and found that
the 9.0.96 version code has thread safety issues in concurrent situations. The
code comparison is as follows:

9.0.96 Jasper compile the generated java code, if  Tag  reuse,  In the case of
multiple threads,

 Thread A  call "reuse" method , Thread B get same Tag object, when call
"doEndTag" method , at this time Thread A call methd "releaseTag" , Thread B
Tag Object reset. catch the JspTagException.


see attachment1.jpg



9.0.82 Jasper compile the generated java code,  no problem code

see attachment2.jpg

-- 
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 69422] tomcat 9.0.82 upgrade to tomcat 9.0.96 ncountered a problem JspTagExceptio

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69422

manmano <1147472...@qq.com> changed:

   What|Removed |Added

   Priority|P2  |P1

-- 
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



Re: [PR] Reducing memory usage while evaluating reflective EL expressions [tomcat]

2024-10-31 Thread via GitHub


jengebr commented on PR #770:
URL: https://github.com/apache/tomcat/pull/770#issuecomment-2450799286

   Thank you so much!  :)


-- 
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



(tomcat) branch 10.1.x updated: Fix BZ 69381 Improve method lookup performance

2024-10-31 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 f9b2ca600e Fix BZ 69381 Improve method lookup performance
f9b2ca600e is described below

commit f9b2ca600eced016f50396987774925fe1752d12
Author: Mark Thomas 
AuthorDate: Thu Oct 31 20:31:28 2024 +

Fix BZ 69381 Improve method lookup performance

When the method has no arguments there is no requirement to consider
casting or coercion. Shortcut the method lookup process in that case.

Based on PR #770 by John Engebretson.
---
 java/jakarta/el/Util.java  |  10 ++
 .../apache/el/parser/TestELParserPerformance.java  | 121 +
 test/org/apache/el/parser/TesterBeanD.java |  73 +
 test/org/apache/el/parser/TesterBeanE.java |  70 
 test/org/apache/el/parser/TesterEnum.java  |  23 
 webapps/docs/changelog.xml |   6 +
 6 files changed, 279 insertions(+), 24 deletions(-)

diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java
index b5668527c6..b307bba131 100644
--- a/java/jakarta/el/Util.java
+++ b/java/jakarta/el/Util.java
@@ -226,6 +226,16 @@ class Util {
 paramTypes = getTypesFromValues(paramValues);
 }
 
+// Fast path: when no arguments exist, there can only be one matching 
method and no need for coercion.
+if (paramTypes.length == 0) {
+try {
+Method method = clazz.getMethod(methodName, paramTypes);
+return getMethod(clazz, base, method);
+} catch (NoSuchMethodException | SecurityException e) {
+// Fall through to broader, slower logic
+}
+}
+
 Method[] methods = clazz.getMethods();
 
 List> wrappers = Wrapper.wrap(methods, methodName);
diff --git a/test/org/apache/el/parser/TestELParserPerformance.java 
b/test/org/apache/el/parser/TestELParserPerformance.java
index 7f56c7d224..49edcc0517 100644
--- a/test/org/apache/el/parser/TestELParserPerformance.java
+++ b/test/org/apache/el/parser/TestELParserPerformance.java
@@ -17,6 +17,10 @@
 package org.apache.el.parser;
 
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
 
 import jakarta.el.ELContext;
 import jakarta.el.ELManager;
@@ -34,20 +38,16 @@ import org.apache.tomcat.util.collections.SynchronizedStack;
  */
 public class TestELParserPerformance {
 
+private static final long DEFAULT_TEST_ITERATIONS = 100;
+
 /*
  * Test to explore if re-using Parser instances is faster.
  *
- * Tests on my laptop show:
- * - overhead by introducing the stack is in the noise for parsing even the
- *   simplest expression
- * - efficiency from re-using the ELParser is measurable for even a single
- *   reuse of the parser
- * - with large numbers of parses (~10k) performance for a trivial parse is
- *   three times faster
- * - around the 100 iterations mark GC overhead adds significant noise to
- *   the results - for consistent results you either need fewer parses to
- *   avoid triggering GC or more parses so the GC effects are evenly
- *   distributed between the runs
+ * Tests on my laptop show: - overhead by introducing the stack is in the 
noise for parsing even the simplest
+ * expression - efficiency from re-using the ELParser is measurable for 
even a single reuse of the parser - with
+ * large numbers of parses (~10k) performance for a trivial parse is three 
times faster - around the 100 iterations
+ * mark GC overhead adds significant noise to the results - for consistent 
results you either need fewer parses to
+ * avoid triggering GC or more parses so the GC effects are evenly 
distributed between the runs
  *
  * Note that the test is single threaded.
  */
@@ -59,11 +59,11 @@ public class TestELParserPerformance {
 long reinitTotalTime = 0;
 long newTotalTime = 0;
 
-for (int j = 0; j < runs; j ++) {
+for (int j = 0; j < runs; j++) {
 long start = System.nanoTime();
 SynchronizedStack stack = new SynchronizedStack<>();
 
-for (int i = 0; i < parseIterations; i ++) {
+for (int i = 0; i < parseIterations; i++) {
 ELParser parser = stack.pop();
 if (parser == null) {
 parser = new ELParser(new StringReader("${'foo'}"));
@@ -74,23 +74,21 @@ public class TestELParserPerformance {
 stack.push(parser);
 }
 long end = System.nanoTime();
-reinitTotalTime +=  (end - start);
+reinitTotalTime += (end - start);
 
-System.out.println(par

(tomcat) branch 11.0.x updated: Fix BZ 69381 Improve method lookup performance

2024-10-31 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 e464774fa6 Fix BZ 69381 Improve method lookup performance
e464774fa6 is described below

commit e464774fa6891a0863f3240f1da3e3a052dd7826
Author: Mark Thomas 
AuthorDate: Thu Oct 31 20:31:28 2024 +

Fix BZ 69381 Improve method lookup performance

When the method has no arguments there is no requirement to consider
casting or coercion. Shortcut the method lookup process in that case.

Based on PR #770 by John Engebretson.
---
 java/jakarta/el/Util.java  |  10 ++
 .../apache/el/parser/TestELParserPerformance.java  | 121 +
 test/org/apache/el/parser/TesterBeanD.java |  73 +
 test/org/apache/el/parser/TesterBeanE.java |  70 
 test/org/apache/el/parser/TesterEnum.java  |  23 
 webapps/docs/changelog.xml |   6 +
 6 files changed, 279 insertions(+), 24 deletions(-)

diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java
index c168de6e5b..59bc98b538 100644
--- a/java/jakarta/el/Util.java
+++ b/java/jakarta/el/Util.java
@@ -202,6 +202,16 @@ class Util {
 paramTypes = getTypesFromValues(paramValues);
 }
 
+// Fast path: when no arguments exist, there can only be one matching 
method and no need for coercion.
+if (paramTypes.length == 0) {
+try {
+Method method = clazz.getMethod(methodName, paramTypes);
+return getMethod(clazz, base, method);
+} catch (NoSuchMethodException | SecurityException e) {
+// Fall through to broader, slower logic
+}
+}
+
 Method[] methods = clazz.getMethods();
 
 List> wrappers = Wrapper.wrap(methods, methodName);
diff --git a/test/org/apache/el/parser/TestELParserPerformance.java 
b/test/org/apache/el/parser/TestELParserPerformance.java
index c5e8b5a3bc..85eac64240 100644
--- a/test/org/apache/el/parser/TestELParserPerformance.java
+++ b/test/org/apache/el/parser/TestELParserPerformance.java
@@ -17,6 +17,10 @@
 package org.apache.el.parser;
 
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
 
 import jakarta.el.ELBaseTest;
 import jakarta.el.ELContext;
@@ -35,20 +39,16 @@ import org.apache.tomcat.util.collections.SynchronizedStack;
  */
 public class TestELParserPerformance extends ELBaseTest {
 
+private static final long DEFAULT_TEST_ITERATIONS = 100;
+
 /*
  * Test to explore if re-using Parser instances is faster.
  *
- * Tests on my laptop show:
- * - overhead by introducing the stack is in the noise for parsing even the
- *   simplest expression
- * - efficiency from re-using the ELParser is measurable for even a single
- *   reuse of the parser
- * - with large numbers of parses (~10k) performance for a trivial parse is
- *   three times faster
- * - around the 100 iterations mark GC overhead adds significant noise to
- *   the results - for consistent results you either need fewer parses to
- *   avoid triggering GC or more parses so the GC effects are evenly
- *   distributed between the runs
+ * Tests on my laptop show: - overhead by introducing the stack is in the 
noise for parsing even the simplest
+ * expression - efficiency from re-using the ELParser is measurable for 
even a single reuse of the parser - with
+ * large numbers of parses (~10k) performance for a trivial parse is three 
times faster - around the 100 iterations
+ * mark GC overhead adds significant noise to the results - for consistent 
results you either need fewer parses to
+ * avoid triggering GC or more parses so the GC effects are evenly 
distributed between the runs
  *
  * Note that the test is single threaded.
  */
@@ -60,11 +60,11 @@ public class TestELParserPerformance extends ELBaseTest {
 long reinitTotalTime = 0;
 long newTotalTime = 0;
 
-for (int j = 0; j < runs; j ++) {
+for (int j = 0; j < runs; j++) {
 long start = System.nanoTime();
 SynchronizedStack stack = new SynchronizedStack<>();
 
-for (int i = 0; i < parseIterations; i ++) {
+for (int i = 0; i < parseIterations; i++) {
 ELParser parser = stack.pop();
 if (parser == null) {
 parser = new ELParser(new StringReader("${'foo'}"));
@@ -75,23 +75,21 @@ public class TestELParserPerformance extends ELBaseTest {
 stack.push(parser);
 }
 long end = System.nanoTime();
-reinitTotalTime +=  (end - start);
+reinitTotalTi

(tomcat) branch 9.0.x updated: Fix BZ 69381 Improve method lookup performance

2024-10-31 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 d0b3569f03 Fix BZ 69381 Improve method lookup performance
d0b3569f03 is described below

commit d0b3569f03eb3c247f8d706fcf01123d48034c7f
Author: Mark Thomas 
AuthorDate: Thu Oct 31 20:31:28 2024 +

Fix BZ 69381 Improve method lookup performance

When the method has no arguments there is no requirement to consider
casting or coercion. Shortcut the method lookup process in that case.

Based on PR #770 by John Engebretson.
---
 java/javax/el/Util.java|  10 ++
 .../apache/el/parser/TestELParserPerformance.java  | 121 +
 test/org/apache/el/parser/TesterBeanD.java |  73 +
 test/org/apache/el/parser/TesterBeanE.java |  70 
 test/org/apache/el/parser/TesterEnum.java  |  23 
 webapps/docs/changelog.xml |   6 +
 6 files changed, 279 insertions(+), 24 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index e263f9d41d..e9983ecbb3 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -225,6 +225,16 @@ class Util {
 paramTypes = getTypesFromValues(paramValues);
 }
 
+// Fast path: when no arguments exist, there can only be one matching 
method and no need for coercion.
+if (paramTypes.length == 0) {
+try {
+Method method = clazz.getMethod(methodName, paramTypes);
+return getMethod(clazz, base, method);
+} catch (NoSuchMethodException | SecurityException e) {
+// Fall through to broader, slower logic
+}
+}
+
 Method[] methods = clazz.getMethods();
 
 List> wrappers = Wrapper.wrap(methods, methodName);
diff --git a/test/org/apache/el/parser/TestELParserPerformance.java 
b/test/org/apache/el/parser/TestELParserPerformance.java
index c02bad3a78..365c1f58c3 100644
--- a/test/org/apache/el/parser/TestELParserPerformance.java
+++ b/test/org/apache/el/parser/TestELParserPerformance.java
@@ -17,6 +17,10 @@
 package org.apache.el.parser;
 
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
 
 import javax.el.ELContext;
 import javax.el.ELManager;
@@ -34,20 +38,16 @@ import org.apache.tomcat.util.collections.SynchronizedStack;
  */
 public class TestELParserPerformance {
 
+private static final long DEFAULT_TEST_ITERATIONS = 100;
+
 /*
  * Test to explore if re-using Parser instances is faster.
  *
- * Tests on my laptop show:
- * - overhead by introducing the stack is in the noise for parsing even the
- *   simplest expression
- * - efficiency from re-using the ELParser is measurable for even a single
- *   reuse of the parser
- * - with large numbers of parses (~10k) performance for a trivial parse is
- *   three times faster
- * - around the 100 iterations mark GC overhead adds significant noise to
- *   the results - for consistent results you either need fewer parses to
- *   avoid triggering GC or more parses so the GC effects are evenly
- *   distributed between the runs
+ * Tests on my laptop show: - overhead by introducing the stack is in the 
noise for parsing even the simplest
+ * expression - efficiency from re-using the ELParser is measurable for 
even a single reuse of the parser - with
+ * large numbers of parses (~10k) performance for a trivial parse is three 
times faster - around the 100 iterations
+ * mark GC overhead adds significant noise to the results - for consistent 
results you either need fewer parses to
+ * avoid triggering GC or more parses so the GC effects are evenly 
distributed between the runs
  *
  * Note that the test is single threaded.
  */
@@ -59,11 +59,11 @@ public class TestELParserPerformance {
 long reinitTotalTime = 0;
 long newTotalTime = 0;
 
-for (int j = 0; j < runs; j ++) {
+for (int j = 0; j < runs; j++) {
 long start = System.nanoTime();
 SynchronizedStack stack = new SynchronizedStack<>();
 
-for (int i = 0; i < parseIterations; i ++) {
+for (int i = 0; i < parseIterations; i++) {
 ELParser parser = stack.pop();
 if (parser == null) {
 parser = new ELParser(new StringReader("${'foo'}"));
@@ -74,23 +74,21 @@ public class TestELParserPerformance {
 stack.push(parser);
 }
 long end = System.nanoTime();
-reinitTotalTime +=  (end - start);
+reinitTotalTime += (end - start);
 
-System.out.println(parseIterations +

Re: [PR] Reducing memory usage while evaluating reflective EL expressions [tomcat]

2024-10-31 Thread via GitHub


markt-asf commented on PR #770:
URL: https://github.com/apache/tomcat/pull/770#issuecomment-2450776553

   Those were the only changes required. Fix applied to main, 11.0.1, 10.1.x 
and 9.0.x.


-- 
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



Re: [PR] Reducing memory usage while evaluating reflective EL expressions [tomcat]

2024-10-31 Thread via GitHub


markt-asf closed pull request #770: Reducing memory usage while evaluating 
reflective EL expressions
URL: https://github.com/apache/tomcat/pull/770


-- 
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



[Bug 69381] Excess object copying while evaluating reflective method calls

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69381

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #5 from Mark Thomas  ---
Fixed in:
- 11.0.x for 11.0.1 onwards
- 10.1.x for 10.1.32 onwards
-  9.0.x for  9.0.97 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



(tomcat) branch main updated: Fix BZ 69381 Improve method lookup performance

2024-10-31 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 5b30d52b51 Fix BZ 69381 Improve method lookup performance
5b30d52b51 is described below

commit 5b30d52b5140a9472a19e8c214f98e27b30ad0f5
Author: Mark Thomas 
AuthorDate: Thu Oct 31 20:31:28 2024 +

Fix BZ 69381 Improve method lookup performance

When the method has no arguments there is no requirement to consider
casting or coercion. Shortcut the method lookup process in that case.

Based on PR #770 by John Engebretson.
---
 java/jakarta/el/Util.java  |  10 ++
 .../apache/el/parser/TestELParserPerformance.java  | 121 +
 test/org/apache/el/parser/TesterBeanD.java |  73 +
 test/org/apache/el/parser/TesterBeanE.java |  70 
 test/org/apache/el/parser/TesterEnum.java  |  23 
 5 files changed, 273 insertions(+), 24 deletions(-)

diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java
index c168de6e5b..59bc98b538 100644
--- a/java/jakarta/el/Util.java
+++ b/java/jakarta/el/Util.java
@@ -202,6 +202,16 @@ class Util {
 paramTypes = getTypesFromValues(paramValues);
 }
 
+// Fast path: when no arguments exist, there can only be one matching 
method and no need for coercion.
+if (paramTypes.length == 0) {
+try {
+Method method = clazz.getMethod(methodName, paramTypes);
+return getMethod(clazz, base, method);
+} catch (NoSuchMethodException | SecurityException e) {
+// Fall through to broader, slower logic
+}
+}
+
 Method[] methods = clazz.getMethods();
 
 List> wrappers = Wrapper.wrap(methods, methodName);
diff --git a/test/org/apache/el/parser/TestELParserPerformance.java 
b/test/org/apache/el/parser/TestELParserPerformance.java
index c5e8b5a3bc..85eac64240 100644
--- a/test/org/apache/el/parser/TestELParserPerformance.java
+++ b/test/org/apache/el/parser/TestELParserPerformance.java
@@ -17,6 +17,10 @@
 package org.apache.el.parser;
 
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
 
 import jakarta.el.ELBaseTest;
 import jakarta.el.ELContext;
@@ -35,20 +39,16 @@ import org.apache.tomcat.util.collections.SynchronizedStack;
  */
 public class TestELParserPerformance extends ELBaseTest {
 
+private static final long DEFAULT_TEST_ITERATIONS = 100;
+
 /*
  * Test to explore if re-using Parser instances is faster.
  *
- * Tests on my laptop show:
- * - overhead by introducing the stack is in the noise for parsing even the
- *   simplest expression
- * - efficiency from re-using the ELParser is measurable for even a single
- *   reuse of the parser
- * - with large numbers of parses (~10k) performance for a trivial parse is
- *   three times faster
- * - around the 100 iterations mark GC overhead adds significant noise to
- *   the results - for consistent results you either need fewer parses to
- *   avoid triggering GC or more parses so the GC effects are evenly
- *   distributed between the runs
+ * Tests on my laptop show: - overhead by introducing the stack is in the 
noise for parsing even the simplest
+ * expression - efficiency from re-using the ELParser is measurable for 
even a single reuse of the parser - with
+ * large numbers of parses (~10k) performance for a trivial parse is three 
times faster - around the 100 iterations
+ * mark GC overhead adds significant noise to the results - for consistent 
results you either need fewer parses to
+ * avoid triggering GC or more parses so the GC effects are evenly 
distributed between the runs
  *
  * Note that the test is single threaded.
  */
@@ -60,11 +60,11 @@ public class TestELParserPerformance extends ELBaseTest {
 long reinitTotalTime = 0;
 long newTotalTime = 0;
 
-for (int j = 0; j < runs; j ++) {
+for (int j = 0; j < runs; j++) {
 long start = System.nanoTime();
 SynchronizedStack stack = new SynchronizedStack<>();
 
-for (int i = 0; i < parseIterations; i ++) {
+for (int i = 0; i < parseIterations; i++) {
 ELParser parser = stack.pop();
 if (parser == null) {
 parser = new ELParser(new StringReader("${'foo'}"));
@@ -75,23 +75,21 @@ public class TestELParserPerformance extends ELBaseTest {
 stack.push(parser);
 }
 long end = System.nanoTime();
-reinitTotalTime +=  (end - start);
+reinitTotalTime += (end - start);
 
-System.out.println(parseIter

(tomcat) branch 10.1.x updated: Fix BZ 69398. Avoid repeated allocation of empty arrays.

2024-10-31 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 c13c2e5f3d Fix BZ 69398. Avoid repeated allocation of empty arrays.
c13c2e5f3d is described below

commit c13c2e5f3dd78de41eba79caed5859046078e82e
Author: Mark Thomas 
AuthorDate: Thu Oct 31 21:06:37 2024 +

Fix BZ 69398. Avoid repeated allocation of empty arrays.

Based on a suggestion by John Engebretson.
---
 java/org/apache/jasper/runtime/PageContextImpl.java |  7 +++
 webapps/docs/changelog.xml  | 13 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java 
b/java/org/apache/jasper/runtime/PageContextImpl.java
index bcec15ccff..604f0dc21e 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -67,6 +67,8 @@ public class PageContextImpl extends PageContext {
 
 private static final JspFactory jspf = JspFactory.getDefaultFactory();
 
+private static final BodyContentImpl[] EMPTY_BODY_CONTENT_IMPL_ARRAY = new 
BodyContentImpl[0];
+
 private BodyContentImpl[] outs;
 
 private int depth;
@@ -104,11 +106,8 @@ public class PageContextImpl extends PageContext {
 
 private transient JspWriterImpl baseOut;
 
-/*
- * Constructor.
- */
 PageContextImpl() {
-this.outs = new BodyContentImpl[0];
+this.outs = EMPTY_BODY_CONTENT_IMPL_ARRAY;
 this.attributes = new HashMap<>(16);
 this.depth = -1;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a536ea3cce..45c6396961 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -255,6 +255,12 @@
 when using tag pooling, and to be skipped when not using it.
 Patch submitted by Michal Sobkiewicz. (remm)
   
+  
+69381: Improve method lookup performance in expression
+language. When the required method has no arguments there is no need to
+consider casting or coercion and the method lookup process can be
+simplified. Based on pull request 770 by John Engebretson.
+  
   
 69382: Improve the performance of the JSP include action by
 re-using results of relatively expensive method calls in the generated
@@ -262,10 +268,9 @@
 (markt)
   
   
-69381: Improve method lookup performance in expression
-language. When the required method has no arguments there is no need to
-consider casting or coercion and the method lookup process can be
-simplified. Based on pull request 770 by John Engebretson.
+69398: Avoid unnecessary object allocation in
+PageContextImpl. Based on a suggestion by John 
Engebretson.
+(markt)
   
 
   


-
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 69398. Avoid repeated allocation of empty arrays.

2024-10-31 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 447e46c118 Fix BZ 69398. Avoid repeated allocation of empty arrays.
447e46c118 is described below

commit 447e46c11833f37f3eef1b48a8127e2db59711e8
Author: Mark Thomas 
AuthorDate: Thu Oct 31 21:06:37 2024 +

Fix BZ 69398. Avoid repeated allocation of empty arrays.

Based on a suggestion by John Engebretson.
---
 java/org/apache/jasper/runtime/PageContextImpl.java |  7 +++
 webapps/docs/changelog.xml  | 13 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java 
b/java/org/apache/jasper/runtime/PageContextImpl.java
index b38ce953f4..6e0bb13138 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -67,6 +67,8 @@ public class PageContextImpl extends PageContext {
 
 private static final JspFactory jspf = JspFactory.getDefaultFactory();
 
+private static final BodyContentImpl[] EMPTY_BODY_CONTENT_IMPL_ARRAY = new 
BodyContentImpl[0];
+
 private BodyContentImpl[] outs;
 
 private int depth;
@@ -104,11 +106,8 @@ public class PageContextImpl extends PageContext {
 
 private transient JspWriterImpl baseOut;
 
-/*
- * Constructor.
- */
 PageContextImpl() {
-this.outs = new BodyContentImpl[0];
+this.outs = EMPTY_BODY_CONTENT_IMPL_ARRAY;
 this.attributes = new HashMap<>(16);
 this.depth = -1;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 480c2d865d..7e67283949 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -255,6 +255,12 @@
 when using tag pooling, and to be skipped when not using it.
 Patch submitted by Michal Sobkiewicz. (remm)
   
+  
+69381: Improve method lookup performance in expression
+language. When the required method has no arguments there is no need to
+consider casting or coercion and the method lookup process can be
+simplified. Based on pull request 770 by John Engebretson.
+  
   
 69382: Improve the performance of the JSP include action by
 re-using results of relatively expensive method calls in the generated
@@ -262,10 +268,9 @@
 (markt)
   
   
-69381: Improve method lookup performance in expression
-language. When the required method has no arguments there is no need to
-consider casting or coercion and the method lookup process can be
-simplified. Based on pull request 770 by John Engebretson.
+69398: Avoid unnecessary object allocation in
+PageContextImpl. Based on a suggestion by John 
Engebretson.
+(markt)
   
 
   


-
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: Fix BZ 69398. Avoid repeated allocation of empty arrays.

2024-10-31 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 68d7c46d5e Fix BZ 69398. Avoid repeated allocation of empty arrays.
68d7c46d5e is described below

commit 68d7c46d5e475e15e0522eb5d31ee4e93d73b752
Author: Mark Thomas 
AuthorDate: Thu Oct 31 21:06:37 2024 +

Fix BZ 69398. Avoid repeated allocation of empty arrays.

Based on a suggestion by John Engebretson.
---
 java/org/apache/jasper/runtime/PageContextImpl.java |  7 +++
 webapps/docs/changelog.xml  | 13 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java 
b/java/org/apache/jasper/runtime/PageContextImpl.java
index e3e83acc50..07416529eb 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -66,6 +66,8 @@ public class PageContextImpl extends PageContext {
 
 private static final JspFactory jspf = JspFactory.getDefaultFactory();
 
+private static final BodyContentImpl[] EMPTY_BODY_CONTENT_IMPL_ARRAY = new 
BodyContentImpl[0];
+
 private BodyContentImpl[] outs;
 
 private int depth;
@@ -99,11 +101,8 @@ public class PageContextImpl extends PageContext {
 
 private transient JspWriterImpl baseOut;
 
-/*
- * Constructor.
- */
 PageContextImpl() {
-this.outs = new BodyContentImpl[0];
+this.outs = EMPTY_BODY_CONTENT_IMPL_ARRAY;
 this.attributes = new HashMap<>(16);
 this.depth = -1;
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 66f7f67ffa..fe0e9c9fe7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -255,6 +255,12 @@
 when using tag pooling, and to be skipped when not using it.
 Patch submitted by Michal Sobkiewicz. (remm)
   
+  
+69381: Improve method lookup performance in expression
+language. When the required method has no arguments there is no need to
+consider casting or coercion and the method lookup process can be
+simplified. Based on pull request 770 by John Engebretson.
+  
   
 69382: Improve the performance of the JSP include action by
 re-using results of relatively expensive method calls in the generated
@@ -262,10 +268,9 @@
 (markt)
   
   
-69381: Improve method lookup performance in expression
-language. When the required method has no arguments there is no need to
-consider casting or coercion and the method lookup process can be
-simplified. Based on pull request 770 by John Engebretson.
+69398: Avoid unnecessary object allocation in
+PageContextImpl. Based on a suggestion by John 
Engebretson.
+(markt)
   
 
   


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



[Bug 69398] Excess object allocation in PageContextImpl

2024-10-31 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69398

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 OS||All

--- Comment #1 from Mark Thomas  ---
Fixed in:
- 11.0.x for 11.0.1 onwards
- 10.1.x for 10.1.32 onwards
-  9.0.x for  9.0.97 onwards

Thanks for the suggestion.

-- 
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