hotspot/src/share/vm/classfile/stringTable.cpp
changeset 42057 6a5b8ebcd3f2
parent 40655 9f644073d3a0
child 46271 979ebd346ecf
child 44323 1566bea4793a
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Mon May 23 19:46:43 2016 +0200
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Wed Oct 26 14:36:05 2016 +0200
@@ -437,17 +437,15 @@
           st->print("%d: ", length);
         } else {
           ResourceMark rm(THREAD);
-          int utf8_length;
+          int utf8_length = length;
           char* utf8_string;
 
           if (!is_latin1) {
             jchar* chars = value->char_at_addr(0);
-            utf8_length = UNICODE::utf8_length(chars, length);
-            utf8_string = UNICODE::as_utf8(chars, length);
+            utf8_string = UNICODE::as_utf8(chars, utf8_length);
           } else {
             jbyte* bytes = value->byte_at_addr(0);
-            utf8_length = UNICODE::utf8_length(bytes, length);
-            utf8_string = UNICODE::as_utf8(bytes, length);
+            utf8_string = UNICODE::as_utf8(bytes, utf8_length);
           }
 
           st->print("%d: ", utf8_length);