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

[macosx] ArrayIndexOOB exception when displaying Devanagari text in JEditorPane

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      b137
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+106-2016-02-17-181354.javare.4476.nc)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+106-2016-02-17-181354.javare.4476.nc, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.11.3 (15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64)

      A DESCRIPTION OF THE PROBLEM :
      Merely calling JEditorPane.setText() with Devanagari text causes an ArrayIndexOutOfBounds exception on Java 9. See code sample.

      While investigating incorrect rendering of Devanagari ligatures on OS X (https://sourceforge.net/p/omegat/bugs/800/), I came across JDK-7162125 and thought to try Java 9. I don't know for sure that the latter is related.

      The issue does not occur in Java 8 or earlier.

      REGRESSION. Last worked in version 8u73

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


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run supplied test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception
      ACTUAL -
      ArrayIndexOutOfBoundsException

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 40
      at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:814)
      at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
      at sun.font.ExtendedTextSourceLabel.getLineBreakIndex(ExtendedTextSourceLabel.java:480)
      at java.awt.font.TextMeasurer.calcLineBreak(TextMeasurer.java:330)
      at java.awt.font.TextMeasurer.getLineBreakIndex(TextMeasurer.java:566)
      at java.awt.font.LineBreakMeasurer.nextOffset(LineBreakMeasurer.java:359)
      at java.awt.font.LineBreakMeasurer.nextLayout(LineBreakMeasurer.java:440)
      at javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:324)
      at javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:70)
      at javax.swing.text.FlowView.loadChildren(FlowView.java:151)
      at javax.swing.text.CompositeView.setParent(CompositeView.java:139)
      at javax.swing.text.FlowView.setParent(FlowView.java:297)
      at javax.swing.text.CompositeView.replace(CompositeView.java:217)
      at javax.swing.text.BoxView.replace(BoxView.java:182)
      at javax.swing.text.CompositeView.loadChildren(CompositeView.java:114)
      at javax.swing.text.CompositeView.setParent(CompositeView.java:139)
      at javax.swing.plaf.basic.BasicTextUI$RootView.setView(BasicTextUI.java:1369)
      at javax.swing.plaf.basic.BasicTextUI.setView(BasicTextUI.java:707)
      at javax.swing.plaf.basic.BasicTextUI.modelChanged(BasicTextUI.java:696)
      at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1903)
      at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:203)
      at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:754)
      at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:713)
      at javax.swing.text.PlainDocument.insertString(PlainDocument.java:131)
      at javax.swing.text.DefaultEditorKit.read(DefaultEditorKit.java:274)
      at javax.swing.JEditorPane.setText(JEditorPane.java:1423)
      at DevanagariTest.main(DevanagariTest.java:5)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JEditorPane;

      public class DevanagariTest {
          public static void main(String[] args) {
              new JEditorPane().setText("\u0930\u093E\u0915\u094D\u0937\u0938");
          }
      }

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

        Attachments

          Activity

            People

            • Assignee:
              prr Philip Race
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: