Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8172967

[macosx] Exception while working with layout for text containing unmappable character

XMLWordPrintable

    • 2d
    • b158
    • x86
    • os_x

        FULL PRODUCT VERSION :
        java version "9-ea"
        Java(TM) SE Runtime Environment (build 9-ea+151)
        Java HotSpot(TM) 64-Bit Server VM (build 9-ea+151, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        macOS Sierra 10.12.2

        A DESCRIPTION OF THE PROBLEM :
        For certain text/font combinations, exception occurs in text layout code.

        REGRESSION. Last worked in version 8u112

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_112"
        Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
        Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the sample program given below.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Program finishes normally.
        ACTUAL -
        Exception is thrown (see below).


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "main" java.lang.NullPointerException
        at java.desktop/sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:701)
        at java.desktop/sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
        at java.desktop/sun.font.ExtendedTextSourceLabel.getCharX(ExtendedTextSourceLabel.java:357)
        at java.desktop/java.awt.font.TextLine$3.computeFunction(TextLine.java:517)
        at java.desktop/java.awt.font.TextLine.applyFunctionAtIndex(TextLine.java:653)
        at java.desktop/java.awt.font.TextLine.getCharXPosition(TextLine.java:670)
        at java.desktop/java.awt.font.TextLine.getCharLinePosition(TextLine.java:680)
        at java.desktop/java.awt.font.TextLayout.getCaretInfo(TextLayout.java:1139)
        at java.desktop/java.awt.font.TextLayout.getCaretInfoTestInternal(TextLayout.java:1235)
        at java.desktop/java.awt.font.TextLayout.getCaretInfo(TextLayout.java:1218)
        at java.desktop/java.awt.font.TextLayout.getCaretPath(TextLayout.java:1629)
        at java.desktop/java.awt.font.TextLayout.getCaretShapes(TextLayout.java:1891)
        at java.desktop/java.awt.font.TextLayout.getCaretShapes(TextLayout.java:1945)
        at FontLayoutBugTest.main(FontLayoutBugTest.java:10)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.*;
        import java.awt.font.*;

        public class FontLayoutBugTest {
            public static void main(String[] args) {
                Font font = new Font("Tahoma", Font.PLAIN, 12);
                String text = "\ude00";
                FontRenderContext frc = new FontRenderContext(null, false, false);
                TextLayout layout = new TextLayout(text, font, frc);
                layout.getCaretShapes(0);
            }
        }

        ---------- END SOURCE ----------

              prr Philip Race
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: