From: <dr...@us...> - 2002-11-05 20:58:05
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/directive In directory usw-pr-cvs1:/tmp/cvs-serv21173/src/org/webmacro/directive Modified Files: IncludeDirective.java Log Message: Add some logic to stop a template from #including itself. Otherwise, you end up with stack overflow/out of memory exceptions (or in my case, on OS X, a "bus error" with a JVM core-dump). Comments on a better way to handle this? Index: IncludeDirective.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/directive/IncludeDirective.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** IncludeDirective.java 11 Jun 2002 17:43:20 -0000 1.12 --- IncludeDirective.java 5 Nov 2002 20:58:01 -0000 1.13 *************** *** 331,334 **** --- 331,340 ---- } + // make sure we're not trying to include ourself. + // maybe there is a better way to handle this? + if (context.getCurrentLocation().indexOf(_strFilename) > -1) { + throw makePropertyException(context.getCurrentLocation() + " tried to include itself! You can't do this."); + } + // this should only be true if StrictCompatibility is set to false // and "as <something>" wasn't specified in the arg list |