I don't think it has to do with any mutation in the tree. I think that the
isNodeSelected method is simply being called before the nodeId has been set
on the object. It gets called again later when the nodeId is set. I tested
the fix I put in the bug report and it had no side effects. The processing
of the jsp page must iterate over the tags a number of times and in the
early iterations the components are not yet fully initialized.

Rob

----- Original Message ----- 
From: "Sean Schofield" <[EMAIL PROTECTED]>
To: "MyFaces Discussion" <[email protected]>
Sent: Saturday, April 02, 2005 1:00 PM
Subject: Re: getNodeId() returning null in tree2


> Are we sure that is it?  This would imply that the structure of his
> tree is changing between posts.  That was the problem in MYFACES-160
> but you had a pretty unusual case where you simulating the tree
> changing between *every* post.
>
> Jon, does this sound like it applies to you?  Is your data changing
> between posts?
>
> sean
>
>
> On Apr 1, 2005 10:09 PM, Rob Decker <[EMAIL PROTECTED]> wrote:
> > This is the bug I reported about isNodeSelected() throwing a
> > NullPointerException because getNodeId() returns a null nodeId.
> > http://issues.apache.org/jira/browse/MYFACES-160
> >
> > I put the fix in the bug report. It's null because it hasn't been set
yet.
> >
> >
> > ----- Original Message -----
> > From: "Sean Schofield" <[EMAIL PROTECTED]>
> > To: "MyFaces Discussion" <[email protected]>
> > Sent: Friday, April 01, 2005 9:30 PM
> > Subject: Re: getNodeId() returning null in tree2
> >
> > > I still need some time to think about what the problem might be.  I
> > > have a lot of personal stuff going on that's keeping me busy at the
> > > moment.  Plus I am working on some stuff related to the new website,
> > > etc.
> > >
> > > I will get back to you shortly though.
> > >
> > > sean
> > >
> > >
> > > On Mar 31, 2005 4:30 PM, Jon Travis <[EMAIL PROTECTED]> wrote:
> > > > Ack!
> > > >
> > > > Replace 'false' with null (hence the NPE).
> > > >
> > > > The NPE occurs in HtmlTree.isNodeSelected() -- it
> > > > does:
> > > >
> > > >     return getNodeId().equals(_selectedNodeId)
> > > >
> > > > getNodeId() returns false.  Up the stack, this
> > > > is being called from DebugUtils.printComponent.
> > > >
> > > > -- Jon
> > > >
> > > >
> > > > On Mar 31, 2005, at 6:04 AM, Sean Schofield wrote:
> > > >
> > > > > Jon,
> > > > >
> > > > > When you say getNodeId returns false, do you mean the string value
> > > > > "false"?  That method returns a String so I'm a bit confused.  How
do
> > > > > you know the id is "false"?  Are you doing a debug statement?
> > > > >
> > > > > Please clarify so I can try and help you.  Also, what is the exact
> > > > > line where the NPE occurs?  Is it the return statement in
> > > > > isNodeExpanded?  If so (and if you have a debugger) it would be
> > > > > helpful to know which value is null.
> > > > >
> > > > > Regards,
> > > > > sean
> > > > >
> > > > > ps. I forwarded this to the myfaces list in case anyone else has
the
> > > > > same problem.  These messages are also archived so if someone has
the
> > > > > same question in the future they can get information by doing a
quick
> > > > > search.
> > > > >
> > > > >
> > > > > On Thu, 31 Mar 2005 08:55:00 -0500, Sean Schofield
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > >> ---------- Forwarded message ----------
> > > > >> From: Jon Travis <[EMAIL PROTECTED]>
> > > > >> Date: Wed, 30 Mar 2005 17:32:19 -0800
> > > > >> Subject: getNodeId() returning null in tree2
> > > > >> To: Sean Schofield <[EMAIL PROTECTED]>
> > > > >>
> > > > >> Hey Sean,
> > > > >>
> > > > >> Hope this isn't a braindead question, but:
> > > > >>
> > > > >> I'm getting a NPE in the tree2 code when there is
> > > > >> no node that is selected & I am expanding/collapsing.
> > > > >>
> > > > >> Basically it comes about when HtmlTree.isNodeSelected
> > > > >> is run -- getNodeId() returns false, then kaboom.
> > > > >>
> > > > >> Thoughts?
> > > > >>
> > > > >> -- Jon
> > > > >>
> > > > >
> > > > >
> > > >
> > > >
> >
> >

Reply via email to