Sean,
Thanks for your test program. You got an IndexOutOfBoundsException
is because your compiled BranchGroup has no more children.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.get(ArrayList.java:320)
at javax.media.j3d.GroupRetained.getChild(GroupRetained.java:408)
at javax.media.j3d.Group.setChild(Group.java:125)
at TestCase.runTest(TestCase.java:136)
at TestCase.main(TestCase.java:280)
This is likely a compile() bug, but it is not a regression bug; it happen
in j3d1.2.1 too. I've a filed bug report for further investigation.
BugId 4714426 - compile() removes null child eventhough ALLOW_CHILDREN_READ
is set.
To workaround this bug, you shouldn't compile the BranchGroup that contains
the null children. But you can still compile all BranchGroups at the
children level and that is also the right approach in optimizing your
scene graph.
Hope this helps.
- Chien Yang
Java 3D Team.
> Date: Fri, 12 Jul 2002 12:27:29 -0700
> From: Sean Sylvis <[EMAIL PROTECTED]>
> Subject: RE: Re: [JAVA3D] BranchGroups
> To: Chien Yang <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> MIME-version: 1.0
> X-MIMEOLE: Produced By Microsoft Exchange V6.0.5762.3
> Content-class: urn:content-classes:message
> Thread-topic: Re: [JAVA3D] BranchGroups
> Thread-index: AcIp2RrDWwWYOZm+Tl6edivw4xOidQAAE3tw
> X-MS-Has-Attach: yes
> X-MS-TNEF-Correlator:
>
>
> It seems you were right about compile(). Here's a little test case that adds
some null children and looks at the number of children for two cases: with and
without a call to compile(). setChild() is called after to bring up the
exception when compile() is used.
>
> Sean
>
>
> > -----Original Message-----
> > From: Chien Yang [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 12, 2002 12:19 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [JAVA3D] BranchGroups
> >
> >
> > Sean,
> > Please send us the trace or a test program.
> >
> > - Chien Yang
> > Java 3D Team.
> >
> >
> >
> > > Date: Fri, 12 Jul 2002 11:57:39 -0700
> > > From: Sean Sylvis <[EMAIL PROTECTED]>
> > > Subject: Re: [JAVA3D] BranchGroups
> > > To: [EMAIL PROTECTED]
> > > MIME-version: 1.0
> > > X-MIMEOLE: Produced By Microsoft Exchange V6.0.5762.3
> > > Content-transfer-encoding: quoted-printable
> > > Content-class: urn:content-classes:message
> > > Delivered-to: [EMAIL PROTECTED]
> > > Thread-topic: [JAVA3D] BranchGroups
> > > Thread-index: AcIpz1eyZ6BpcV6HRRCqOF78Jj2Y4gABfpPw
> > > X-MS-Has-Attach:
> > > X-MS-TNEF-Correlator:
> > > Comments: To: Chien Yang <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> > >
> > > When I then call Group.setChild(), a null pointer exception
> > is thrown because
> > there are no children in the Group.
> > > So, I'm pretty sure it is the same "bug" Justin was
> > referring to. (See
> > Justin's response to previous email)
> > >
> > > Sean
> > >
> > >
> > > > -----Original Message-----
> > > > From: Chien Yang [mailto:[EMAIL PROTECTED]]
> > > > Sent: Friday, July 12, 2002 11:09 AM
> > > > To: Sean Sylvis; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > > Subject: Re: [JAVA3D] BranchGroups
> > > >
> > > >
> > > > Justin,
> > > > I reread Sean's email and it seems to be a totally
> > > > different problem.
> > > > Sean's question is on Group.numChildren() :
> > > >
> > > > *********** Sean's email **********
> > > >
> > > > What happens when BranchGroup.addChild(null) is called?
> > > >
> > > > I was hoping to use the 'null' as a placeholder that I could
> > > > replace later with
> > > > a call to setChild(), but the addition of 'null' to the
> > > > BranchGroup child list
> > > > seems transient. Immediately after adding the right number of
> > > > 'null's to a
> > > > BranchGroup (to get the number of children correct for
> > > > replacement later), the
> > > > method numChildren() reports the correct number of children.
> > > > However, when
> > > > numChildren() is later (in another method) called on this
> > > > same BranchGroup, the
> > > > value returned is zero.
> > > >
> > > > Any ideas?
> > > >
> > > > ***********************************
> > > >
> > > > and yours is on NPE with setChild(). I've just tried
> > > > addChild(null) and
> > > > it went thro. with no NPE. Can you please verify it ?
> > > >
> > > > thanks,
> > > >
> > > > - Chien Yang.
> > > > Java 3D Team.
> > > >
> > > >
> > > >
> > > > > Date: Fri, 12 Jul 2002 10:27:25 -0700
> > > > > From: Justin Couch <[EMAIL PROTECTED]>
> > > > > Subject: Re: [JAVA3D] BranchGroups
> > > > > To: [EMAIL PROTECTED]
> > > > > MIME-version: 1.0
> > > > > Content-transfer-encoding: 7bit
> > > > > X-Accept-Language: en-us, en
> > > > > Delivered-to: [EMAIL PROTECTED]
> > > > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
> > > > rv:1.0.0)
> > > > Gecko/20020530
> > > > >
> > > > > Chien Yang wrote:
> > > > > > Sean and Justin,
> > > > > >
> > > > > > I'm a little confuse on whether the NPE is on
> > > > addChild() or
> > > > > > setChild(). We did fix a bug reported by Justin in
> > j3d1.3beta2 :
> > > > > >
> > > > > > BugId 4633672 : Group.setChild() may throw
> > NullPointerException.
> > > > >
> > > > > Hmmm.. That's interesting because I thought I reported it on the
> > > > > addChild() not setChild(). Oh well, I could be wrong on
> > > > that. :( I had
> > > > > to remove the addChild() calls at the same time because it
> > > > is pointless
> > > > > having those when I can't setChild() as well so I may
> > have missed a
> > > > > secondary bug there.
> > > > >
> > > > > Anyway, the basic process is that during the scene graph
> > > > the process is
> > > > > to addChild(null) as a placeholder for nodes that you want
> > > > to add later.
> > > > > Then, later on, you just do setChild(new_node_pointer,
> > 0); The idea
> > > > > behind this is that it is one less capability bit to need
> > > > to switch on.
> > > > > Instead of needing both write and extend, you just need
> > > > write capabilities.
> > > > >
> > > > > --
> > > > > Justin Couch
> http://www.vlc.com.au/~justin/
> > > > Java Architect & Bit Twiddler http://www.yumetech.com/
> > > > Author, Java 3D FAQ Maintainer http://www.j3d.org/
> > > > -------------------------------------------------------------------
> > > > "Humanism is dead. Animals think, feel; so do machines now.
> > > > Neither man nor woman is the measure of all things. Every organism
> > > > processes data according to its domain, its environment; you, with
> > > > all your brains, would be useless in a mouse's universe..."
> > > > - Greg Bear, Slant
> > > > -------------------------------------------------------------------
> > > >
> > > >
> > > ==============================================================
> > > =============
> > > > 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".
> > >
> > >
> >
> > ==========================================================================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".
>
> ===========================================================================
> 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".
===========================================================================
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".