From: Marc P. <wj...@wa...> - 2003-07-11 22:24:12
|
Hi guys (in particualr Brian due to earlier discussion), I have tracked down how the template name is somehow getting into the output now. Basically, in o.w.engine.BlockBuilder we have this code: final public Object build (BuildContext bc) throws BuildException { ...do some stuff... if (o instanceof Block) { iterStack.push(iter); iter = ((Block) o).getBlockIterator(); } else { if (o instanceof Macro) { strings.add(s.toString()); s = new StringBuffer(); // do not reuse StringBuffer, // otherwise all strings will contain char[] of max length!! macros.add(o); // Now deal with the line numbers int size = macros.size(); if (ln.length < size) { ln = resizeIntArray(ln, ln.length * 2); cn = resizeIntArray(cn, cn.length * 2); } ln[size - 1] = iter.getLineNo(); cn[size - 1] = iter.getColNo(); } else if (o != null) { s.append(o.toString()); // <<---- HERE } } ...do some stuff... } The o.toString() call indicated is the problem - sometimes "o" is a template (StreamTemplate in my case) and toString() is being dumped out to the output, which for StreamTemplate at least returns the template "name" not the evaluated contents of the template. Now, I've had a quick look at a couple of diffs (BlockBuilder and StreamTemplate) and I can't see how this problem is only now creeping into WM. I can only assume that previously template.toString() meant evaluate the template, or the code has not always blindly done o.toString() and has previously checked for templates and handled them differently. OR... template objects are now being passed to BlockBuilder when previously they weren't. Anybody care to comment? I'm surprised this isn't breaking our tests. I can't track down the conditions under which it occurs, but it seems to be related to #include as macro. Help! -- Marc Palmer wj...@wa... w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |