Quantcast

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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Luca Menegus-2
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Thiago H de Paula Figueiredo
On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Luca Menegus-2
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" <[hidden email]>
> To: "Tapestry users" <[hidden email]>
> 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 <[hidden email]> 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: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Luca Menegus-2
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" <[hidden email]>
> To: "Tapestry users" <[hidden email]>
> 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" <[hidden email]>
> > To: "Tapestry users" <[hidden email]>
> > 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 <[hidden email]> 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: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

BeanDisplyInForms.patch (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Luca Menegus-2
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" <[hidden email]>
> To: "Tapestry users" <[hidden email]>
> 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" <[hidden email]>
> > To: "Tapestry users" <[hidden email]>
> > 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" <[hidden email]>
> > > To: "Tapestry users" <[hidden email]>
> > > 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 <[hidden email]>
> > > 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: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > >
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Thiago H de Paula Figueiredo
On Tue, 26 Nov 2013 17:43:13 -0200, Luca Menegus <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...