From 897931b68c89788eeb71398c8e6dfda1d5bae161 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Thu, 8 Jun 2023 13:58:09 +0100 Subject: [PATCH] Fix BZ 66627 - restore documented behaviour of MessageBytes.getType() --- java/org/apache/tomcat/util/buf/MessageBytes.java | 4 ---- webapps/docs/changelog.xml | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/MessageBytes.java b/java/org/apache/tomcat/util/buf/MessageBytes.java index 0aacbd83d6a0..e47d91fc9585 100644 --- a/java/org/apache/tomcat/util/buf/MessageBytes.java +++ b/java/org/apache/tomcat/util/buf/MessageBytes.java @@ -169,11 +169,9 @@ public String toString() { // No conversion required break; case T_BYTES: - type = T_STR; strValue = byteC.toString(); break; case T_CHARS: - type = T_STR; strValue = charC.toString(); break; } @@ -272,7 +270,6 @@ public void toBytes() { } byteC.setBytes(bb.array(), bb.arrayOffset(), bb.limit()); - type = T_BYTES; } @@ -294,7 +291,6 @@ public void toChars() { toString(); //$FALL-THROUGH$ case T_STR: { - type = T_CHARS; char cc[] = strValue.toCharArray(); charC.setChars(cc, 0, cc.length); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index d588713061aa..ac699016b398 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -114,6 +114,16 @@ + + + + 66627: Restore the documented behaviour of + MessageBytes.getType() that it returns the type of the + original content rather than reflecting the most recent conversion. + (markt) + + +