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 482ac05bd0 Use the previous decode call in the old default for now 482ac05bd0 is described below commit 482ac05bd019c2c7eaed36ec4958673b23237605 Author: remm <r...@apache.org> AuthorDate: Fri Jun 23 09:43:40 2023 +0200 Use the previous decode call in the old default for now Just in case it makes a performance difference (the JVM code is very different). --- java/org/apache/tomcat/util/buf/ByteChunk.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java b/java/org/apache/tomcat/util/buf/ByteChunk.java index ff00f55774..27c985e6e2 100644 --- a/java/org/apache/tomcat/util/buf/ByteChunk.java +++ b/java/org/apache/tomcat/util/buf/ByteChunk.java @@ -579,8 +579,13 @@ public final class ByteChunk extends AbstractChunk { // new String(byte[], int, int, Charset) takes a defensive copy of the // entire byte array. This is expensive if only a small subset of the // bytes will be used. The code below is from Apache Harmony. - CharBuffer cb = charset.newDecoder().onMalformedInput(malformedInputAction) - .onUnmappableCharacter(unmappableCharacterAction).decode(ByteBuffer.wrap(buff, start, end - start)); + CharBuffer cb; + if (malformedInputAction == CodingErrorAction.REPLACE && unmappableCharacterAction == CodingErrorAction.REPLACE) { + cb = charset.decode(ByteBuffer.wrap(buff, start, end - start)); + } else { + cb = charset.newDecoder().onMalformedInput(malformedInputAction) + .onUnmappableCharacter(unmappableCharacterAction).decode(ByteBuffer.wrap(buff, start, end - start)); + } return new String(cb.array(), cb.arrayOffset(), cb.length()); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org