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