I did a test program and found that if the Link is pointing to null (no SharedGroup) when the scene becomes live, then I get the error. If I create a dummy SharedGroup and setSharedGroup() before I make it live, then I don't get the error.
The test program is attached. Cheers, Bob Gray -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Kelvin Chung Sent: Monday, December 16, 2002 2:33 PM To: [EMAIL PROTECTED] Subject: Re: [JAVA3D] Link or Switch Bug? RWGRAY wrote: >I have a live scene as follows: BG1 -> BG2 -> Switch >and I have a SharedGroup defined. > >I detach BG2 from BG1: BG2.detach(); >and then I add a Link to the Switch: Switch.addChild(aLink); >and then reattach BG2 to BG1: BG1.addChild(BG2); > >I get the following error on the "BG1.addChild(BG2);" code: > >java.lang.NullPointerException >at >javax.media.j3d.SwitchRetained.traverseSwitchChild(SwitchRetained.java:548) >at javax.media.j3d.SwitchRetained.setLive(SwitchRetained.java:379) >at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2077) >at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2126) >at javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:161) >at >javax.media.j3d.BranchGroupRetained.childCheckSetLive(BranchGroupRetained.j a >va:225) >at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1481) >at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1418) >at javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:481) >at javax.media.j3d.GroupRetained.addChild(GroupRetained.java:454) >at javax.media.j3d.Group.addChild(Group.java:266) >at nch7.ToolFrame.IO_processChildren(ToolFrame.java:1612) <----my code >at SGO.SGO_BranchGroup.readFrom(SGO_BranchGroup.java:194) : >at nch7.ToolFrame.IO_processChildren(ToolFrame.java:1614) : >at SGO.SGO_Switch.readFrom(SGO_Switch.java:246) >at nch7.ToolFrame.IO_processChildren(ToolFrame.java:1614) >: : : >(cut for brevity) > > > >This error does not occur if I add a BranchGroup, or TransformGroup or >Shape3d instead of the Link. > >However, it does occur if I have BG1 -> BG2 -> Switch -> BG3 >and I try to add the Link to the BG3. > >java.lang.NullPointerException >at >javax.media.j3d.SwitchRetained.traverseSwitchChild(SwitchRetained.java:548) >at javax.media.j3d.SwitchRetained.setLive(SwitchRetained.java:379) >at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2077) >at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2126) >at javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:161) >at >javax.media.j3d.BranchGroupRetained.childCheckSetLive(BranchGroupRetained.j a >va:225) >at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1481) >at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1418) >at javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:481) >at javax.media.j3d.GroupRetained.addChild(GroupRetained.java:454) >at javax.media.j3d.Group.addChild(Group.java:266) >at nch7.ToolFrame.IO_processChildren(ToolFrame.java:1612) >at SGO.SGO_BranchGroup.readFrom(SGO_BranchGroup.java:194) >at nch7.ToolFrame.IO_processChildren(ToolFrame.java:1614) > > >Is this a bug? > > > Yes, please send us a test program to investigate. Thanks for your bug report. - Kelvin ------------ Java 3D Team Sun Microsystems Inc. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
Frame1.java
Description: JavaScript source
test01.java
Description: JavaScript source
