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

java/awt/font/GlyphVector/NLGlyphTest.java fails on Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 17, 18
    • client-libs
    • 2d

      This test reliably fails on my Xubuntu 20.04:

      $ CONF=linux-x86_64-server-fastdebug make run-test TEST=java/awt/font/GlyphVector/NLGlyphTest.java

      ...

      STDERR:
      java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
      at java.desktop/sun.font.StandardGlyphVector.getGlyphCode(StandardGlyphVector.java:310)
      at NLGlyphTest.main(NLGlyphTest.java:46)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
      at java.base/java.lang.Thread.run(Thread.java:833)

      JavaTest Message: Test threw exception: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
      JavaTest Message: shutting down test

      Seems to fail here:

         public static void main(String[] args) {
            char[] chs = { '\n' };
            FontRenderContext frc = new FontRenderContext(null, true, true);
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            Font[] fonts = ge.getAllFonts();
            for (Font font : fonts) {
                GlyphVector cgv = font.createGlyphVector(frc, "\n");
                GlyphVector lgv = font.layoutGlyphVector(frc, chs, 0, 1, 0);
                int c_code = cgv.getGlyphCode(0);
                int l_code = lgv.getGlyphCode(0); <--- AIIOB

      Seems that "\n" produced no glyphs? I assume this is a test bug. [~prr], please advise how to fix this test?

            prr Philip Race
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: