java3d
  1. java3d
  2. JAVA3D-608

Patch for issue 575: false SceneGraphCycleException raised when Node.checkForCycle() is called from 2 threads

    Details

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

      Operating System: All
      Platform: All

    • Issuezilla Id:
      608

      Description

      This is a patch for issue 575: false SceneGraphCycleException raised when
      Node.checkForCycle() is called from 2 threads.

      We have a collaborative application where the server sends non live graphs to
      clients. It also writes the graph to disk at an interval. Serialising a large
      graph using the SceneGraphIO will quite often cause the getBounds method to be
      called from two threads at the same time. Which in turn provokes this bug. The
      only disadvantage with this patch is that it will create an ArrayList every time
      checkForCycle() is called. Mostly when the graph is compiled or from
      getBounds(). But I consider correctness to be more important and that you accept
      this patch.

      1. This patch file was generated by NetBeans IDE
      2. This patch can be applied using context Tools: Apply Diff Patch action on
        respective folder.
      3. It uses platform neutral UTF-8 encoding.
      4. Above lines and this line are ignored by the patching process.
        Index: j3d-core/src/classes/share/javax/media/j3d/Node.java
          • j3d-core/src/classes/share/javax/media/j3d/Node.java Base (1.7)
            +++ j3d-core/src/classes/share/javax/media/j3d/Node.java Locally Modified (Based
            On 1.7)
            @@ -31,9 +31,9 @@

      package javax.media.j3d;

      +import java.util.ArrayList;
      import java.util.Hashtable;
      import java.util.Enumeration;
      -import java.lang.reflect.Constructor;

      /**

      • The Node class provides an abstract class for all Group and Leaf Nodes.
        @@ -815,15 +815,15 @@
      • checks for cycles in the scene graph
        */
        void checkForCycle() {
      • if (visited) {
        + ArrayList visitedNodes = new ArrayList();
        + Node parent = this;
        + while (parent != null) {
        + if (visitedNodes.contains(parent)) { throw new SceneGraphCycleException(J3dI18N.getString("Node15")); }
      • visited = true;
      • Node parent = getParent();
      • if (parent != null) { - parent.checkForCycle(); + + visitedNodes.add(parent); + parent = parent.getParent(); }
      • visited = false;
        }
      • }

        Issue Links

          Activity

          lamer77 created issue -
          kenaiadmin made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 608 70964
          made changes -
          Link This issue depends on JAVA3D-575 [ JAVA3D-575 ]

            People

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

              Dates

              • Created:
                Updated: