8301065: Handle control characters in java_lang_String::print
Reviewed-by: iklam, dholmes
This commit is contained in:
parent
4b23bef51d
commit
41d6be4d80
@ -765,8 +765,13 @@ void java_lang_String::print(oop java_string, outputStream* st) {
|
||||
|
||||
st->print("\"");
|
||||
for (int index = 0; index < length; index++) {
|
||||
st->print("%c", (!is_latin1) ? value->char_at(index) :
|
||||
((jchar) value->byte_at(index)) & 0xff );
|
||||
jchar c = (!is_latin1) ? value->char_at(index) :
|
||||
((jchar) value->byte_at(index)) & 0xff;
|
||||
if (c < ' ') {
|
||||
st->print("\\x%02X", c); // print control characters e.g. \x0A
|
||||
} else {
|
||||
st->print("%c", c);
|
||||
}
|
||||
}
|
||||
st->print("\"");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user