From: <dr...@us...> - 2002-11-25 05:21:35
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/engine In directory sc8-pr-cvs1:/tmp/cvs-serv29341/src/org/webmacro/engine Modified Files: Expression.java Log Message: Fixing bug reported by Endre Stolsvik: CrankyEEH doesn't rethrow some exceptions during #if evaluation. #if, thanks to o.wm.e.Expression, was treating all evaluation exceptions as 'false'. This behavior has been around for a long time, and I assume long before EEH came to be. So now, when Expression encounters an exception, it's because the active EEH wants it rethrown. It no longer converts the exceptions into 'false' values. All existing tests pass. 2 new tests added to TestIf.java to make sure that #if($foo.NoSuchMethod()) really does throw now. Index: Expression.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/engine/Expression.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Expression.java 11 Jun 2002 17:43:21 -0000 1.10 --- Expression.java 25 Nov 2002 05:21:33 -0000 1.11 *************** *** 90,105 **** Object l, r; ! try { ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; ! } ! catch (Exception e) { ! l = null; ! } ! try { ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; ! } ! catch (Exception e) { ! r = null; ! } return operate(l, r); --- 90,95 ---- Object l, r; ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; return operate(l, r); *************** *** 150,167 **** Object l, r; ! try { ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; ! } ! catch (Exception e) { ! l = null; ! } if (!isTrue(l)) return FALSE; ! try { ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; ! } ! catch (Exception e) { ! r = null; ! } if (!isTrue(r)) return FALSE; --- 140,148 ---- Object l, r; ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; if (!isTrue(l)) return FALSE; ! ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; if (!isTrue(r)) return FALSE; *************** *** 188,205 **** Object l, r; ! try { ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; ! } ! catch (Exception e) { ! l = null; ! } if (isTrue(l)) return TRUE; ! try { ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; ! } ! catch (Exception e) { ! r = null; ! } if (isTrue(r)) return TRUE; --- 169,177 ---- Object l, r; ! l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; if (isTrue(l)) return TRUE; ! ! r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; if (isTrue(r)) return TRUE; |