-
Bug
-
Resolution: Fixed
-
P4
-
11, 12
-
b17
In the jcmd execute() method, the bytes received from the VM are read into a 256 byte array and then converted to a String via:
String s = new String(b, 0, n, "UTF-8");
Since UTF-8 can have characters spanning multiple bytes, the last character might not be fully in the byte array, so it will not be printed. In addition we start with an invalid character in the next iteration of the loop.
It is better to use a InputStreamReader, which handles all the intricacies of this scenario.
String s = new String(b, 0, n, "UTF-8");
Since UTF-8 can have characters spanning multiple bytes, the last character might not be fully in the byte array, so it will not be printed. In addition we start with an invalid character in the next iteration of the loop.
It is better to use a InputStreamReader, which handles all the intricacies of this scenario.
- relates to
-
JDK-8227868 jinfo and jstack can fail converting UTF8 output to strings
-
- Resolved
-
-
JDK-8224642 Test sun/tools/jcmd/TestJcmdSanity.java fails: Bad file descriptor
-
- Resolved
-