Re: macros - max recursion depth
Hi Supun, Great work! I've gone ahead and committed your patch. I especially appreciate your attention to detail in including a good unit test and following our coding style. I found some minor issues, which I changed before committing. I list them below for future reference. Probably in the future I may bounce some of these back to you for tweaks on your end. (1) I changed the property name to velocimacro.max.depth to match similar property directive.parse.max.depth. (2) Since the patch deals with calling depth, not recursion, I changed all references in comments from recursion to calling depth. (3) In VelocimacroTestCase, there was a subtle reliance on JDK 1.5. (Remember, we require max JDK 1.4 for compiling and 1.3 for running). An int was passed as a parameter when an Integer was expected. Recommendation: set your IDE to enforce JDK 1.4 syntax. (4) In VelocimacroTestCase, one of the tests was repeated. (deleted the extra) (5) You can't change the class Directive, it's one of the public APIs. (yes, this is vague). Basically, any class that can be extended or an interface that can be implemented by changing velocity.properties has to keep the same API. Luckily, since MacroOverflowException is a subclass of RuntimeException you don't need to declare it in the Directive.render() method. WILL On 6/6/07, Will Glass-Husain [EMAIL PROTECTED] wrote: sure, please do! On 6/6/07, Supun Kamburugamuva [EMAIL PROTECTED] wrote: Hi, +1 for velocimacro.depth.max. I have alomost completed the implementation. Can I submit a patch? I'm sure there are lot of things to consider. Supun. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
[jira] Resolved: (VELOCITY-297) Maximum recursion depth for macro calls
[ https://issues.apache.org/jira/browse/VELOCITY-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Will Glass-Husain resolved VELOCITY-297. Resolution: Fixed committed patch. Made minor changes for JDK 1.4 compatibility and to preserve Directive API. Maximum recursion depth for macro calls --- Key: VELOCITY-297 URL: https://issues.apache.org/jira/browse/VELOCITY-297 Project: Velocity Issue Type: Improvement Components: Engine Affects Versions: 1.4 Environment: Operating System: All Platform: All Reporter: Jochen Toppe Priority: Minor Fix For: 1.6 Attachments: MacroMaxCallDepth.patch Similar to the option directive.parse.maxdepth I would love to see a parameter to limit the depth of macro call recursion. In my scenario I let simple users write macros to create html pages. Using recursive macros, they could get the application to misbehave. The following piece of code illustrates the problem: #macro ( showInfo $p ) Info: $p #showInfo($p) #end #showInfo(Test) Which simply leads to: java.lang.StackOverflowError at org.apache.velocity.runtime.parser.node.ASTStringLiteral.value(ASTStringLiteral.java:136) at org.apache.velocity.runtime.directive.VMProxyArg.getObject(VMProxyArg.java:294) at org.apache.velocity.context.VMContext.get(VMContext.java:181) Current workaround: Disable inline macros. Have responsible Script-Developers. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
echo messages from Sergio Reais
Hi, Is anyone else getting an echo (empty reply) for every commit message from Serio Reais? What's up with that? WILL -- Forwarded message -- From: Sérgio 7 Reais [EMAIL PROTECTED] Date: Jun 7, 2007 8:57 PM Subject: Re: svn commit: r544359 - in /velocity/engine/trunk: src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java test/includeevent/compare/test6.cmp To: dev@velocity.apache.org - Original Message - From: Sérgio 7 Reais To: dev@velocity.apache.org Sent: Wednesday, June 06, 2007 11:28 PM Subject: Re: svn commit: r544359 - in /velocity/engine/trunk: src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java test/includeevent/compare/test6.cmp - Original Message - From: Sérgio 7 Reais To: dev@velocity.apache.org Sent: Tuesday, June 05, 2007 1:45 AM Subject: Re: svn commit: r544359 - in /velocity/engine/trunk: src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java test/includeevent/compare/test6.cmp - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 05, 2007 12:52 AM Subject: svn commit: r544359 - in /velocity/engine/trunk: src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java test/includeevent/compare/test6.cmp Author: wglass Date: Mon Jun 4 20:52:21 2007 New Revision: 544359 URL: http://svn.apache.org/viewvc?view=revrev=544359 Log: Correctly display not found page. Fixes VELOCITY-551. Modified: velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java velocity/engine/trunk/test/includeevent/compare/test6.cmp Modified: velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java?view=diffrev=544359r1=544358r2=544359 == --- velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java (original) +++ velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java Mon Jun 4 20:52:21 2007 @@ -70,7 +70,7 @@ boolean exists = (rs.getLoaderNameForResource(includeResourcePath) != null); if (!exists) { -if (rs.getLoaderNameForResource(notfound) == null) +if (rs.getLoaderNameForResource(notfound) != null) { return notfound; Modified: velocity/engine/trunk/test/includeevent/compare/test6.cmp URL: http://svn.apache.org/viewvc/velocity/engine/trunk/test/includeevent/compare/test6.cmp?view=diffrev=544359r1=544358r2=544359 == --- velocity/engine/trunk/test/includeevent/compare/test6.cmp (original) +++ velocity/engine/trunk/test/includeevent/compare/test6.cmp Mon Jun 4 20:52:21 2007 @@ -1,2 +1,2 @@ Bad include follows -After the bad include +page not foundAfter the bad include -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.7/830 - Release Date: 3/6/2007 12:47 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.7/830 - Release Date: 3/6/2007 12:47 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.9/834 - Release Date: 5/6/2007 14:38 -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: echo messages from Sergio Reais
Me too. And it's worse than that. A couple of Sergio's emails have been empty replys to his own replys to a commit message. Who's the moderator for our lists anyway? Can we shut these down? On 6/8/07, Niall Pemberton [EMAIL PROTECTED] wrote: On 6/8/07, Will Glass-Husain [EMAIL PROTECTED] wrote: Hi, Is anyone else getting an echo (empty reply) for every commit message from Serio Reais? Yes. Niall What's up with that? WILL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: echo messages from Sergio Reais
Can confirm it.. MVgr, Martin Nathan Bubna wrote: Me too. And it's worse than that. A couple of Sergio's emails have been empty replys to his own replys to a commit message. Who's the moderator for our lists anyway? Can we shut these down? On 6/8/07, Niall Pemberton [EMAIL PROTECTED] wrote: On 6/8/07, Will Glass-Husain [EMAIL PROTECTED] wrote: Hi, Is anyone else getting an echo (empty reply) for every commit message from Serio Reais? Yes. Niall What's up with that? WILL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: echo messages from Sergio Reais
I've emailed him, let me see if he's responsive. WILL On 6/8/07, Martin van den Bemt [EMAIL PROTECTED] wrote: Can confirm it.. MVgr, Martin Nathan Bubna wrote: Me too. And it's worse than that. A couple of Sergio's emails have been empty replys to his own replys to a commit message. Who's the moderator for our lists anyway? Can we shut these down? On 6/8/07, Niall Pemberton [EMAIL PROTECTED] wrote: On 6/8/07, Will Glass-Husain [EMAIL PROTECTED] wrote: Hi, Is anyone else getting an echo (empty reply) for every commit message from Serio Reais? Yes. Niall What's up with that? WILL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com