You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Costas Stergiou <cs...@aias.gr> on 2001/04/17 08:50:06 UTC

Re: 1,000,000$ bug: solve it and win!!!

Hi all,
some days ago I posted the following mail which is actually a very strange
and important bug but I got no answer.
Did anyone try to reproduce it?
Please, take a look because I do think it is important if it is an actual
bug. Thanks.

Costas

> Hello,
> I came upon a very mysterious bug that causes a screen (and action) to
> execute
> more than once in a simple request (using Velocity+TDK1.13)
>
> In order to reproduce this error you only need:
> 1. One simple template (e.g. Foo.vm) where you add the following line
>     $page.addAttribute("background", "blue")
>     and anything else...
>
> 2. One simple screen for that (Foo.java)
>     In the screen just do a System.out (to make sure how many times it is
> executed)
>
> 3. Try calling you screen with the following URLs:
>     a. http://localhost/test/servlet/test/template/Foo.vm
>     b. http://localhost/test/servlet/test/template/Foo.vm?id=21
>     c. http://localhost/test/servlet/test/template/Foo.vm/id/21
>
> You will notice that in the third URL, the screen is executed twice!!!!
> Workarounds:
> 1. Don't use addPathInfo to pass parameters to the TemplateLink
> 2. Don't use the addAttribute method with the attribute "background". Any
> other attribute just won't do the trick.
> 3. User the $page.setBackground instead (exactly the same output with just
> one hit).
>
> Anyone who solves this mystery will get the 1,000,000$ (I only needed 2
> hours
> to find the problem with the old good way, comment out, recompile, run)
> Thanks
> Costas



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: 1,000,000$ bug: solve it and win!!!

Posted by Sean Legassick <se...@informage.net>.
In message <01...@int.acn.gr>, Costas Stergiou 
<cs...@aias.gr> writes
>All these are correct but if I use the $page.setBackground method,
>the html output is exactly the same, but the screen is only called once.
>Since the browser is the one that actually hits back to get the image,
>shouldn't it do so even if I use the $page.setBackground method?
>After all, the html that is produced is the same?
>But, in practice, this does not happen!!!

<pantomime> Oh yes it does!

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: 1,000,000$ bug: solve it and win!!!

Posted by Costas Stergiou <cs...@aias.gr>.
All these are correct but if I use the $page.setBackground method,
the html output is exactly the same, but the screen is only called once.
Since the browser is the one that actually hits back to get the image,
shouldn't it do so even if I use the $page.setBackground method?
After all, the html that is produced is the same?
But, in practice, this does not happen!!!



----- Original Message -----
From: "Sean Legassick" <se...@informage.net>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, April 17, 2001 12:51 PM
Subject: Re: 1,000,000$ bug: solve it and win!!!


In message <00...@int.acn.gr>, Costas Stergiou
<cs...@aias.gr> writes
>Hi all,
>some days ago I posted the following mail which is actually a very strange
>and important bug but I got no answer.
>Did anyone try to reproduce it?

Okay, on your second prompting I thought I'd take a look as this seemed
too bizarre to be true...

>Please, take a look because I do think it is important if it is an actual
>bug. Thanks.

...fortunately it's not a bug - read on for what it is...

>> In order to reproduce this error you only need:
>> 1. One simple template (e.g. Foo.vm) where you add the following line
>>     $page.addAttribute("background", "blue")
>>     and anything else...

...when you do this your body tags becomes <BODY background="blue">. Not
bgcolor="blue" which I assume is what you intended, so the browser tries
to load a background image with relative URI "blue"...

>> 2. One simple screen for that (Foo.java)
>>     In the screen just do a System.out (to make sure how many times it is
>> executed)
>>
>> 3. Try calling you screen with the following URLs:
>>     a. http://localhost/test/servlet/test/template/Foo.vm
>>     b. http://localhost/test/servlet/test/template/Foo.vm?id=21

...in both these cases relative URI "blue" becomes absolute URI
http://localhost/test/servlet/test/template/blue which will should log
an exception, but will otherwise go unnoticed as a request...

>>     c. http://localhost/test/servlet/test/template/Foo.vm/id/21

...whereas in this case "blue" maps to
http://localhost/test/servlet/test/template/Foo.vm/id/blue - and the Foo
screen is executed again when the browser goes to fetch the background
image (which it promptly discards when it gets HTML back instead of some
image format it might recognise)...

QED

(by the way - my bank details are on their way in private email :-) )

--
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: 1,000,000$ bug: solve it and win!!!

Posted by Sean Legassick <se...@informage.net>.
In message <00...@int.acn.gr>, Costas Stergiou 
<cs...@aias.gr> writes
>Hi all,
>some days ago I posted the following mail which is actually a very strange
>and important bug but I got no answer.
>Did anyone try to reproduce it?

Okay, on your second prompting I thought I'd take a look as this seemed 
too bizarre to be true...

>Please, take a look because I do think it is important if it is an actual
>bug. Thanks.

...fortunately it's not a bug - read on for what it is...

>> In order to reproduce this error you only need:
>> 1. One simple template (e.g. Foo.vm) where you add the following line
>>     $page.addAttribute("background", "blue")
>>     and anything else...

...when you do this your body tags becomes <BODY background="blue">. Not 
bgcolor="blue" which I assume is what you intended, so the browser tries 
to load a background image with relative URI "blue"...

>> 2. One simple screen for that (Foo.java)
>>     In the screen just do a System.out (to make sure how many times it is
>> executed)
>>
>> 3. Try calling you screen with the following URLs:
>>     a. http://localhost/test/servlet/test/template/Foo.vm
>>     b. http://localhost/test/servlet/test/template/Foo.vm?id=21

...in both these cases relative URI "blue" becomes absolute URI
http://localhost/test/servlet/test/template/blue which will should log 
an exception, but will otherwise go unnoticed as a request...

>>     c. http://localhost/test/servlet/test/template/Foo.vm/id/21

...whereas in this case "blue" maps to
http://localhost/test/servlet/test/template/Foo.vm/id/blue - and the Foo 
screen is executed again when the browser goes to fetch the background 
image (which it promptly discards when it gets HTML back instead of some 
image format it might recognise)...

QED

(by the way - my bank details are on their way in private email :-) )

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org