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

FlowView.layout causes ArrayIndexOutOfBoundsException

XMLWordPrintable

    • b09
    • 6
    • b97
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      This code in FlowView.FlowStrategy.layout is problematic as it's written in JDK 1.6:

                      rowIndex = fv.getViewIndexAtPosition(damageStart);
                      if (rowIndex > 0) {
                          rowIndex--;
                      }
                      p0 = fv.getView(rowIndex).getStartOffset();

      Since fv.getViewIndexAtPosition can return -1, the later fv.getView(rowIndex) can (and often does) throw ArrayIndexOutOfBoundsException.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This is easily generated on my machine using a JEditorPane in HTML mode with editable = true and an embedded image. Just select some nearby text and it happens. I haven't done the work to extract that code into a simple runnable, but since the fix would be so easy hopefully this won't be necessary.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In JDK 1.5 there are no exceptions.
      ACTUAL -
      An exception is thrown, then nothing in the box is rendered until something triggers a clean redraw.

      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      Since everything in the stack trace is Sun/Swing code, I could find no easy work-around. The only practical workaround is to not use JDK 1.6.

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            peterz Peter Zhelezniakov
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: