Author: musachy
Date: Tue Nov 18 09:04:01 2008
New Revision: 718652

URL: http://svn.apache.org/viewvc?rev=718652&view=rev
Log:
WW-2246 always wrap the writer passed to FreeMarker to prevent exception when 
using custom tags

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java?rev=718652&r1=718651&r2=718652&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
 Tue Nov 18 09:04:01 2008
@@ -163,22 +163,20 @@
         // the BodyContent JSP writer doesn't like it when FM flushes 
automatically --
         // so let's just not do it (it will be flushed eventually anyway)
         Writer writer = templateContext.getWriter();
-        if (bodyContent != null && 
bodyContent.isAssignableFrom(writer.getClass())) {
-            final Writer wrapped = writer;
-            writer = new Writer() {
-                public void write(char cbuf[], int off, int len) throws 
IOException {
-                    wrapped.write(cbuf, off, len);
-                }
-
-                public void flush() throws IOException {
-                    // nothing!
-                }
-
-                public void close() throws IOException {
-                    wrapped.close();
-                }
-            };
-        }
+        final Writer wrapped = writer;
+        writer = new Writer() {
+            public void write(char cbuf[], int off, int len) throws 
IOException {
+                wrapped.write(cbuf, off, len);
+            }
+
+            public void flush() throws IOException {
+                // nothing!
+            }
+
+            public void close() throws IOException {
+                wrapped.close();
+            }
+        };
 
         try {
             stack.push(templateContext.getTag());


Reply via email to