You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luca Menegus <lu...@dbmsrl.com> on 2013/11/01 19:00:43 UTC

[T53] [BUG] Beandisplay can't be used inside a form

Hi all, 
 in tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml the loop component has the formState parameter set to "ITERATION" while (probably) should be set to "NONE". 
I'm appending [3] a really simple example showing that this bug prevents the Beandisplay component to be used inside a form.

I found two jira Issues reporting the problem: 
- TAP5-311 [1] - NPE in BeanDisplay if used in a form with a default model 
- TAP5-983 [2] - CLONE -NPE in BeanDisplay if used in a form with a default model

I think both of them fail to point out the real bug which is not related to beanmodel construction but to the fact that BeanDisplay should not be involved in form processing logic at all.

Luca

PS: I would be *really* happy to contribute a patch and test case *if* any committer has interest in fixing this bug. I would also be ready to check the behavior in T54 where the form submission logic has changed (from POST+GET to POST)

[1] https://issues.apache.org/jira/browse/TAP5-311
[2] https://issues.apache.org/jira/browse/TAP5-983
[3] example code
Example.tml: 
<t:form> 
<div t:id="testBeanDisplay" /> 
<input t:type="submit"/> 
</t:form>

Example.java: 
@Component(parameters = { "object=testbean" }) 
private BeanDisplay testBeanDisplay; 
@Persist //No matter if persisted or not 
@Property 
private TestBean testbean; 
void onActivate() { 
if (testbean == null) { 
testbean = new TestBean(); 
} 

 


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


Re: [T53] [BUG] Beandisplay can't be used inside a form

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 26 Nov 2013 17:43:13 -0200, Luca Menegus <lu...@dbmsrl.com> wrote:

> Hi Thiago,

Hi!

>  did you had time to review my work?
> I'm happy to finalize it if you think it's worth including.

Unfortunately, not yet, but thanks for the reminder. I'll probably be able  
to look into it this week.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: [T53] [BUG] Beandisplay can't be used inside a form

Posted by Luca Menegus <lu...@dbmsrl.com>.
Hi Thiago,
 did you had time to review my work?
I'm happy to finalize it if you think it's worth including.
Let me know,
 Luca



Luca Menegus

D.B.M. S.r.l
Via Enrico Noe, 23 - 20133 Milano (MI) Italy.
Phone: +39 02 26600525
Mobile: +39 3346220663

----- Original Message -----
> From: "Luca Menegus" <lu...@dbmsrl.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Monday, November 4, 2013 9:42:56 PM
> Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> 
> Hi,
>  I attached the patch to this email (T53 only atm).
> The patch contains a test case *and* I ran the whole test suite (*)
> 
> If you think the path is ok I would:
> - open a new Jira issue with the correct bug desc and attach the patch to it
> - port the patch to T54
> 
> I also think that somebody should close and link TAP5-311 and TAP5-983 to the
> new issue once created.
> 
> 
> Luca
> 
> (*) while implementing the new test case I found out that two tests in
> org.apache.tapestry5.integration.app1.BeanEditorTests
>  are not run because they miss the @Test annotation.
> 
> 
> Luca Menegus
> 
> D.B.M. S.r.l
> Via Enrico Noe, 23 - 20133 Milano (MI) Italy.
> Phone: +39 02 26600525
> Mobile: +39 3346220663
> 
> ----- Original Message -----
> > From: "Luca Menegus" <lu...@dbmsrl.com>
> > To: "Tapestry users" <us...@tapestry.apache.org>
> > Sent: Friday, November 1, 2013 8:18:13 PM
> > Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> > 
> > Thank you very much Thiago,
> >  working on it, ETA is Monday (setting up proper test env is not trivial)
> > 
> > thanks,
> >  Luca
> > 
> > ----- Original Message -----
> > > From: "Thiago H de Paula Figueiredo" <th...@gmail.com>
> > > To: "Tapestry users" <us...@tapestry.apache.org>
> > > Sent: Friday, November 1, 2013 7:44:40 PM
> > > Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> > > 
> > > On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <lu...@dbmsrl.com>
> > > wrote:
> > > 
> > > > Hi all,
> > > 
> > > Hi!
> > > 
> > > >  in
> > > > tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
> > > > the loop component has the formState parameter set to "ITERATION" while
> > > > (probably) should be set to "NONE".
> > > 
> > > Good catch! Thanks!
> > > 
> > > > PS: I would be *really* happy to contribute a patch and test case *if*
> > > > any committer has interest in fixing this bug.
> > > 
> > > Go ahead. :)
> > > 
> > > > I would also be ready to check the behavior in T54 where the form
> > > > submission logic has changed (from POST+GET to POST)
> > > 
> > > Actually, this changed only when validation fails to avoid session usage.
> > > 
> > > >
> > > > [1] https://issues.apache.org/jira/browse/TAP5-311
> > > > [2] https://issues.apache.org/jira/browse/TAP5-983
> > > > [3] example code
> > > > Example.tml:
> > > > <t:form>
> > > > <div t:id="testBeanDisplay" />
> > > > <input t:type="submit"/>
> > > > </t:form>
> > > >
> > > > Example.java:
> > > > @Component(parameters = { "object=testbean" })
> > > > private BeanDisplay testBeanDisplay;
> > > > @Persist //No matter if persisted or not
> > > > @Property
> > > > private TestBean testbean;
> > > > void onActivate() {
> > > > if (testbean == null) {
> > > > testbean = new TestBean();
> > > > }
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > 
> > > 
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > 
> > > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org

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


Re: [T53] [BUG] Beandisplay can't be used inside a form

Posted by Luca Menegus <lu...@dbmsrl.com>.
Hi,
 I attached the patch to this email (T53 only atm).
The patch contains a test case *and* I ran the whole test suite (*)

If you think the path is ok I would:
- open a new Jira issue with the correct bug desc and attach the patch to it
- port the patch to T54

I also think that somebody should close and link TAP5-311 and TAP5-983 to the new issue once created.


Luca

(*) while implementing the new test case I found out that two tests in org.apache.tapestry5.integration.app1.BeanEditorTests 
 are not run because they miss the @Test annotation.


Luca Menegus

D.B.M. S.r.l
Via Enrico Noe, 23 - 20133 Milano (MI) Italy.
Phone: +39 02 26600525
Mobile: +39 3346220663

----- Original Message -----
> From: "Luca Menegus" <lu...@dbmsrl.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Friday, November 1, 2013 8:18:13 PM
> Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> 
> Thank you very much Thiago,
>  working on it, ETA is Monday (setting up proper test env is not trivial)
> 
> thanks,
>  Luca
> 
> ----- Original Message -----
> > From: "Thiago H de Paula Figueiredo" <th...@gmail.com>
> > To: "Tapestry users" <us...@tapestry.apache.org>
> > Sent: Friday, November 1, 2013 7:44:40 PM
> > Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> > 
> > On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <lu...@dbmsrl.com> wrote:
> > 
> > > Hi all,
> > 
> > Hi!
> > 
> > >  in
> > > tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
> > > the loop component has the formState parameter set to "ITERATION" while
> > > (probably) should be set to "NONE".
> > 
> > Good catch! Thanks!
> > 
> > > PS: I would be *really* happy to contribute a patch and test case *if*
> > > any committer has interest in fixing this bug.
> > 
> > Go ahead. :)
> > 
> > > I would also be ready to check the behavior in T54 where the form
> > > submission logic has changed (from POST+GET to POST)
> > 
> > Actually, this changed only when validation fails to avoid session usage.
> > 
> > >
> > > [1] https://issues.apache.org/jira/browse/TAP5-311
> > > [2] https://issues.apache.org/jira/browse/TAP5-983
> > > [3] example code
> > > Example.tml:
> > > <t:form>
> > > <div t:id="testBeanDisplay" />
> > > <input t:type="submit"/>
> > > </t:form>
> > >
> > > Example.java:
> > > @Component(parameters = { "object=testbean" })
> > > private BeanDisplay testBeanDisplay;
> > > @Persist //No matter if persisted or not
> > > @Property
> > > private TestBean testbean;
> > > void onActivate() {
> > > if (testbean == null) {
> > > testbean = new TestBean();
> > > }
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > 
> > 
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

Re: [T53] [BUG] Beandisplay can't be used inside a form

Posted by Luca Menegus <lu...@dbmsrl.com>.
Thank you very much Thiago,
 working on it, ETA is Monday (setting up proper test env is not trivial)

thanks, 
 Luca

----- Original Message -----
> From: "Thiago H de Paula Figueiredo" <th...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Friday, November 1, 2013 7:44:40 PM
> Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> 
> On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <lu...@dbmsrl.com> wrote:
> 
> > Hi all,
> 
> Hi!
> 
> >  in
> > tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
> > the loop component has the formState parameter set to "ITERATION" while
> > (probably) should be set to "NONE".
> 
> Good catch! Thanks!
> 
> > PS: I would be *really* happy to contribute a patch and test case *if*
> > any committer has interest in fixing this bug.
> 
> Go ahead. :)
> 
> > I would also be ready to check the behavior in T54 where the form
> > submission logic has changed (from POST+GET to POST)
> 
> Actually, this changed only when validation fails to avoid session usage.
> 
> >
> > [1] https://issues.apache.org/jira/browse/TAP5-311
> > [2] https://issues.apache.org/jira/browse/TAP5-983
> > [3] example code
> > Example.tml:
> > <t:form>
> > <div t:id="testBeanDisplay" />
> > <input t:type="submit"/>
> > </t:form>
> >
> > Example.java:
> > @Component(parameters = { "object=testbean" })
> > private BeanDisplay testBeanDisplay;
> > @Persist //No matter if persisted or not
> > @Property
> > private TestBean testbean;
> > void onActivate() {
> > if (testbean == null) {
> > testbean = new TestBean();
> > }
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> 
> 
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


Re: [T53] [BUG] Beandisplay can't be used inside a form

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <lu...@dbmsrl.com> wrote:

> Hi all,

Hi!

>  in  
> tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml  
> the loop component has the formState parameter set to "ITERATION" while  
> (probably) should be set to "NONE".

Good catch! Thanks!

> PS: I would be *really* happy to contribute a patch and test case *if*  
> any committer has interest in fixing this bug.

Go ahead. :)

> I would also be ready to check the behavior in T54 where the form  
> submission logic has changed (from POST+GET to POST)

Actually, this changed only when validation fails to avoid session usage.

>
> [1] https://issues.apache.org/jira/browse/TAP5-311
> [2] https://issues.apache.org/jira/browse/TAP5-983
> [3] example code
> Example.tml:
> <t:form>
> <div t:id="testBeanDisplay" />
> <input t:type="submit"/>
> </t:form>
>
> Example.java:
> @Component(parameters = { "object=testbean" })
> private BeanDisplay testBeanDisplay;
> @Persist //No matter if persisted or not
> @Property
> private TestBean testbean;
> void onActivate() {
> if (testbean == null) {
> testbean = new TestBean();
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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