[Bug 69377] JSP optimization via custom code generation

2025-04-22 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69377

--- Comment #16 from Mark Thomas  ---
Looks OK to me.

-- 
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 69576] Tomcat doesn't start on JDK 17 due to an ExceptionInInitializerError

2025-04-22 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69576

--- Comment #21 from John Harby  ---
As an alternative I was able to resolve this by adding this to my VM args in my
run configuration:

—add-opens java.base/java.io=ALL-UNNAMED

-- 
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 10.1.x updated (e5a38b277d -> 152c5259ef)

2025-04-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


from e5a38b277d Code clean-up - formatting. No functional change
 new 6efa30ff03 Refactor so the buffered data is used directly rather than 
copied
 new 152c5259ef Replace the unused buffer with a zero length, static 
instance.

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


Summary of changes:
 java/org/apache/catalina/connector/InputBuffer.java   | 19 ++-
 .../http11/filters/SavedRequestInputFilter.java   |  9 -
 webapps/docs/changelog.xml| 13 +
 3 files changed, 31 insertions(+), 10 deletions(-)


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



(tomcat) 02/02: Replace the unused buffer with a zero length, static instance.

2025-04-22 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

commit 152c5259ef48a0ad768193d90c974125c59ac089
Author: Mark Thomas 
AuthorDate: Thu Jan 9 15:19:00 2025 +

Replace the unused buffer with a zero length, static instance.
---
 java/org/apache/catalina/connector/InputBuffer.java | 19 ++-
 webapps/docs/changelog.xml  |  5 +
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/InputBuffer.java 
b/java/org/apache/catalina/connector/InputBuffer.java
index b5e6a38088..2de7d243af 100644
--- a/java/org/apache/catalina/connector/InputBuffer.java
+++ b/java/org/apache/catalina/connector/InputBuffer.java
@@ -60,6 +60,8 @@ public class InputBuffer extends Reader implements 
ByteChunk.ByteInputChannel, A
 
 private static final Log log = LogFactory.getLog(InputBuffer.class);
 
+private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
+
 public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
 
 // The buffer can be used for byte[] and char[] reading
@@ -76,8 +78,11 @@ public class InputBuffer extends Reader implements 
ByteChunk.ByteInputChannel, A
 
 // - Instance Variables
 
-/**
- * The byte buffer.
+/*
+ * The byte buffer. Data is always injected into this class by calling 
{@link #setByteBuffer(ByteBuffer)} rather
+ * than copying data into any existing buffer. It is initialised to an 
empty buffer as there are code paths that
+ * access the buffer when it is expected to be empty and an empty buffer 
gives cleaner code than lots of null
+ * checks.
  */
 private ByteBuffer bb;
 
@@ -151,8 +156,8 @@ public class InputBuffer extends Reader implements 
ByteChunk.ByteInputChannel, A
 public InputBuffer(int size) {
 
 this.size = size;
-bb = ByteBuffer.allocate(size);
-clear(bb);
+// Will be replaced when there is data to read so initialise to empty 
buffer.
+bb = EMPTY_BUFFER;
 cb = CharBuffer.allocate(size);
 clear(cb);
 readLimit = size;
@@ -191,7 +196,11 @@ public class InputBuffer extends Reader implements 
ByteChunk.ByteInputChannel, A
 }
 readLimit = size;
 markPos = -1;
-clear(bb);
+/*
+ * This buffer will have been replaced if there was data to read so 
re-initialise to an empty buffer to clear
+ * any reference to an injected buffer.
+ */
+bb = EMPTY_BUFFER;
 closed = false;
 
 if (conv != null) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f6e77ef9bf..4424d5e404 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,11 @@
 843: Fix off by one validation logic for partial PUT ranges
 and associated test case. Submitted by Chenjp. (remm)
   
+  
+Replace the unused buffer in
+org.apache.catalina.connector.InputBuffer with a static,
+zero length buffer. (markt)
+  
 
   
   


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



(tomcat) 01/02: Refactor so the buffered data is used directly rather than copied

2025-04-22 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

commit 6efa30ff03710df8af8e6fb139c60cc8048200a8
Author: Mark Thomas 
AuthorDate: Thu Jan 9 14:01:18 2025 +

Refactor so the buffered data is used directly rather than copied

This also aligns with other uses of o.a.catalina.connector.InputBuffer
where a pre-populated buffer replaces InputBuffer#bb rather than the
data being copied into the existing InputBuffer#bb
---
 .../apache/coyote/http11/filters/SavedRequestInputFilter.java| 9 -
 webapps/docs/changelog.xml   | 8 
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java 
b/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
index 8e02af182d..c6609be67a 100644
--- a/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
+++ b/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
@@ -49,11 +49,10 @@ public class SavedRequestInputFilter implements InputFilter 
{
 return -1;
 }
 
-ByteBuffer byteBuffer = handler.getByteBuffer();
-byteBuffer.position(byteBuffer.limit()).limit(byteBuffer.capacity());
-input.subtract(byteBuffer);
-
-return byteBuffer.remaining();
+int len = input.getLength();
+handler.setByteBuffer(ByteBuffer.wrap(input.getBytes(), 
input.getStart(), len));
+input.setStart(input.getEnd());
+return len;
 }
 
 /**
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 359dd465f2..f6e77ef9bf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -135,6 +135,14 @@
   
 
   
+  
+
+  
+Refactor the SavedRequestInputFilter so the buffered data
+is used directly rather than copied. (markt)
+  
+
+  
   
 
   


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