-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
b89
-
generic
-
solaris_2.6
The specification for ByteArrayOutputStream asserts that the "data can be
retrieved using ... toString()." This is not true. You can't just "retrieve" a byte array into a string -- you have to somehow convert each 8-bit signed value into a 16-bit unsigned value.
This assertion is almost true (and does little harm) when applied to the deprecated variant of toString(), which performs a simple, reversible padding on each byte. But the other variants transform each byte in complicated, locale-specific ways -- transformations that are often not reversible.
Unfortunately many programmers assume that getString() *is* reversible. The result is a lot of code that is unintentionally locale-specific.
retrieved using ... toString()." This is not true. You can't just "retrieve" a byte array into a string -- you have to somehow convert each 8-bit signed value into a 16-bit unsigned value.
This assertion is almost true (and does little harm) when applied to the deprecated variant of toString(), which performs a simple, reversible padding on each byte. But the other variants transform each byte in complicated, locale-specific ways -- transformations that are often not reversible.
Unfortunately many programmers assume that getString() *is* reversible. The result is a lot of code that is unintentionally locale-specific.