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

ArrayIndexOutOfBounds is thrown in Parent.updateCachedBounds

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux mintleaf 4.6.4-301.fc24.x86_64 #1 SMP Tue Jul 12 11:50:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When removing a Node from the scene graph (in a specific situation), while there are change listeners for the bounds of some nodes, an ArrayIndexOutOfBounds is thrown in Parent.updateCachedBounds.

      The specific situation is reproduced by the example code below.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Save the attached source code as App.java

      Run
      javac App.java
      java App


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program terminates without output (since the test code never makes the stage visible).
      ACTUAL -
      An ArrayIndexOutOfBounds exception is thrown.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Aug 01, 2016 3:41:27 PM javafx.beans.binding.Bindings$2 computeValue
      WARNING: Exception while evaluating binding
      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)
      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:3579)
      at javafx.scene.Node.getGeomBounds(Node.java:3532)
      at javafx.scene.Node.getLocalBounds(Node.java:3480)
      at javafx.scene.Node.updateTxBounds(Node.java:3643)
      at javafx.scene.Node.getTransformedBounds(Node.java:3426)
      at javafx.scene.Parent.getChildTransformedBounds(Parent.java:1732)
      at javafx.scene.Parent.recomputeBounds(Parent.java:1524)
      at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1388)
      at javafx.scene.Node.updateGeomBounds(Node.java:3579)
      at javafx.scene.Node.getGeomBounds(Node.java:3532)
      at javafx.scene.Node.impl_computeLayoutBounds(Node.java:3376)
      at javafx.scene.Group.impl_computeLayoutBounds(Group.java:165)
      at javafx.scene.Node$12.computeBounds(Node.java:3225)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9308)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9278)
      at javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:50)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:178)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.scene.Node$LazyBoundsProperty.invalidate(Node.java:9318)
      at javafx.scene.Node.impl_layoutBoundsChanged(Node.java:3403)
      at javafx.scene.Node.impl_notifyLayoutBoundsChanged(Node.java:3816)
      at javafx.scene.Node.impl_geomChanged(Node.java:3767)
      at javafx.scene.Parent.childBoundsChanged(Parent.java:1757)
      at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3838)
      at javafx.scene.Node.transformedBoundsChanged(Node.java:3800)
      at javafx.scene.Node.impl_geomChanged(Node.java:3761)
      at javafx.scene.Parent.childBoundsChanged(Parent.java:1757)
      at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3838)
      at javafx.scene.Node.transformedBoundsChanged(Node.java:3800)
      at javafx.scene.Node.impl_geomChanged(Node.java:3761)
      at javafx.scene.Parent.childBoundsChanged(Parent.java:1757)
      at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3838)
      at javafx.scene.Node.transformedBoundsChanged(Node.java:3800)
      at javafx.scene.Node.impl_geomChanged(Node.java:3761)
      at javafx.scene.layout.Region.widthChanged(Region.java:873)
      at javafx.scene.layout.Region.setWidth(Region.java:856)
      at javafx.scene.layout.Region.resize(Region.java:1364)
      at javafx.scene.Node.autosize(Node.java:2897)
      at javafx.scene.Parent.layoutChildren(Parent.java:1116)
      at javafx.scene.Group.layoutChildren(Group.java:226)
      at javafx.scene.Parent.layout(Parent.java:1087)
      at javafx.scene.Group.impl_computeLayoutBounds(Group.java:164)
      at javafx.scene.Node$12.computeBounds(Node.java:3225)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9308)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9278)
      at App.lambda$start$0(App.java:23)
      at javafx.beans.binding.Bindings$2.computeValue(Bindings.java:174)
      at javafx.beans.binding.DoubleBinding.get(DoubleBinding.java:203)
      at javafx.beans.property.DoublePropertyBase.get(DoublePropertyBase.java:133)
      at javafx.scene.shape.Line.getEndX(Line.java:195)
      at javafx.scene.shape.Line.impl_computeGeomBounds(Line.java:265)
      at javafx.scene.Node.updateGeomBounds(Node.java:3579)
      at javafx.scene.Node.getGeomBounds(Node.java:3532)
      at javafx.scene.Node.getLocalBounds(Node.java:3480)
      at javafx.scene.Node.updateTxBounds(Node.java:3643)
      at javafx.scene.Node.getTransformedBounds(Node.java:3426)
      at javafx.scene.Parent.getChildTransformedBounds(Parent.java:1732)
      at javafx.scene.Parent.updateCachedBounds(Parent.java:1596)
      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:3579)
      at javafx.scene.Node.getGeomBounds(Node.java:3532)
      at javafx.scene.Node.getLocalBounds(Node.java:3480)
      at javafx.scene.Node$MiscProperties$2.computeBounds(Node.java:6474)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9308)
      at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9278)
      at javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:50)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:178)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.scene.Node$LazyBoundsProperty.invalidate(Node.java:9318)
      at javafx.scene.Node$MiscProperties.invalidateBoundsInLocal(Node.java:6502)
      at javafx.scene.Node.invalidateBoundsInLocal(Node.java:3188)
      at javafx.scene.Node.localBoundsChanged(Node.java:3781)
      at javafx.scene.Node.impl_geomChanged(Node.java:3768)
      at javafx.scene.Parent.childBoundsChanged(Parent.java:1757)
      at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3838)
      at javafx.scene.Node.transformedBoundsChanged(Node.java:3800)
      at javafx.scene.Node.localBoundsChanged(Node.java:3782)
      at javafx.scene.Node.impl_geomChanged(Node.java:3768)
      at javafx.scene.shape.Line.access$200(Line.java:58)
      at javafx.scene.shape.Line$3.invalidated(Line.java:174)
      at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:112)
      at javafx.beans.property.DoublePropertyBase.access$000(DoublePropertyBase.java:52)
      at javafx.beans.property.DoublePropertyBase$Listener.invalidated(DoublePropertyBase.java:263)
      at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.beans.binding.DoubleBinding.invalidate(DoubleBinding.java:222)
      at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:51)
      at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.scene.Node$LazyBoundsProperty.invalidate(Node.java:9318)
      at javafx.scene.Node.impl_layoutBoundsChanged(Node.java:3403)
      at javafx.scene.Node.impl_notifyLayoutBoundsChanged(Node.java:3816)
      at javafx.scene.Node.impl_geomChanged(Node.java:3767)
      at javafx.scene.Parent.childBoundsChanged(Parent.java:1757)
      at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3838)
      at javafx.scene.Node.transformedBoundsChanged(Node.java:3800)
      at javafx.scene.Node.localBoundsChanged(Node.java:3782)
      at javafx.scene.Node.impl_geomChanged(Node.java:3768)
      at javafx.scene.Parent$1.onChanged(Parent.java:343)
      at com.sun.javafx.collections.TrackableObservableList.lambda$new$19(TrackableObservableList.java:45)
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
      at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
      at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
      at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:183)
      at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:332)
      at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
      at App.start(App.java:33)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
      at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
      at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
      at java.lang.Thread.run(Thread.java:745)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.beans.binding.DoubleBinding;
      import javafx.scene.Group;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.VBox;
      import javafx.scene.shape.Line;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class App extends Application {
          public static void main(String args[]) {
              launch();
          }

          public void start(Stage primaryStage){
              Text t = new Text("x");
              HBox h = new HBox(t);
              Group g = new Group(h);

              Line l = new Line();
              DoubleBinding innerWidth = javafx.beans.binding.Bindings.createDoubleBinding(
                      () -> g.layoutBoundsProperty().get().getWidth(),
                      g.layoutBoundsProperty());
              l.endXProperty().bind(innerWidth);

              VBox v = new VBox(l, g);
              v.boundsInLocalProperty().addListener((a,b,c) -> {});

              Group g2 = new Group(v);
              g2.layoutBoundsProperty().addListener((a,b,c) -> {});

              h.getChildren().remove(t);

              Platform.exit();
          }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arapte Ambarish Rapte
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: