< prev index next >

src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java

Print this page
@@ -48,12 +48,16 @@
                  protected Object initialValue() {
                      return new char[20];
                  }
              };
  
-     private static char[] getBuffer(){
-         return (char[]) threadLocalCharBuffer.get();
+     private static char[] getBuffer() {
+         if (Thread.currentThread().isVirtual()) {
+             return new char[20];
+         } else {
+             return (char[]) threadLocalCharBuffer.get();
+         }
      }
  
      private FormattedFloatingDecimal(int precision, Form form, FloatingDecimal.BinaryToASCIIConverter fdConverter) {
          if (fdConverter.isExceptional()) {
              this.mantissa = fdConverter.toJavaFormatString().toCharArray();
< prev index next >