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

ArrayIndexOutOfBoundsException: -1 in JavaFX Application Thread

    Details

      Description

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

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X El Capitan 10.11.6

      A DESCRIPTION OF THE PROBLEM :
      Description:
      JavaFX repeatedly throws ArrayIndexOutOfBoundsExceptions
      while another Thread renders a WritableImage
      using PixelWriter.setArgb(int,int,int)
      (to see the progress line by line).
      The exceptions are printed multiple times,
      The program does not stop,
      it continues printing exceptions, freezes the Stage.
      Sometimes this starts right after starting the Application,
      sometimes after images are rendered a few times.

      (I'm using NetBeans)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look at
      javafx.scene.Parent.updateCachedBounds(Parent.java:1591)
      (from the stack trace)

      Because there is a loop iterating backwards:
      for (int i = dirtyNodes.size() - 1; remainingDirtyNodes > 0; --i)
      that probably causes ArrayIndex...exception -1 !!!

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Was not expecting exceptions.
      The program renders on another thread to keep the UI responsive.
      Modifying the image on another thread might cause the problems.
      Maybe, many calls to PixelWriter.setArgb cause some kind of overflow.
      The stack trace contains the word "pulse" many times.
      ACTUAL -
      Window freezes, the output shows red lines.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Output:

      compile-single:
      run-single:
      Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: -1
      at java.util.ArrayList.elementData(ArrayList.java:418)
      at java.util.ArrayList.get(ArrayList.java:431)
      at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
      at com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)

      // problem might be here:
      at javafx.scene.Parent.updateCachedBounds(Parent.java:1591)
      at javafx.scene.Parent.recomputeBounds(Parent.java:1535)
      at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1388)
      at javafx.scene.layout.Region.impl_computeGeomBounds(Region.java:3078)
      at javafx.scene.Node.updateGeomBounds(Node.java:3577)
      at javafx.scene.Node.getGeomBounds(Node.java:3530)
      at javafx.scene.Node.updateBounds(Node.java:564)
      at javafx.scene.Parent.updateBounds(Parent.java:1719)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2404)
      at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
      at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

      Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: -1



      … many more ArrayIndexOutOfBoundsExceptions …

      BUILD STOPPED (total time: 8 seconds)

      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      Maybe I will remove the image from the Pane during rendering.
      (did not try that yet)

        Attachments

          Activity

            People

            • Assignee:
              pmangal Priyanka Mangal (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: