Skip to content

Commit 1f6f8f7

Browse files
committed
Fix for GRAILS-8582
1 parent 553ef01 commit 1f6f8f7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

grails-web/src/main/groovy/org/codehaus/groovy/grails/web/sitemesh/GrailsRoutablePrintWriter.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
*/
1515
package org.codehaus.groovy.grails.web.sitemesh;
1616

17+
import groovy.lang.Writable;
18+
1719
import java.io.IOException;
1820
import java.io.PrintWriter;
1921
import java.io.Writer;
2022

23+
import org.codehaus.groovy.grails.web.util.GrailsPrintWriter;
2124
import org.codehaus.groovy.grails.web.util.GrailsPrintWriterAdapter;
25+
import org.codehaus.groovy.grails.web.util.StreamCharBuffer;
2226

2327
public class GrailsRoutablePrintWriter extends GrailsPrintWriterAdapter {
2428

@@ -65,6 +69,7 @@ private PrintWriter getDestination() {
6569
setError();
6670
}
6771
super.out = destination;
72+
super.setTarget(destination);
6873
}
6974
return destination;
7075
}
@@ -279,4 +284,22 @@ public void blockFlushAndClose() {
279284
this.blockClose = true;
280285
this.blockFlush = true;
281286
}
287+
288+
@Override
289+
public GrailsPrintWriter leftShift(Object value) throws IOException {
290+
getDestination();
291+
return super.leftShift(value);
292+
}
293+
294+
@Override
295+
public GrailsPrintWriter leftShift(StreamCharBuffer otherBuffer) {
296+
getDestination();
297+
return super.leftShift(otherBuffer);
298+
}
299+
300+
@Override
301+
public GrailsPrintWriter leftShift(Writable writable) {
302+
getDestination();
303+
return super.leftShift(writable);
304+
}
282305
}

grails-web/src/main/groovy/org/codehaus/groovy/grails/web/util/GrailsPrintWriterAdapter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public class GrailsPrintWriterAdapter extends PrintWriter implements GrailsWrapp
3131

3232
public GrailsPrintWriterAdapter(Writer wrapped) {
3333
super(new NullWriter());
34+
setTarget(wrapped);
35+
}
36+
37+
public void setTarget(Writer wrapped) {
3438
if (wrapped instanceof GrailsPrintWriter) {
3539
this.target = ((GrailsPrintWriter)wrapped);
3640
}

0 commit comments

Comments
 (0)