java3d
  1. java3d
  2. JAVA3D-35

IndexOutOfBoundsException while create scene with OrderedGroup

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: not determined
    • Component/s: j3d-core
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

    • Issuezilla Id:
      35
    • Status Whiteboard:
      Hide

      owner-needed

      Show
      owner-needed

      Description

      Note : This is a transfered bug from BugTraq : BugId 4900656.

      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
      Java3D 1.3.1 FSC SDK for Win32/DirectX

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Intel Pentium IV 2.2GHz/512DDR/NVidia Geforce MX400 64SDRAM/DirectX 8.1

      A DESCRIPTION OF THE PROBLEM :
      java.lang.IndexOutOfBoundsException while compile scene with OrderedGroup which
      contains such tree in one of its child (OrderedGroup child quantity is more than 1):

      OrderedGroup

      TG2
      / TG21 TG22

       

      Shape0 Shape1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      /* This application reproduces this bug:
      1. Compile and run an application with "createSceneGraph()" method described
      below to see error stack.
      2. Comment code block which reproduces error and recomment code block that works
      well (see method "createSceneGraph()" closely), also you can replace DecalGroup
      by BranchGroup. Compile again. Run and enjoy.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1. We can see 3 spheres rendering in DecalGroup.
      2. We can see 3 spheres rendering in DecalGroup.
      ACTUAL -
      1. We can see error stack trace.
      2. We can see 3 spheres rendering in DecalGroup.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
      at java.util.ArrayList.RangeCheck(Unknown Source)
      at java.util.ArrayList.get(Unknown Source)
      at javax.media.j3d.OrderedGroupRetained.setAuxData(OrderedGroupRetained.java:325)
      at javax.media.j3d.OrderedGroupRetained.setNodeData(OrderedGroupRetained.java:363)
      at javax.media.j3d.NodeRetained.doSetLive(NodeRetained.java:639)
      at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2143)
      at javax.media.j3d.GroupRetained.setLive(GroupRetained.java:2117)
      at javax.media.j3d.OrderedGroupRetained.setLive(OrderedGroupRetained.java:332)
      at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2125)
      at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2180)
      at javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:160)
      at javax.media.j3d.Locale.doAddBranchGraph(Locale.java:204)
      at javax.media.j3d.Locale.addBranchGraph(Locale.java:163)
      at
      com.sun.j3d.utils.universe.SimpleUniverse.addBranchGraph(SimpleUniverse.java:356)
      at GroupTest.init(GroupTest.java:159)
      at com.sun.j3d.utils.applet.MainFrame.run(MainFrame.java:262)
      at java.lang.Thread.run(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.
      ---------- BEGIN SOURCE ----------
      public BranchGroup createSceneGraph()
      {
      BranchGroup objRoot = new BranchGroup();
      // Create a Transformgroup to scale all objects so they
      // appear in the scene.
      TransformGroup objScale = new TransformGroup();
      Transform3D t3d = new Transform3D();
      t3d.setScale(0.4);
      objScale.setTransform(t3d);

      DecalGroup dg = new DecalGroup();
      //Try branchgroup:
      //BranchGroup dg = new BranchGroup();

      objScale.addChild(dg);
      objRoot.addChild(objScale);
      BoundingSphere bounds =
      new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
      Background bg = new Background(new Color3f(0.0f, 0.0f, 1.0f));
      bg.setApplicationBounds(bounds);
      objScale.addChild(bg);

      // Create a Sphere objects:
      Material m = new Material();
      m.setEmissiveColor(new Color3f(1.0f, 0.0f, 0.0f));
      Appearance a = new Appearance();
      m.setLightingEnable(true);
      a.setMaterial(m);

      Sphere sph1= new Sphere(1.0f, Sphere.GENERATE_NORMALS, 80, a); //Red sphere

      Material m1 = new Material();
      m1.setEmissiveColor(new Color3f(0.0f, 1.0f, 0.0f));
      Appearance a1 = new Appearance();
      m1.setLightingEnable(true);
      a1.setMaterial(m1);

      Sphere sph2= new Sphere(1.0f, Sphere.GENERATE_NORMALS, 80, a1); //Green sphere

      Material m2 = new Material();
      m2.setEmissiveColor(new Color3f(0.0f, 1.0f, 1.0f));
      Appearance a2 = new Appearance();
      m2.setLightingEnable(true);
      a2.setMaterial(m2);

      Sphere sph3= new Sphere(1.0f, Sphere.GENERATE_NORMALS, 80, a2); //Cyan sphere

      TransformGroup TG1 = new TransformGroup();
      TransformGroup TG2 = new TransformGroup();
      TransformGroup TG21 = new TransformGroup();
      TransformGroup TG22 = new TransformGroup();
      Transform3D t22 = new Transform3D();
      t22.setTranslation(new Vector3d(0.5, 0.5, 0.0));
      TG22.setTransform(t22);

      Transform3D t = new Transform3D();
      Vector3d lPos1 = new Vector3d(0.0, 0.5, 0.0);
      t.set(lPos1);
      TG1.setTransform(t);

      Transform3D t1 = new Transform3D();
      Vector3d lPos2 = new Vector3d(0.0, -0.5, 0.0);
      t1.set(lPos2);
      TG2.setTransform(t1);

      //----------------------
      /* There is java.lang.IndexOutOfBoundsException here while
      "u.addBranchGraph(scene)".
      We have such scene tree:

      objRoot (BranchGroup)

      objScale (TransformGroup)

      dg (DecalGroup)

       

      TG1 TG2

      / sph1 TG21 TG22
       

      sph2 sph3
      */
      //--- Comment this block for test ---------
      /**/
      dg.addChild(TG1); //First decal member (red sphere)
      dg.addChild(TG2);
      TG2.addChild(TG21);
      TG2.addChild(TG22);
      TG1.addChild(sph1);
      TG21.addChild(sph2);
      TG22.addChild(sph3); /**/
      //----------------------

      //----------------------
      /* There is everything OK ! Problem solved !
      We have such scene tree:

      objRoot (BranchGroup)

      objScale (TransformGroup)

      dg (DecalGroup)

       

      TG1 TG2

       

      sph1 bufferGroup (BranchGroup)
      / TG21 TG22

       

      sph2 sph3
      */
      //--- Recomment this block for test ---------
      /*
      dg.addChild(TG1); //First decal member (red sphere)
      dg.addChild(TG2);
      BranchGroup bufferGroup = new BranchGroup();
      TG2.addChild(bufferGroup);
      bufferGroup.addChild(TG21);
      bufferGroup.addChild(TG22);
      TG1.addChild(sph1);
      TG21.addChild(sph2);
      TG22.addChild(sph3); */
      //----------------------

      objRoot.compile();
      return objRoot;
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      This bug bypass by using buffer BranchGroup on the OrderedGroup child branch:
      objRoot (BranchGroup)

      objScale (TransformGroup)

      dg (DecalGroup)

       

      TG1 TG2

       

      sph1 bufferGroup (BranchGroup)
      / TG21 TG22

       

      sph2 sph3

        Activity

        Hide
        kcr added a comment -

        Bumped to P4 to reflect current prioritization.

        Show
        kcr added a comment - Bumped to P4 to reflect current prioritization.
        Hide
        kcr added a comment -

        Raise to P3 : fix for 1.4.0

        Show
        kcr added a comment - Raise to P3 : fix for 1.4.0
        Hide
        jada added a comment -

        Encourage community participation. Downgrade to P5 and mark as owner-needed.

        Show
        jada added a comment - Encourage community participation. Downgrade to P5 and mark as owner-needed.

          People

          • Assignee:
            java3d-issues
            Reporter:
            jada
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: