HtmlWidget missing a MapStack pop?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

HtmlWidget missing a MapStack pop?

jonwimp
Hmm. Another quirk that sent me off the cliff. :)

HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing a MapStack pop.

To see the bug, do the 2 screen widgets below, "SomeScreen" and "SomeDecorator".

What happens is that section "section2" is gone after processing "section1" in "SomeDecorator".

Here's why.

See "SomeDecorator". The SectionsRenderer stored in variable "sections" is created with one
section at the line of <html-template-decorator-section name="section1">. This SectionsRenderer is
created in a private context, with the context of "SomeScreen" pushed into a MapStack.

Before that, the SectionsRenderer stored in variable "sections" in the previous context (that of
"SomeScreen") was created with 2 sections "section1" and "section2".

During processing, because the first SectionsRenderer (with only 1 section "section1") was never
popped from the MapStack, it is used to do the next section include <decorator-section-include
name="section2"/>. Obviously, the section "section2" does not exist.

<screen name="SomeScreen">
   <section>
   <widgets>
     <decorator-screen name="SomeDecorator">

       <decorator-section name="section1">
         <label text="Section One content"/>
       </decorator-section>

       <decorator-section name="section2">
         <label text="Section Two content"/>
       </decorator-section>

     </decorator-screen>
   </widgets>
   </section>
</screen>

<screen name="SomeDecorator">
   <section>
   <widgets>

     <platform-specific><html>
       <html-template-decorator location="SomeTemplate.ftl">
         <html-template-decorator-section name="section1">
           <decorator-section-include name="section1"/>
         </html-template-decorator-section>
       </html-template-decorator>
     </html></platform-specific>

     <decorator-section-include name="section2"/>

   </widgets>
   </section>
</screen>

Jonathon
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

byersa
Jonathon,

I am a good candidate for fixing this. Do you have an idea of exactly where
the fix should be made. It might make things go a little faster.

Thanks,
-Al

On 11/26/07, Jonathon -- Improov <[hidden email]> wrote:

>
> Hmm. Another quirk that sent me off the cliff. :)
>
> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing a
> MapStack pop.
>
> To see the bug, do the 2 screen widgets below, "SomeScreen" and
> "SomeDecorator".
>
> What happens is that section "section2" is gone after processing
> "section1" in "SomeDecorator".
>
> Here's why.
>
> See "SomeDecorator". The SectionsRenderer stored in variable "sections" is
> created with one
> section at the line of <html-template-decorator-section name="section1">.
> This SectionsRenderer is
> created in a private context, with the context of "SomeScreen" pushed into
> a MapStack.
>
> Before that, the SectionsRenderer stored in variable "sections" in the
> previous context (that of
> "SomeScreen") was created with 2 sections "section1" and "section2".
>
> During processing, because the first SectionsRenderer (with only 1 section
> "section1") was never
> popped from the MapStack, it is used to do the next section include
> <decorator-section-include
> name="section2"/>. Obviously, the section "section2" does not exist.
>
> <screen name="SomeScreen">
>    <section>
>    <widgets>
>      <decorator-screen name="SomeDecorator">
>
>        <decorator-section name="section1">
>          <label text="Section One content"/>
>        </decorator-section>
>
>        <decorator-section name="section2">
>          <label text="Section Two content"/>
>        </decorator-section>
>
>      </decorator-screen>
>    </widgets>
>    </section>
> </screen>
>
> <screen name="SomeDecorator">
>    <section>
>    <widgets>
>
>      <platform-specific><html>
>        <html-template-decorator location="SomeTemplate.ftl">
>          <html-template-decorator-section name="section1">
>            <decorator-section-include name="section1"/>
>          </html-template-decorator-section>
>        </html-template-decorator>
>      </html></platform-specific>
>
>      <decorator-section-include name="section2"/>
>
>    </widgets>
>    </section>
> </screen>
>
> Jonathon
>
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

jonwimp
In that exact Java method in class HtmlWidget. Look for a push without a matching pop. Very
obvious. Just add a pop. I tested the fix, it works.

Jonathon

Al Byers wrote:

> Jonathon,
>
> I am a good candidate for fixing this. Do you have an idea of exactly where
> the fix should be made. It might make things go a little faster.
>
> Thanks,
> -Al
>
> On 11/26/07, Jonathon -- Improov <[hidden email]> wrote:
>> Hmm. Another quirk that sent me off the cliff. :)
>>
>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing a
>> MapStack pop.
>>
>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>> "SomeDecorator".
>>
>> What happens is that section "section2" is gone after processing
>> "section1" in "SomeDecorator".
>>
>> Here's why.
>>
>> See "SomeDecorator". The SectionsRenderer stored in variable "sections" is
>> created with one
>> section at the line of <html-template-decorator-section name="section1">.
>> This SectionsRenderer is
>> created in a private context, with the context of "SomeScreen" pushed into
>> a MapStack.
>>
>> Before that, the SectionsRenderer stored in variable "sections" in the
>> previous context (that of
>> "SomeScreen") was created with 2 sections "section1" and "section2".
>>
>> During processing, because the first SectionsRenderer (with only 1 section
>> "section1") was never
>> popped from the MapStack, it is used to do the next section include
>> <decorator-section-include
>> name="section2"/>. Obviously, the section "section2" does not exist.
>>
>> <screen name="SomeScreen">
>>    <section>
>>    <widgets>
>>      <decorator-screen name="SomeDecorator">
>>
>>        <decorator-section name="section1">
>>          <label text="Section One content"/>
>>        </decorator-section>
>>
>>        <decorator-section name="section2">
>>          <label text="Section Two content"/>
>>        </decorator-section>
>>
>>      </decorator-screen>
>>    </widgets>
>>    </section>
>> </screen>
>>
>> <screen name="SomeDecorator">
>>    <section>
>>    <widgets>
>>
>>      <platform-specific><html>
>>        <html-template-decorator location="SomeTemplate.ftl">
>>          <html-template-decorator-section name="section1">
>>            <decorator-section-include name="section1"/>
>>          </html-template-decorator-section>
>>        </html-template-decorator>
>>      </html></platform-specific>
>>
>>      <decorator-section-include name="section2"/>
>>
>>    </widgets>
>>    </section>
>> </screen>
>>
>> Jonathon
>>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.7/1151 - Release Date: 11/25/2007 4:24 PM

Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

BJ Freeman
In reply to this post by jonwimp
can you give a reference to where the code is.
can't seem to find it.


Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:

> Hmm. Another quirk that sent me off the cliff. :)
>
> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing
> a MapStack pop.
>
> To see the bug, do the 2 screen widgets below, "SomeScreen" and
> "SomeDecorator".
>
> What happens is that section "section2" is gone after processing
> "section1" in "SomeDecorator".
>
> Here's why.
>
> See "SomeDecorator". The SectionsRenderer stored in variable "sections"
> is created with one section at the line of
> <html-template-decorator-section name="section1">. This SectionsRenderer
> is created in a private context, with the context of "SomeScreen" pushed
> into a MapStack.
>
> Before that, the SectionsRenderer stored in variable "sections" in the
> previous context (that of "SomeScreen") was created with 2 sections
> "section1" and "section2".
>
> During processing, because the first SectionsRenderer (with only 1
> section "section1") was never popped from the MapStack, it is used to do
> the next section include <decorator-section-include name="section2"/>.
> Obviously, the section "section2" does not exist.
>
> <screen name="SomeScreen">
>   <section>
>   <widgets>
>     <decorator-screen name="SomeDecorator">
>
>       <decorator-section name="section1">
>         <label text="Section One content"/>
>       </decorator-section>
>
>       <decorator-section name="section2">
>         <label text="Section Two content"/>
>       </decorator-section>
>
>     </decorator-screen>
>   </widgets>
>   </section>
> </screen>
>
> <screen name="SomeDecorator">
>   <section>
>   <widgets>
>
>     <platform-specific><html>
>       <html-template-decorator location="SomeTemplate.ftl">
>         <html-template-decorator-section name="section1">
>           <decorator-section-include name="section1"/>
>         </html-template-decorator-section>
>       </html-template-decorator>
>     </html></platform-specific>
>
>     <decorator-section-include name="section2"/>
>
>   </widgets>
>   </section>
> </screen>
>
> Jonathon
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

jonwimp
In reply to this post by jonwimp
Ah, wait. Don't forget to reproduce the bug as per my description in the first post in thread.

I always get scolded for fixing a bug without first reproducing it. Sigh. That's why I posted the
precise steps to reproduce bug.

(But i have a high rate of accurate bug-catch and bug-fixes, honest. I wish I'm dumber, so i can
be the boss instead. For those of you who had seen me in ML during Jan 2007, you'll know that I'm
overwhelmed with work again right now. :/)

Jonathon

Jonathon -- Improov wrote:

> In that exact Java method in class HtmlWidget. Look for a push without a
> matching pop. Very obvious. Just add a pop. I tested the fix, it works.
>
> Jonathon
>
> Al Byers wrote:
>> Jonathon,
>>
>> I am a good candidate for fixing this. Do you have an idea of exactly
>> where
>> the fix should be made. It might make things go a little faster.
>>
>> Thanks,
>> -Al
>>
>> On 11/26/07, Jonathon -- Improov <[hidden email]> wrote:
>>> Hmm. Another quirk that sent me off the cliff. :)
>>>
>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be
>>> missing a
>>> MapStack pop.
>>>
>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>> "SomeDecorator".
>>>
>>> What happens is that section "section2" is gone after processing
>>> "section1" in "SomeDecorator".
>>>
>>> Here's why.
>>>
>>> See "SomeDecorator". The SectionsRenderer stored in variable
>>> "sections" is
>>> created with one
>>> section at the line of <html-template-decorator-section
>>> name="section1">.
>>> This SectionsRenderer is
>>> created in a private context, with the context of "SomeScreen" pushed
>>> into
>>> a MapStack.
>>>
>>> Before that, the SectionsRenderer stored in variable "sections" in the
>>> previous context (that of
>>> "SomeScreen") was created with 2 sections "section1" and "section2".
>>>
>>> During processing, because the first SectionsRenderer (with only 1
>>> section
>>> "section1") was never
>>> popped from the MapStack, it is used to do the next section include
>>> <decorator-section-include
>>> name="section2"/>. Obviously, the section "section2" does not exist.
>>>
>>> <screen name="SomeScreen">
>>>    <section>
>>>    <widgets>
>>>      <decorator-screen name="SomeDecorator">
>>>
>>>        <decorator-section name="section1">
>>>          <label text="Section One content"/>
>>>        </decorator-section>
>>>
>>>        <decorator-section name="section2">
>>>          <label text="Section Two content"/>
>>>        </decorator-section>
>>>
>>>      </decorator-screen>
>>>    </widgets>
>>>    </section>
>>> </screen>
>>>
>>> <screen name="SomeDecorator">
>>>    <section>
>>>    <widgets>
>>>
>>>      <platform-specific><html>
>>>        <html-template-decorator location="SomeTemplate.ftl">
>>>          <html-template-decorator-section name="section1">
>>>            <decorator-section-include name="section1"/>
>>>          </html-template-decorator-section>
>>>        </html-template-decorator>
>>>      </html></platform-specific>
>>>
>>>      <decorator-section-include name="section2"/>
>>>
>>>    </widgets>
>>>    </section>
>>> </screen>
>>>
>>> Jonathon
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition. Version: 7.5.503 / Virus Database:
>> 269.16.7/1151 - Release Date: 11/25/2007 4:24 PM
>
>

Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

jonwimp
In reply to this post by BJ Freeman
Oh. Sorry.

${component:widget}/src

package org.ofbiz.widget.screen;

Jonathon

BJ Freeman wrote:

> can you give a reference to where the code is.
> can't seem to find it.
>
>
> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>> Hmm. Another quirk that sent me off the cliff. :)
>>
>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing
>> a MapStack pop.
>>
>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>> "SomeDecorator".
>>
>> What happens is that section "section2" is gone after processing
>> "section1" in "SomeDecorator".
>>
>> Here's why.
>>
>> See "SomeDecorator". The SectionsRenderer stored in variable "sections"
>> is created with one section at the line of
>> <html-template-decorator-section name="section1">. This SectionsRenderer
>> is created in a private context, with the context of "SomeScreen" pushed
>> into a MapStack.
>>
>> Before that, the SectionsRenderer stored in variable "sections" in the
>> previous context (that of "SomeScreen") was created with 2 sections
>> "section1" and "section2".
>>
>> During processing, because the first SectionsRenderer (with only 1
>> section "section1") was never popped from the MapStack, it is used to do
>> the next section include <decorator-section-include name="section2"/>.
>> Obviously, the section "section2" does not exist.
>>
>> <screen name="SomeScreen">
>>   <section>
>>   <widgets>
>>     <decorator-screen name="SomeDecorator">
>>
>>       <decorator-section name="section1">
>>         <label text="Section One content"/>
>>       </decorator-section>
>>
>>       <decorator-section name="section2">
>>         <label text="Section Two content"/>
>>       </decorator-section>
>>
>>     </decorator-screen>
>>   </widgets>
>>   </section>
>> </screen>
>>
>> <screen name="SomeDecorator">
>>   <section>
>>   <widgets>
>>
>>     <platform-specific><html>
>>       <html-template-decorator location="SomeTemplate.ftl">
>>         <html-template-decorator-section name="section1">
>>           <decorator-section-include name="section1"/>
>>         </html-template-decorator-section>
>>       </html-template-decorator>
>>     </html></platform-specific>
>>
>>     <decorator-section-include name="section2"/>
>>
>>   </widgets>
>>   </section>
>> </screen>
>>
>> Jonathon
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

byersa
In reply to this post by jonwimp
Okay, I added that fix. Thanks for the help.

-Al

On 11/26/07, Jonathon -- Improov <[hidden email]> wrote:

>
> In that exact Java method in class HtmlWidget. Look for a push without a
> matching pop. Very
> obvious. Just add a pop. I tested the fix, it works.
>
> Jonathon
>
> Al Byers wrote:
> > Jonathon,
> >
> > I am a good candidate for fixing this. Do you have an idea of exactly
> where
> > the fix should be made. It might make things go a little faster.
> >
> > Thanks,
> > -Al
> >
> > On 11/26/07, Jonathon -- Improov <[hidden email]> wrote:
> >> Hmm. Another quirk that sent me off the cliff. :)
> >>
> >> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be
> missing a
> >> MapStack pop.
> >>
> >> To see the bug, do the 2 screen widgets below, "SomeScreen" and
> >> "SomeDecorator".
> >>
> >> What happens is that section "section2" is gone after processing
> >> "section1" in "SomeDecorator".
> >>
> >> Here's why.
> >>
> >> See "SomeDecorator". The SectionsRenderer stored in variable "sections"
> is
> >> created with one
> >> section at the line of <html-template-decorator-section
> name="section1">.
> >> This SectionsRenderer is
> >> created in a private context, with the context of "SomeScreen" pushed
> into
> >> a MapStack.
> >>
> >> Before that, the SectionsRenderer stored in variable "sections" in the
> >> previous context (that of
> >> "SomeScreen") was created with 2 sections "section1" and "section2".
> >>
> >> During processing, because the first SectionsRenderer (with only 1
> section
> >> "section1") was never
> >> popped from the MapStack, it is used to do the next section include
> >> <decorator-section-include
> >> name="section2"/>. Obviously, the section "section2" does not exist.
> >>
> >> <screen name="SomeScreen">
> >>    <section>
> >>    <widgets>
> >>      <decorator-screen name="SomeDecorator">
> >>
> >>        <decorator-section name="section1">
> >>          <label text="Section One content"/>
> >>        </decorator-section>
> >>
> >>        <decorator-section name="section2">
> >>          <label text="Section Two content"/>
> >>        </decorator-section>
> >>
> >>      </decorator-screen>
> >>    </widgets>
> >>    </section>
> >> </screen>
> >>
> >> <screen name="SomeDecorator">
> >>    <section>
> >>    <widgets>
> >>
> >>      <platform-specific><html>
> >>        <html-template-decorator location="SomeTemplate.ftl">
> >>          <html-template-decorator-section name="section1">
> >>            <decorator-section-include name="section1"/>
> >>          </html-template-decorator-section>
> >>        </html-template-decorator>
> >>      </html></platform-specific>
> >>
> >>      <decorator-section-include name="section2"/>
> >>
> >>    </widgets>
> >>    </section>
> >> </screen>
> >>
> >> Jonathon
> >>
> >
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.503 / Virus Database: 269.16.7/1151 - Release Date:
> 11/25/2007 4:24 PM
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

BJ Freeman
In reply to this post by jonwimp
Per david, I i would like to test this.
could you send the files you used as an attachment?
or open a jira and put then there.
thanks.


Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:

> Oh. Sorry.
>
> ${component:widget}/src
>
> package org.ofbiz.widget.screen;
>
> Jonathon
>
> BJ Freeman wrote:
>> can you give a reference to where the code is.
>> can't seem to find it.
>>
>>
>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>> Hmm. Another quirk that sent me off the cliff. :)
>>>
>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing
>>> a MapStack pop.
>>>
>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>> "SomeDecorator".
>>>
>>> What happens is that section "section2" is gone after processing
>>> "section1" in "SomeDecorator".
>>>
>>> Here's why.
>>>
>>> See "SomeDecorator". The SectionsRenderer stored in variable "sections"
>>> is created with one section at the line of
>>> <html-template-decorator-section name="section1">. This SectionsRenderer
>>> is created in a private context, with the context of "SomeScreen" pushed
>>> into a MapStack.
>>>
>>> Before that, the SectionsRenderer stored in variable "sections" in the
>>> previous context (that of "SomeScreen") was created with 2 sections
>>> "section1" and "section2".
>>>
>>> During processing, because the first SectionsRenderer (with only 1
>>> section "section1") was never popped from the MapStack, it is used to do
>>> the next section include <decorator-section-include name="section2"/>.
>>> Obviously, the section "section2" does not exist.
>>>
>>> <screen name="SomeScreen">
>>>   <section>
>>>   <widgets>
>>>     <decorator-screen name="SomeDecorator">
>>>
>>>       <decorator-section name="section1">
>>>         <label text="Section One content"/>
>>>       </decorator-section>
>>>
>>>       <decorator-section name="section2">
>>>         <label text="Section Two content"/>
>>>       </decorator-section>
>>>
>>>     </decorator-screen>
>>>   </widgets>
>>>   </section>
>>> </screen>
>>>
>>> <screen name="SomeDecorator">
>>>   <section>
>>>   <widgets>
>>>
>>>     <platform-specific><html>
>>>       <html-template-decorator location="SomeTemplate.ftl">
>>>         <html-template-decorator-section name="section1">
>>>           <decorator-section-include name="section1"/>
>>>         </html-template-decorator-section>
>>>       </html-template-decorator>
>>>     </html></platform-specific>
>>>
>>>     <decorator-section-include name="section2"/>
>>>
>>>   </widgets>
>>>   </section>
>>> </screen>
>>>
>>> Jonathon
>>>
>>>
>>>
>>
>>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

David E Jones

I just reviewed the code and this looks good. It is consistent with  
the how the screen decorator works, and as with any good stack  
management the best way to keep it safe is to do the push and pop in  
the same scope.

I didn't test the problem or fix, but to clarify it looks like the  
original code sample was an example of something that should NOT work,  
but did because of this bug.

-David


On Nov 26, 2007, at 6:30 PM, BJ Freeman wrote:

> Per david, I i would like to test this.
> could you send the files you used as an attachment?
> or open a jira and put then there.
> thanks.
>
>
> Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:
>> Oh. Sorry.
>>
>> ${component:widget}/src
>>
>> package org.ofbiz.widget.screen;
>>
>> Jonathon
>>
>> BJ Freeman wrote:
>>> can you give a reference to where the code is.
>>> can't seem to find it.
>>>
>>>
>>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>>> Hmm. Another quirk that sent me off the cliff. :)
>>>>
>>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be  
>>>> missing
>>>> a MapStack pop.
>>>>
>>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>>> "SomeDecorator".
>>>>
>>>> What happens is that section "section2" is gone after processing
>>>> "section1" in "SomeDecorator".
>>>>
>>>> Here's why.
>>>>
>>>> See "SomeDecorator". The SectionsRenderer stored in variable  
>>>> "sections"
>>>> is created with one section at the line of
>>>> <html-template-decorator-section name="section1">. This  
>>>> SectionsRenderer
>>>> is created in a private context, with the context of "SomeScreen"  
>>>> pushed
>>>> into a MapStack.
>>>>
>>>> Before that, the SectionsRenderer stored in variable "sections"  
>>>> in the
>>>> previous context (that of "SomeScreen") was created with 2 sections
>>>> "section1" and "section2".
>>>>
>>>> During processing, because the first SectionsRenderer (with only 1
>>>> section "section1") was never popped from the MapStack, it is  
>>>> used to do
>>>> the next section include <decorator-section-include  
>>>> name="section2"/>.
>>>> Obviously, the section "section2" does not exist.
>>>>
>>>> <screen name="SomeScreen">
>>>>  <section>
>>>>  <widgets>
>>>>    <decorator-screen name="SomeDecorator">
>>>>
>>>>      <decorator-section name="section1">
>>>>        <label text="Section One content"/>
>>>>      </decorator-section>
>>>>
>>>>      <decorator-section name="section2">
>>>>        <label text="Section Two content"/>
>>>>      </decorator-section>
>>>>
>>>>    </decorator-screen>
>>>>  </widgets>
>>>>  </section>
>>>> </screen>
>>>>
>>>> <screen name="SomeDecorator">
>>>>  <section>
>>>>  <widgets>
>>>>
>>>>    <platform-specific><html>
>>>>      <html-template-decorator location="SomeTemplate.ftl">
>>>>        <html-template-decorator-section name="section1">
>>>>          <decorator-section-include name="section1"/>
>>>>        </html-template-decorator-section>
>>>>      </html-template-decorator>
>>>>    </html></platform-specific>
>>>>
>>>>    <decorator-section-include name="section2"/>
>>>>
>>>>  </widgets>
>>>>  </section>
>>>> </screen>
>>>>
>>>> Jonathon
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

jonwimp
In reply to this post by BJ Freeman
BJ,

I had written the test case in the first post to this thread. You can reproduce bug there.

I believe Al Byers has already fixed this?

Jonathon

BJ Freeman wrote:

> Per david, I i would like to test this.
> could you send the files you used as an attachment?
> or open a jira and put then there.
> thanks.
>
>
> Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:
>> Oh. Sorry.
>>
>> ${component:widget}/src
>>
>> package org.ofbiz.widget.screen;
>>
>> Jonathon
>>
>> BJ Freeman wrote:
>>> can you give a reference to where the code is.
>>> can't seem to find it.
>>>
>>>
>>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>>> Hmm. Another quirk that sent me off the cliff. :)
>>>>
>>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be missing
>>>> a MapStack pop.
>>>>
>>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>>> "SomeDecorator".
>>>>
>>>> What happens is that section "section2" is gone after processing
>>>> "section1" in "SomeDecorator".
>>>>
>>>> Here's why.
>>>>
>>>> See "SomeDecorator". The SectionsRenderer stored in variable "sections"
>>>> is created with one section at the line of
>>>> <html-template-decorator-section name="section1">. This SectionsRenderer
>>>> is created in a private context, with the context of "SomeScreen" pushed
>>>> into a MapStack.
>>>>
>>>> Before that, the SectionsRenderer stored in variable "sections" in the
>>>> previous context (that of "SomeScreen") was created with 2 sections
>>>> "section1" and "section2".
>>>>
>>>> During processing, because the first SectionsRenderer (with only 1
>>>> section "section1") was never popped from the MapStack, it is used to do
>>>> the next section include <decorator-section-include name="section2"/>.
>>>> Obviously, the section "section2" does not exist.
>>>>
>>>> <screen name="SomeScreen">
>>>>   <section>
>>>>   <widgets>
>>>>     <decorator-screen name="SomeDecorator">
>>>>
>>>>       <decorator-section name="section1">
>>>>         <label text="Section One content"/>
>>>>       </decorator-section>
>>>>
>>>>       <decorator-section name="section2">
>>>>         <label text="Section Two content"/>
>>>>       </decorator-section>
>>>>
>>>>     </decorator-screen>
>>>>   </widgets>
>>>>   </section>
>>>> </screen>
>>>>
>>>> <screen name="SomeDecorator">
>>>>   <section>
>>>>   <widgets>
>>>>
>>>>     <platform-specific><html>
>>>>       <html-template-decorator location="SomeTemplate.ftl">
>>>>         <html-template-decorator-section name="section1">
>>>>           <decorator-section-include name="section1"/>
>>>>         </html-template-decorator-section>
>>>>       </html-template-decorator>
>>>>     </html></platform-specific>
>>>>
>>>>     <decorator-section-include name="section2"/>
>>>>
>>>>   </widgets>
>>>>   </section>
>>>> </screen>
>>>>
>>>> Jonathon
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

BJ Freeman
so there is no checking of a element exists like the xml, bsh or ftl files.
hmmm will have to check out.

Jonathon -- Improov sent the following on 11/26/2007 9:12 PM:

> BJ,
>
> I had written the test case in the first post to this thread. You can
> reproduce bug there.
>
> I believe Al Byers has already fixed this?
>
> Jonathon
>
> BJ Freeman wrote:
>> Per david, I i would like to test this.
>> could you send the files you used as an attachment?
>> or open a jira and put then there.
>> thanks.
>>
>>
>> Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:
>>> Oh. Sorry.
>>>
>>> ${component:widget}/src
>>>
>>> package org.ofbiz.widget.screen;
>>>
>>> Jonathon
>>>
>>> BJ Freeman wrote:
>>>> can you give a reference to where the code is.
>>>> can't seem to find it.
>>>>
>>>>
>>>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>>>> Hmm. Another quirk that sent me off the cliff. :)
>>>>>
>>>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be
>>>>> missing
>>>>> a MapStack pop.
>>>>>
>>>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>>>> "SomeDecorator".
>>>>>
>>>>> What happens is that section "section2" is gone after processing
>>>>> "section1" in "SomeDecorator".
>>>>>
>>>>> Here's why.
>>>>>
>>>>> See "SomeDecorator". The SectionsRenderer stored in variable
>>>>> "sections"
>>>>> is created with one section at the line of
>>>>> <html-template-decorator-section name="section1">. This
>>>>> SectionsRenderer
>>>>> is created in a private context, with the context of "SomeScreen"
>>>>> pushed
>>>>> into a MapStack.
>>>>>
>>>>> Before that, the SectionsRenderer stored in variable "sections" in the
>>>>> previous context (that of "SomeScreen") was created with 2 sections
>>>>> "section1" and "section2".
>>>>>
>>>>> During processing, because the first SectionsRenderer (with only 1
>>>>> section "section1") was never popped from the MapStack, it is used
>>>>> to do
>>>>> the next section include <decorator-section-include name="section2"/>.
>>>>> Obviously, the section "section2" does not exist.
>>>>>
>>>>> <screen name="SomeScreen">
>>>>>   <section>
>>>>>   <widgets>
>>>>>     <decorator-screen name="SomeDecorator">
>>>>>
>>>>>       <decorator-section name="section1">
>>>>>         <label text="Section One content"/>
>>>>>       </decorator-section>
>>>>>
>>>>>       <decorator-section name="section2">
>>>>>         <label text="Section Two content"/>
>>>>>       </decorator-section>
>>>>>
>>>>>     </decorator-screen>
>>>>>   </widgets>
>>>>>   </section>
>>>>> </screen>
>>>>>
>>>>> <screen name="SomeDecorator">
>>>>>   <section>
>>>>>   <widgets>
>>>>>
>>>>>     <platform-specific><html>
>>>>>       <html-template-decorator location="SomeTemplate.ftl">
>>>>>         <html-template-decorator-section name="section1">
>>>>>           <decorator-section-include name="section1"/>
>>>>>         </html-template-decorator-section>
>>>>>       </html-template-decorator>
>>>>>     </html></platform-specific>
>>>>>
>>>>>     <decorator-section-include name="section2"/>
>>>>>
>>>>>   </widgets>
>>>>>   </section>
>>>>> </screen>
>>>>>
>>>>> Jonathon
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

jonwimp
Oh, BJ, yeah I forgot this.

There should be a file "SomeTemplate.ftl". And that ftl should have a
"${sections.render("section1")}".

No wonder David said the XML isn't valid. :P

The overall concept is to use a decorator ftl inside of a decorator screen widget. And to use 2
sections, 1 in the decorator ftl, the other at the decorator screen widget level.

Jonathon

BJ Freeman wrote:

> so there is no checking of a element exists like the xml, bsh or ftl files.
> hmmm will have to check out.
>
> Jonathon -- Improov sent the following on 11/26/2007 9:12 PM:
>> BJ,
>>
>> I had written the test case in the first post to this thread. You can
>> reproduce bug there.
>>
>> I believe Al Byers has already fixed this?
>>
>> Jonathon
>>
>> BJ Freeman wrote:
>>> Per david, I i would like to test this.
>>> could you send the files you used as an attachment?
>>> or open a jira and put then there.
>>> thanks.
>>>
>>>
>>> Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:
>>>> Oh. Sorry.
>>>>
>>>> ${component:widget}/src
>>>>
>>>> package org.ofbiz.widget.screen;
>>>>
>>>> Jonathon
>>>>
>>>> BJ Freeman wrote:
>>>>> can you give a reference to where the code is.
>>>>> can't seem to find it.
>>>>>
>>>>>
>>>>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>>>>> Hmm. Another quirk that sent me off the cliff. :)
>>>>>>
>>>>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be
>>>>>> missing
>>>>>> a MapStack pop.
>>>>>>
>>>>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>>>>> "SomeDecorator".
>>>>>>
>>>>>> What happens is that section "section2" is gone after processing
>>>>>> "section1" in "SomeDecorator".
>>>>>>
>>>>>> Here's why.
>>>>>>
>>>>>> See "SomeDecorator". The SectionsRenderer stored in variable
>>>>>> "sections"
>>>>>> is created with one section at the line of
>>>>>> <html-template-decorator-section name="section1">. This
>>>>>> SectionsRenderer
>>>>>> is created in a private context, with the context of "SomeScreen"
>>>>>> pushed
>>>>>> into a MapStack.
>>>>>>
>>>>>> Before that, the SectionsRenderer stored in variable "sections" in the
>>>>>> previous context (that of "SomeScreen") was created with 2 sections
>>>>>> "section1" and "section2".
>>>>>>
>>>>>> During processing, because the first SectionsRenderer (with only 1
>>>>>> section "section1") was never popped from the MapStack, it is used
>>>>>> to do
>>>>>> the next section include <decorator-section-include name="section2"/>.
>>>>>> Obviously, the section "section2" does not exist.
>>>>>>
>>>>>> <screen name="SomeScreen">
>>>>>>   <section>
>>>>>>   <widgets>
>>>>>>     <decorator-screen name="SomeDecorator">
>>>>>>
>>>>>>       <decorator-section name="section1">
>>>>>>         <label text="Section One content"/>
>>>>>>       </decorator-section>
>>>>>>
>>>>>>       <decorator-section name="section2">
>>>>>>         <label text="Section Two content"/>
>>>>>>       </decorator-section>
>>>>>>
>>>>>>     </decorator-screen>
>>>>>>   </widgets>
>>>>>>   </section>
>>>>>> </screen>
>>>>>>
>>>>>> <screen name="SomeDecorator">
>>>>>>   <section>
>>>>>>   <widgets>
>>>>>>
>>>>>>     <platform-specific><html>
>>>>>>       <html-template-decorator location="SomeTemplate.ftl">
>>>>>>         <html-template-decorator-section name="section1">
>>>>>>           <decorator-section-include name="section1"/>
>>>>>>         </html-template-decorator-section>
>>>>>>       </html-template-decorator>
>>>>>>     </html></platform-specific>
>>>>>>
>>>>>>     <decorator-section-include name="section2"/>
>>>>>>
>>>>>>   </widgets>
>>>>>>   </section>
>>>>>> </screen>
>>>>>>
>>>>>> Jonathon
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: HtmlWidget missing a MapStack pop?

BJ Freeman
This is a comment more about the original statement.
mark it up to old age, not remembering till now.
however:
Though I don't recommend this as a standard best practices. since it is
an available feature, it can be used that way.
My point in stating this is that it should not be assume, with out
checking the underlying code,
Thant said there does not necessarily need to be a pop after a push in
the same level of code.
So it is important to look at the underlying code to see the pop is used.


Jonathon -- Improov sent the following on 11/26/2007 10:43 PM:

> Oh, BJ, yeah I forgot this.
>
> There should be a file "SomeTemplate.ftl". And that ftl should have a
> "${sections.render("section1")}".
>
> No wonder David said the XML isn't valid. :P
>
> The overall concept is to use a decorator ftl inside of a decorator
> screen widget. And to use 2 sections, 1 in the decorator ftl, the other
> at the decorator screen widget level.
>
> Jonathon
>
> BJ Freeman wrote:
>> so there is no checking of a element exists like the xml, bsh or ftl
>> files.
>> hmmm will have to check out.
>>
>> Jonathon -- Improov sent the following on 11/26/2007 9:12 PM:
>>> BJ,
>>>
>>> I had written the test case in the first post to this thread. You can
>>> reproduce bug there.
>>>
>>> I believe Al Byers has already fixed this?
>>>
>>> Jonathon
>>>
>>> BJ Freeman wrote:
>>>> Per david, I i would like to test this.
>>>> could you send the files you used as an attachment?
>>>> or open a jira and put then there.
>>>> thanks.
>>>>
>>>>
>>>> Jonathon -- Improov sent the following on 11/26/2007 9:47 AM:
>>>>> Oh. Sorry.
>>>>>
>>>>> ${component:widget}/src
>>>>>
>>>>> package org.ofbiz.widget.screen;
>>>>>
>>>>> Jonathon
>>>>>
>>>>> BJ Freeman wrote:
>>>>>> can you give a reference to where the code is.
>>>>>> can't seem to find it.
>>>>>>
>>>>>>
>>>>>> Jonathon -- Improov sent the following on 11/26/2007 8:09 AM:
>>>>>>> Hmm. Another quirk that sent me off the cliff. :)
>>>>>>>
>>>>>>> HtmlWidget.render(Writer, Map, ScreenStringRenderer) seems to be
>>>>>>> missing
>>>>>>> a MapStack pop.
>>>>>>>
>>>>>>> To see the bug, do the 2 screen widgets below, "SomeScreen" and
>>>>>>> "SomeDecorator".
>>>>>>>
>>>>>>> What happens is that section "section2" is gone after processing
>>>>>>> "section1" in "SomeDecorator".
>>>>>>>
>>>>>>> Here's why.
>>>>>>>
>>>>>>> See "SomeDecorator". The SectionsRenderer stored in variable
>>>>>>> "sections"
>>>>>>> is created with one section at the line of
>>>>>>> <html-template-decorator-section name="section1">. This
>>>>>>> SectionsRenderer
>>>>>>> is created in a private context, with the context of "SomeScreen"
>>>>>>> pushed
>>>>>>> into a MapStack.
>>>>>>>
>>>>>>> Before that, the SectionsRenderer stored in variable "sections"
>>>>>>> in the
>>>>>>> previous context (that of "SomeScreen") was created with 2 sections
>>>>>>> "section1" and "section2".
>>>>>>>
>>>>>>> During processing, because the first SectionsRenderer (with only 1
>>>>>>> section "section1") was never popped from the MapStack, it is used
>>>>>>> to do
>>>>>>> the next section include <decorator-section-include
>>>>>>> name="section2"/>.
>>>>>>> Obviously, the section "section2" does not exist.
>>>>>>>
>>>>>>> <screen name="SomeScreen">
>>>>>>>   <section>
>>>>>>>   <widgets>
>>>>>>>     <decorator-screen name="SomeDecorator">
>>>>>>>
>>>>>>>       <decorator-section name="section1">
>>>>>>>         <label text="Section One content"/>
>>>>>>>       </decorator-section>
>>>>>>>
>>>>>>>       <decorator-section name="section2">
>>>>>>>         <label text="Section Two content"/>
>>>>>>>       </decorator-section>
>>>>>>>
>>>>>>>     </decorator-screen>
>>>>>>>   </widgets>
>>>>>>>   </section>
>>>>>>> </screen>
>>>>>>>
>>>>>>> <screen name="SomeDecorator">
>>>>>>>   <section>
>>>>>>>   <widgets>
>>>>>>>
>>>>>>>     <platform-specific><html>
>>>>>>>       <html-template-decorator location="SomeTemplate.ftl">
>>>>>>>         <html-template-decorator-section name="section1">
>>>>>>>           <decorator-section-include name="section1"/>
>>>>>>>         </html-template-decorator-section>
>>>>>>>       </html-template-decorator>
>>>>>>>     </html></platform-specific>
>>>>>>>
>>>>>>>     <decorator-section-include name="section2"/>
>>>>>>>
>>>>>>>   </widgets>
>>>>>>>   </section>
>>>>>>> </screen>
>>>>>>>
>>>>>>> Jonathon
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
>