You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smallufo <sm...@gmail.com> on 2010/11/11 22:42:51 UTC

NPE when the underlaying model changed and ajax re-appear.

Hi , I have a simple panel , with a border and a listView :

<span wicket:id="border">
  <wicket:container wicket:id="commentsView">
    <div>
      //comment layout
    </div>
  </wicket:container>
</span>

And the code :

add(border);
ListView<Comment> commentsView = new ListView<Comment>("commentsView" , new
LoadableDetachableModel<List<Comment>>()
{
  @Override
  protected List<Comment> load() {
    return commentDao.getComments(0 , 10);
  }
})
{
  @Override
  protected void populateItem(ListItem<Comment> item) {
    //comment layout
  }
};
border.add(commentsView);
commentsView.setReuseItems(false);

The Panel has a border , with a clickable button , can be used to
collapse/expand the content of the border with AJAX.
Here is my steps :

1. I first collapse the panel .
2. Then open another browser panel , add a comment. (the underlaying data
model is changed)
3. Back to the original panel , expand the panel ...

And I got a NPE :

2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in rendering
component: [MarkupContainer [Component id = _body]]
org.apache.wicket.WicketRuntimeException: Exception in rendering component:
[MarkupContainer [Component id = _body]]
        at org.apache.wicket.Component.renderComponent(Component.java:2725)
        at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
        at org.apache.wicket.Component.render(Component.java:2517)
        at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
        at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
        at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
        at org.apache.wicket.Component.renderComponent(Component.java:2686)
        at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)

...

Caused by: java.lang.NullPointerException
        at
org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
        at org.apache.wicket.Component.renderComponent(Component.java:2686)
        ... 45 more

Can anybody tell me where goes wrong ? Thanks.
Wicket 1.4.13

Re: NPE when the underlaying model changed and ajax re-appear.

Posted by Igor Vaynberg <ig...@gmail.com>.
like i said in the jira issue, the NPE is in your code, not in wicket's.

-igor

On Sun, Nov 14, 2010 at 11:26 AM, smallufo <sm...@gmail.com> wrote:
> Hi Igor :
>
> Please re-verify WICKET-3162
> (and run the quickstart)
>
> It's not solved.
>
>
> 2010/11/12 Igor Vaynberg <ig...@gmail.com>
>
>> jira+quickstart
>>
>> -igor
>>
>> On Thu, Nov 11, 2010 at 5:48 PM, smallufo <sm...@gmail.com> wrote:
>> > Hi , thanks
>> > I tried , but NPE is still thrown , with the same stacktrace...
>> > Is there anything I missed ?
>> >
>> > Here is my border's HTML :
>> >
>> > <div wicket:id="content">
>> >  <wicket:body/>
>> > </div>
>> >
>> > border's java code :
>> >
>> >    content = new WebMarkupContainer("content");
>> >
>> >    content.setOutputMarkupPlaceholderTag(true);
>> >    content.setVisible(defaultExpanded);
>> >    content.setRenderBodyOnly(false);
>> >    add(content);
>> >    content.add(getBodyContainer());
>> >
>> > and the ajax link's onClick() :
>> >
>> > Link<Void> collapseExpandLink = new
>> > AjaxFallbackLink<Void>("collapseExpandLink")
>> > {
>> >  @Override
>> >  public void onClick(AjaxRequestTarget target)
>> >  {
>> >    expanded=!expanded;
>> >    content.setVisible(expanded);
>> >    target.addComponent(content);
>> >  }
>> > };
>> > add(collapseExpandLink);
>> >
>> >
>> >
>> >
>> > 2010/11/12 Igor Vaynberg <ig...@gmail.com>
>> >
>> >>
>> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
>> >>
>> >> On Thu, Nov 11, 2010 at 1:42 PM, smallufo <sm...@gmail.com> wrote:
>> >> > Hi , I have a simple panel , with a border and a listView :
>> >> >
>> >> > <span wicket:id="border">
>> >> >  <wicket:container wicket:id="commentsView">
>> >> >    <div>
>> >> >      //comment layout
>> >> >    </div>
>> >> >  </wicket:container>
>> >> > </span>
>> >> >
>> >> > And the code :
>> >> >
>> >> > add(border);
>> >> > ListView<Comment> commentsView = new ListView<Comment>("commentsView"
>> ,
>> >> new
>> >> > LoadableDetachableModel<List<Comment>>()
>> >> > {
>> >> >  @Override
>> >> >  protected List<Comment> load() {
>> >> >    return commentDao.getComments(0 , 10);
>> >> >  }
>> >> > })
>> >> > {
>> >> >  @Override
>> >> >  protected void populateItem(ListItem<Comment> item) {
>> >> >    //comment layout
>> >> >  }
>> >> > };
>> >> > border.add(commentsView);
>> >> > commentsView.setReuseItems(false);
>> >> >
>> >> > The Panel has a border , with a clickable button , can be used to
>> >> > collapse/expand the content of the border with AJAX.
>> >> > Here is my steps :
>> >> >
>> >> > 1. I first collapse the panel .
>> >> > 2. Then open another browser panel , add a comment. (the underlaying
>> data
>> >> > model is changed)
>> >> > 3. Back to the original panel , expand the panel ...
>> >> >
>> >> > And I got a NPE :
>> >> >
>> >> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
>> >> rendering
>> >> > component: [MarkupContainer [Component id = _body]]
>> >> > org.apache.wicket.WicketRuntimeException: Exception in rendering
>> >> component:
>> >> > [MarkupContainer [Component id = _body]]
>> >> >        at
>> >> org.apache.wicket.Component.renderComponent(Component.java:2725)
>> >> >        at
>> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>> >> >        at org.apache.wicket.Component.render(Component.java:2517)
>> >> >        at
>> >> >
>> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
>> >> >        at
>> >> >
>> >>
>> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
>> >> >        at
>> >> >
>> >>
>> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
>> >> >        at
>> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
>> >> >        at
>> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>> >> >
>> >> > ...
>> >> >
>> >> > Caused by: java.lang.NullPointerException
>> >> >        at
>> >> >
>> >>
>> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
>> >> >        at
>> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
>> >> >        ... 45 more
>> >> >
>> >> > Can anybody tell me where goes wrong ? Thanks.
>> >> > Wicket 1.4.13
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: NPE when the underlaying model changed and ajax re-appear.

Posted by smallufo <sm...@gmail.com>.
Hi Igor :

Please re-verify WICKET-3162
(and run the quickstart)

It's not solved.


2010/11/12 Igor Vaynberg <ig...@gmail.com>

> jira+quickstart
>
> -igor
>
> On Thu, Nov 11, 2010 at 5:48 PM, smallufo <sm...@gmail.com> wrote:
> > Hi , thanks
> > I tried , but NPE is still thrown , with the same stacktrace...
> > Is there anything I missed ?
> >
> > Here is my border's HTML :
> >
> > <div wicket:id="content">
> >  <wicket:body/>
> > </div>
> >
> > border's java code :
> >
> >    content = new WebMarkupContainer("content");
> >
> >    content.setOutputMarkupPlaceholderTag(true);
> >    content.setVisible(defaultExpanded);
> >    content.setRenderBodyOnly(false);
> >    add(content);
> >    content.add(getBodyContainer());
> >
> > and the ajax link's onClick() :
> >
> > Link<Void> collapseExpandLink = new
> > AjaxFallbackLink<Void>("collapseExpandLink")
> > {
> >  @Override
> >  public void onClick(AjaxRequestTarget target)
> >  {
> >    expanded=!expanded;
> >    content.setVisible(expanded);
> >    target.addComponent(content);
> >  }
> > };
> > add(collapseExpandLink);
> >
> >
> >
> >
> > 2010/11/12 Igor Vaynberg <ig...@gmail.com>
> >
> >>
> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
> >>
> >> On Thu, Nov 11, 2010 at 1:42 PM, smallufo <sm...@gmail.com> wrote:
> >> > Hi , I have a simple panel , with a border and a listView :
> >> >
> >> > <span wicket:id="border">
> >> >  <wicket:container wicket:id="commentsView">
> >> >    <div>
> >> >      //comment layout
> >> >    </div>
> >> >  </wicket:container>
> >> > </span>
> >> >
> >> > And the code :
> >> >
> >> > add(border);
> >> > ListView<Comment> commentsView = new ListView<Comment>("commentsView"
> ,
> >> new
> >> > LoadableDetachableModel<List<Comment>>()
> >> > {
> >> >  @Override
> >> >  protected List<Comment> load() {
> >> >    return commentDao.getComments(0 , 10);
> >> >  }
> >> > })
> >> > {
> >> >  @Override
> >> >  protected void populateItem(ListItem<Comment> item) {
> >> >    //comment layout
> >> >  }
> >> > };
> >> > border.add(commentsView);
> >> > commentsView.setReuseItems(false);
> >> >
> >> > The Panel has a border , with a clickable button , can be used to
> >> > collapse/expand the content of the border with AJAX.
> >> > Here is my steps :
> >> >
> >> > 1. I first collapse the panel .
> >> > 2. Then open another browser panel , add a comment. (the underlaying
> data
> >> > model is changed)
> >> > 3. Back to the original panel , expand the panel ...
> >> >
> >> > And I got a NPE :
> >> >
> >> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
> >> rendering
> >> > component: [MarkupContainer [Component id = _body]]
> >> > org.apache.wicket.WicketRuntimeException: Exception in rendering
> >> component:
> >> > [MarkupContainer [Component id = _body]]
> >> >        at
> >> org.apache.wicket.Component.renderComponent(Component.java:2725)
> >> >        at
> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >> >        at org.apache.wicket.Component.render(Component.java:2517)
> >> >        at
> >> >
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
> >> >        at
> >> >
> >>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
> >> >        at
> >> >
> >>
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
> >> >        at
> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >> >        at
> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >> >
> >> > ...
> >> >
> >> > Caused by: java.lang.NullPointerException
> >> >        at
> >> >
> >>
> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
> >> >        at
> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >> >        ... 45 more
> >> >
> >> > Can anybody tell me where goes wrong ? Thanks.
> >> > Wicket 1.4.13
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: NPE when the underlaying model changed and ajax re-appear.

Posted by Igor Vaynberg <ig...@gmail.com>.
jira+quickstart

-igor

On Thu, Nov 11, 2010 at 5:48 PM, smallufo <sm...@gmail.com> wrote:
> Hi , thanks
> I tried , but NPE is still thrown , with the same stacktrace...
> Is there anything I missed ?
>
> Here is my border's HTML :
>
> <div wicket:id="content">
>  <wicket:body/>
> </div>
>
> border's java code :
>
>    content = new WebMarkupContainer("content");
>
>    content.setOutputMarkupPlaceholderTag(true);
>    content.setVisible(defaultExpanded);
>    content.setRenderBodyOnly(false);
>    add(content);
>    content.add(getBodyContainer());
>
> and the ajax link's onClick() :
>
> Link<Void> collapseExpandLink = new
> AjaxFallbackLink<Void>("collapseExpandLink")
> {
>  @Override
>  public void onClick(AjaxRequestTarget target)
>  {
>    expanded=!expanded;
>    content.setVisible(expanded);
>    target.addComponent(content);
>  }
> };
> add(collapseExpandLink);
>
>
>
>
> 2010/11/12 Igor Vaynberg <ig...@gmail.com>
>
>> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
>>
>> On Thu, Nov 11, 2010 at 1:42 PM, smallufo <sm...@gmail.com> wrote:
>> > Hi , I have a simple panel , with a border and a listView :
>> >
>> > <span wicket:id="border">
>> >  <wicket:container wicket:id="commentsView">
>> >    <div>
>> >      //comment layout
>> >    </div>
>> >  </wicket:container>
>> > </span>
>> >
>> > And the code :
>> >
>> > add(border);
>> > ListView<Comment> commentsView = new ListView<Comment>("commentsView" ,
>> new
>> > LoadableDetachableModel<List<Comment>>()
>> > {
>> >  @Override
>> >  protected List<Comment> load() {
>> >    return commentDao.getComments(0 , 10);
>> >  }
>> > })
>> > {
>> >  @Override
>> >  protected void populateItem(ListItem<Comment> item) {
>> >    //comment layout
>> >  }
>> > };
>> > border.add(commentsView);
>> > commentsView.setReuseItems(false);
>> >
>> > The Panel has a border , with a clickable button , can be used to
>> > collapse/expand the content of the border with AJAX.
>> > Here is my steps :
>> >
>> > 1. I first collapse the panel .
>> > 2. Then open another browser panel , add a comment. (the underlaying data
>> > model is changed)
>> > 3. Back to the original panel , expand the panel ...
>> >
>> > And I got a NPE :
>> >
>> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
>> rendering
>> > component: [MarkupContainer [Component id = _body]]
>> > org.apache.wicket.WicketRuntimeException: Exception in rendering
>> component:
>> > [MarkupContainer [Component id = _body]]
>> >        at
>> org.apache.wicket.Component.renderComponent(Component.java:2725)
>> >        at
>> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>> >        at org.apache.wicket.Component.render(Component.java:2517)
>> >        at
>> > org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
>> >        at
>> >
>> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
>> >        at
>> >
>> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
>> >        at
>> org.apache.wicket.Component.renderComponent(Component.java:2686)
>> >        at
>> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>> >
>> > ...
>> >
>> > Caused by: java.lang.NullPointerException
>> >        at
>> >
>> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
>> >        at
>> org.apache.wicket.Component.renderComponent(Component.java:2686)
>> >        ... 45 more
>> >
>> > Can anybody tell me where goes wrong ? Thanks.
>> > Wicket 1.4.13
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: NPE when the underlaying model changed and ajax re-appear.

Posted by smallufo <sm...@gmail.com>.
Hi , thanks
I tried , but NPE is still thrown , with the same stacktrace...
Is there anything I missed ?

Here is my border's HTML :

<div wicket:id="content">
  <wicket:body/>
</div>

border's java code :

    content = new WebMarkupContainer("content");

    content.setOutputMarkupPlaceholderTag(true);
    content.setVisible(defaultExpanded);
    content.setRenderBodyOnly(false);
    add(content);
    content.add(getBodyContainer());

and the ajax link's onClick() :

Link<Void> collapseExpandLink = new
AjaxFallbackLink<Void>("collapseExpandLink")
{
  @Override
  public void onClick(AjaxRequestTarget target)
  {
    expanded=!expanded;
    content.setVisible(expanded);
    target.addComponent(content);
  }
};
add(collapseExpandLink);




2010/11/12 Igor Vaynberg <ig...@gmail.com>

> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
>
> On Thu, Nov 11, 2010 at 1:42 PM, smallufo <sm...@gmail.com> wrote:
> > Hi , I have a simple panel , with a border and a listView :
> >
> > <span wicket:id="border">
> >  <wicket:container wicket:id="commentsView">
> >    <div>
> >      //comment layout
> >    </div>
> >  </wicket:container>
> > </span>
> >
> > And the code :
> >
> > add(border);
> > ListView<Comment> commentsView = new ListView<Comment>("commentsView" ,
> new
> > LoadableDetachableModel<List<Comment>>()
> > {
> >  @Override
> >  protected List<Comment> load() {
> >    return commentDao.getComments(0 , 10);
> >  }
> > })
> > {
> >  @Override
> >  protected void populateItem(ListItem<Comment> item) {
> >    //comment layout
> >  }
> > };
> > border.add(commentsView);
> > commentsView.setReuseItems(false);
> >
> > The Panel has a border , with a clickable button , can be used to
> > collapse/expand the content of the border with AJAX.
> > Here is my steps :
> >
> > 1. I first collapse the panel .
> > 2. Then open another browser panel , add a comment. (the underlaying data
> > model is changed)
> > 3. Back to the original panel , expand the panel ...
> >
> > And I got a NPE :
> >
> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
> rendering
> > component: [MarkupContainer [Component id = _body]]
> > org.apache.wicket.WicketRuntimeException: Exception in rendering
> component:
> > [MarkupContainer [Component id = _body]]
> >        at
> org.apache.wicket.Component.renderComponent(Component.java:2725)
> >        at
> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >        at org.apache.wicket.Component.render(Component.java:2517)
> >        at
> > org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
> >        at
> >
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
> >        at
> >
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
> >        at
> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >        at
> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >
> > ...
> >
> > Caused by: java.lang.NullPointerException
> >        at
> >
> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
> >        at
> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >        ... 45 more
> >
> > Can anybody tell me where goes wrong ? Thanks.
> > Wicket 1.4.13
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: NPE when the underlaying model changed and ajax re-appear.

Posted by Igor Vaynberg <ig...@gmail.com>.
s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/

On Thu, Nov 11, 2010 at 1:42 PM, smallufo <sm...@gmail.com> wrote:
> Hi , I have a simple panel , with a border and a listView :
>
> <span wicket:id="border">
>  <wicket:container wicket:id="commentsView">
>    <div>
>      //comment layout
>    </div>
>  </wicket:container>
> </span>
>
> And the code :
>
> add(border);
> ListView<Comment> commentsView = new ListView<Comment>("commentsView" , new
> LoadableDetachableModel<List<Comment>>()
> {
>  @Override
>  protected List<Comment> load() {
>    return commentDao.getComments(0 , 10);
>  }
> })
> {
>  @Override
>  protected void populateItem(ListItem<Comment> item) {
>    //comment layout
>  }
> };
> border.add(commentsView);
> commentsView.setReuseItems(false);
>
> The Panel has a border , with a clickable button , can be used to
> collapse/expand the content of the border with AJAX.
> Here is my steps :
>
> 1. I first collapse the panel .
> 2. Then open another browser panel , add a comment. (the underlaying data
> model is changed)
> 3. Back to the original panel , expand the panel ...
>
> And I got a NPE :
>
> 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in rendering
> component: [MarkupContainer [Component id = _body]]
> org.apache.wicket.WicketRuntimeException: Exception in rendering component:
> [MarkupContainer [Component id = _body]]
>        at org.apache.wicket.Component.renderComponent(Component.java:2725)
>        at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>        at org.apache.wicket.Component.render(Component.java:2517)
>        at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
>        at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
>        at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
>        at org.apache.wicket.Component.renderComponent(Component.java:2686)
>        at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
>
> ...
>
> Caused by: java.lang.NullPointerException
>        at
> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
>        at org.apache.wicket.Component.renderComponent(Component.java:2686)
>        ... 45 more
>
> Can anybody tell me where goes wrong ? Thanks.
> Wicket 1.4.13
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org