Comment #1 on issue 57 by [email protected]: Unbalanced section push and pop in the Java implementation
http://code.google.com/p/json-template/issues/detail?id=57

Thanks, Louis, for pointing to issue source. But general problem is that while processing 'or' statement stack top contains 'null' value. This value remained after unsuccessful lookup for beginning of 'section' statement and must be removed before executing 'or' section. So fix should looks like this
///////////////////////////////////////////////////////////

public void execute(ScopedContext context, ITemplateRenderCallback callback) {
                // push a context first
                Object cursorPosition = context
                                .pushSection(this.block.getSectionName());
                if (!context.isEmptyContext(cursorPosition)) {
                        TemplateExecutor.execute(this.block.getStatements(), 
context,
                                        callback);
                        context.pop(); // leave as is
                } else {
                        context.pop(); // add this line
                        
TemplateExecutor.execute(this.block.getStatements("or"), context,
                                        callback);
                }
        }

////////////////////////////////////////////////////////

--
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en.


Reply via email to