Skip to content

Commit 074b9fe

Browse files
committed
Merge branch '2.3.x' into 2.4.x
2 parents c2d62d2 + f2309ab commit 074b9fe

File tree

4 files changed

+45
-13
lines changed

4 files changed

+45
-13
lines changed

grails-databinding/src/test/groovy/org/grails/databinding/converters/CurrencyConversionSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CurrencyConversionSpec extends Specification {
1818

1919
then:
2020
bank.currency instanceof Currency
21-
'$' == bank.currency.symbol
21+
'USD' == bank.currency.currencyCode
2222
}
2323
}
2424

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

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,40 @@ protected Writer unwrapWriter(Writer writer) {
9494
* Provides Groovy << left shift operator, but intercepts call to make sure
9595
* nulls are converted to "" strings
9696
*
97-
* @param value The value
97+
* @param obj The value
9898
* @return Returns this object
9999
* @throws IOException
100100
*/
101-
public GrailsPrintWriter leftShift(Object value) throws IOException {
102-
usageFlag = true;
103-
if (value != null) {
104-
InvokerHelper.write(this, value);
101+
public GrailsPrintWriter leftShift(Object obj) throws IOException {
102+
if (trouble || obj == null) {
103+
usageFlag = true;
104+
return this;
105+
}
106+
107+
Class<?> clazz = obj.getClass();
108+
if (clazz == String.class) {
109+
write((String)obj);
110+
}
111+
else if (clazz == StreamCharBuffer.class) {
112+
write((StreamCharBuffer)obj);
113+
}
114+
else if (clazz == GStringImpl.class) {
115+
write((Writable)obj);
116+
}
117+
else if (obj instanceof Writable) {
118+
write((Writable)obj);
119+
}
120+
else if (obj instanceof CharSequence) {
121+
try {
122+
usageFlag = true;
123+
getOut().append((CharSequence)obj);
124+
}
125+
catch (IOException e) {
126+
handleIOException(e);
127+
}
128+
}
129+
else {
130+
InvokerHelper.write(this, obj);
105131
}
106132
return this;
107133
}
@@ -517,6 +543,11 @@ public void write(final Writable writable) {
517543
}
518544

519545
protected void writeWritable(final Writable writable) {
546+
if(writable.getClass() == StreamCharBuffer.class) {
547+
write((StreamCharBuffer)writable);
548+
return;
549+
}
550+
520551
usageFlag = true;
521552
if (trouble)
522553
return;

grails-test-suite-persistence/src/test/groovy/org/codehaus/groovy/grails/orm/GrailsWebDataBinderSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ class GrailsWebDataBinderSpec extends Specification {
13311331

13321332
then:
13331333
publisher.localCurrency instanceof Currency
1334-
'$' == publisher.localCurrency.symbol
1334+
'USD' == publisher.localCurrency.currencyCode
13351335
}
13361336
}
13371337

grails-web-gsp/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPageOutputStack.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ public static GroovyPageOutputStack currentStack(boolean allowCreate) {
5151
}
5252

5353
public static GroovyPageOutputStack currentStack(GrailsWebRequest request, boolean allowCreate) {
54-
if (allowCreate) {
55-
return currentStack(request, allowCreate, null, allowCreate, false);
54+
GroovyPageOutputStack outputStack = lookupStack(request);
55+
if (outputStack == null && allowCreate) {
56+
outputStack = currentStack(request, allowCreate, null, allowCreate, false);
5657
}
57-
return lookupStack(request);
58+
return outputStack;
5859
}
5960

6061
public static GroovyPageOutputStack currentStack(boolean allowCreate, Writer topWriter, boolean autoSync, boolean pushTop) {
@@ -75,16 +76,16 @@ public static GroovyPageOutputStack currentStack(GroovyPageOutputStackAttributes
7576
}
7677

7778
if (attributes.isAllowCreate()) {
78-
if (attributes.getTopWriter() == null) {
79-
attributes=new GroovyPageOutputStackAttributes.Builder(attributes).topWriter(lookupRequestWriter(attributes.getWebRequest())).build();
80-
}
8179
return createNew(attributes);
8280
}
8381

8482
return null;
8583
}
8684

8785
private static final GroovyPageOutputStack createNew(GroovyPageOutputStackAttributes attributes) {
86+
if (attributes.getTopWriter() == null) {
87+
attributes=new GroovyPageOutputStackAttributes.Builder(attributes).topWriter(lookupRequestWriter(attributes.getWebRequest())).build();
88+
}
8889
GroovyPageOutputStack instance = new GroovyPageOutputStack(attributes);
8990
attributes.getWebRequest().setAttribute(
9091
ATTRIBUTE_NAME_OUTPUT_STACK, instance, RequestAttributes.SCOPE_REQUEST);

0 commit comments

Comments
 (0)