mirror of
https://github.com/apache/struts.git
synced 2026-08-31 19:35:40 +00:00
Fixing premature closing of xslt output stream
WW-2551 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@649806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -315,7 +315,7 @@ public class XSLTResult implements Result {
|
||||
try {
|
||||
HttpServletResponse response = ServletActionContext.getResponse();
|
||||
|
||||
Writer writer = response.getWriter();
|
||||
PrintWriter writer = response.getWriter();
|
||||
|
||||
// Create a transformer for the stylesheet.
|
||||
Templates templates = null;
|
||||
@@ -349,18 +349,15 @@ public class XSLTResult implements Result {
|
||||
Source xmlSource = getDOMSourceForStack(result);
|
||||
|
||||
// Transform the source XML to System.out.
|
||||
PrintWriter out = response.getWriter();
|
||||
|
||||
LOG.debug("xmlSource = " + xmlSource);
|
||||
transformer.transform(xmlSource, new StreamResult(out));
|
||||
transformer.transform(xmlSource, new StreamResult(writer));
|
||||
|
||||
out.close(); // ...and flush...
|
||||
writer.flush(); // ...and flush...
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Time:" + (System.currentTimeMillis() - startTime) + "ms");
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
LOG.error("Unable to render XSLT Template, '" + location + "'", e);
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user