/** * @see org.opencms.frontend.layoutpage.I_CmsMacroWrapper#getResult(java.lang.String, * java.lang.String[]) */ public String getResult(String macroName, String[] args) { Writer out = new StringWriter(); boolean error = false; try { // get the macro object to process Macro macro = (Macro) m_template.getMacros().get(macroName); if (macro != null) { // found macro, put it context putContextVariable(MACRO_NAME, macro); // process the template m_template.process(getContext(), out); } else { // did not find macro error = true; } } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } error = true; } finally { try { out.close(); } catch (Exception e) { // ignore exception when closing writer } } if (error) { return ""; } return out.toString(); }