I was writing my print, push and context tags, and I noticed 1 bug (missing throw) and a lot of nasty code duplication in the BasicPropertyTag. I have attached a diff of the refactored code.
// Anders Hovmöller
Index: BasicPropertyTag.java =================================================================== RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/view/taglib/BasicPropertyTag.java,v retrieving revision 1.1 diff -r1.1 BasicPropertyTag.java 105,109c105 < if (escape.booleanValue()) { < pageContext.getOut().write(TextUtil.escapeHTML(BeanUtil.toStringValue(enum.next()))); < } else { < pageContext.getOut().write(BeanUtil.toStringValue(enum.next())); < } --- > >write(enum.next()); 112,116c108 < if (escape.booleanValue()) { < pageContext.getOut().write(TextUtil.escapeHTML(String.valueOf((char[]) value))); < } else { < pageContext.getOut().write(String.valueOf((char[]) value)); < } --- > >write(String.valueOf((char[]) value); 118,122c110 < if (escape.booleanValue()) { < pageContext.getOut().write(TextUtil.escapeHTML(BeanUtil.toStringValue(value))); < } else { < pageContext.getOut().write(BeanUtil.toStringValue(value)); < } --- > write(value); 127c115 < new ServletException("Could not show value " + valueAttr, e); --- > throw new ServletException("Could not show value " + valueAttr, e); 130c118,130 < escape=null; --- > // Bruce Ritchie > // don't reset escape since some container implementations >won't handle correctly > // since escape property might not get set if it's the same >value as the previous > // call to the tag > // see the jsp spec (1.2) section 10.1 > // > //Once properly set, all properties are expected to be >persistent, so that if the > //JSP container ascertains that a property has already been >set on a given tag > //handler instance, it needs not set it again. User code can >access property > //information and access and modify tag handler internal state >starting with the first > //action method (doStartTag) up until the last action method >(doEndTag or > //doFinally for tag handlers implementing TryCatchFinally). > //escape=null; 135a136,144 > private void write(Object output) > { > String s = BeanUtil.toStringValue(output); > if (escape.booleanValue()) > s = TextUtil.escapeHTML(s); > > pageContext.getOut().write(s); > } > 142,144c151 < } < < --- > }