<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">so it sounds like the listener thing is broker per template... grrr....<div>Ter<br><div><div>On Apr 8, 2009, at 5:58 PM, Lon Varscsak wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Aha! &nbsp;That did the trick.<div><br></div><div>Thanks a bunch!</div><div><br></div><div>-Lon<br><br><div class="gmail_quote">On Wed, Apr 8, 2009 at 5:32 PM, Terence Parr <span dir="ltr">&lt;<a href="mailto:parrt@cs.usfca.edu">parrt@cs.usfca.edu</a>></span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Lon, that is very strange. Perhaps i messed up and I ignore the template's listener and go straight for the listener of the group. try setting the listener of the group you're using even if it's the default group.<br> Thanks,<br> Ter<div><div></div><div class="h5"><br> On Apr 8, 2009, at 1:47 PM, Lon Varscsak wrote:<br> <br> </div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"> We have a system that uses StringTemplate to merge templates that are created and stored in a database by different users. &nbsp;It works great, I love StringTemplate. :)<br> <br> However, I'd like to write a little interface that can "validate" the template to at least ensure that it's not going to throw errors when this template makes it into production. &nbsp;StringTemplate prints out these wonderful exceptions that I can't figure out how to trap.<br> <br> When I do:<br> <br> StringTemplate template = new StringTempate(myDatabaseTemplate);<br> <br> and have a myDatabaseTemplate that is malformed, a bunch of exceptions are being printed to the output, but they are not being thrown in a way I can catch them.<br> <br> I've tried creating a StringTemplateErrorListner object and it never reaches my object:<br> <br> StringTemplate messageTemplate = new StringTemplate();<br> ErrorListener errorListener = new ErrorListener(); //this implements StringTemplateErrorListener<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> messageTemplate.setErrorListener(errorListener);<br> messageTemplate.setTemplate(messageToTest); //ErrorListener doesn't get stuff called, but errors are printed out.<br> <br> I would expect my ErrorListener object to be getting "error" or "warning" called, but it doesn't.<br> <br> Is there anyway to "validate" a template (this template is a String in memory)?<br> <br> Thanks,<br> <br> Lon<br> <br> P.S. -- This is using Java 1.5, and StringTemplate 3.2<br></div></div> _______________________________________________<br> stringtemplate-interest mailing list<br> <a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br> <a href="http://www.antlr.org/mailman/listinfo/stringtemplate-interest" target="_blank">http://www.antlr.org/mailman/listinfo/stringtemplate-interest</a><br> </blockquote> <br> </blockquote></div><br></div></blockquote></div><br></div></body></html>