Re: Infinite loop with CountDirective

Keats Kirsch <[email protected]> Tue, 28 Mar 2006 17:26:04 -0500
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
Eric B. Ridge wrote:

> On Mar 28, 2006, at 11:09 AM, Marc Palmer wrote:
>
>> Isn't this what gives us the "<!-- Variable XXXX is undefined -->"  
>> type output in the templates? That's much more helpful - and  
>> sometimes a quick fix for null checking in a hacked together  
>> prototype - than it spewing a property exception and failing to  
>> build the page...
>
>
> Yes and no.  The ExceptionHelper (or whatever it's called) generally  
> traps all the PropertyExceptions, looks at the innards for things  
> like UndefinedMacro, null objects, etc, and makes the determination  
> about what to do.  So he's the guy that writes out the <!-- Variable  
> XXX is undefined --> stuff.

This is what the DefaultEvaluationExceptionHandler does.  Other EEH's do 
different thing -- like throw an exception that bounces you to the error 
template for the CrankyEEH.

btw, I've refactored the CountDirective to use the EEH.  Should commit 
soon as I get the unit tests ready.

>
> We'd probably need to tighten up some try/catch blocks to make sure  
> we're passing exceptions into the ExceptionHelper (or whatever it's  
> called!), but that still seems better than having code that can  
> accidently cause an infinite loop.

This could be a bit tricky. Undefined evaluates to undefined.  
(Expansion, or write, on undefined throws an exception.)

For now we should just take a look at any code that say "while 
instanceof Macro ...".

Keats

>
> eric
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642