You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/11/15 12:58:40 UTC
svn commit: r1542238 - in
/ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json: ./
JSONWriter.java
Author: adrianc
Date: Fri Nov 15 11:58:39 2013
New Revision: 1542238
URL: http://svn.apache.org/r1542238
Log:
Merged revision(s) 1533927 from ofbiz/trunk/framework/base/src/org/ofbiz/base/json:
Allow JSONWriter to handle Iterators.
Backporting this because it is a bug - exceptions are thrown when the JSONWriter attempts to write EntityListIterator.
Modified:
ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/ (props changed)
ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/JSONWriter.java
Propchange: ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Nov 15 11:58:39 2013
@@ -0,0 +1,7 @@
+/ofbiz/branches/2013_RemoveJavolution/framework/base/src/org/ofbiz/base/json:1462755
+/ofbiz/branches/addbirt/framework/base/src/org/ofbiz/base/json:831210-885099,885686-886087
+/ofbiz/branches/dojo1.4/framework/base/src/org/ofbiz/base/json:951708-952957
+/ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/json:962442-1231517
+/ofbiz/branches/jquery/framework/base/src/org/ofbiz/base/json:952958-1044489
+/ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/json:921280-927264
+/ofbiz/trunk/framework/base/src/org/ofbiz/base/json:1506269,1506499,1506504,1506828,1509164,1510042,1511279,1512376,1512573,1516094,1517629,1517702,1517780,1517947,1518336,1518950,1519245,1519999,1520319,1520321,1520326,1524361,1524676,1524769,1524835,1524950,1525523,1526276,1526387,1526463,1527212,1527254,1527609,1527626,1527810,1528144,1528146,1528149,1528298,1529412,1529418,1529588,1530273,1530634,1530876,1530972,1530976,1531848,1532342,1532366,1533542,1533927,1535961,1536170,1536656,1537023,1537086,1537179,1537996,1538096,1539147,1539156,1539781
Modified: ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/JSONWriter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/JSONWriter.java?rev=1542238&r1=1542237&r2=1542238&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/JSONWriter.java (original)
+++ ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/json/JSONWriter.java Fri Nov 15 11:58:39 2013
@@ -142,9 +142,13 @@ public class JSONWriter {
}
public <E> JSONWriter write(Collection<E> c) throws IOException {
+ this.write(c.iterator());
+ return this;
+ }
+
+ public <E> JSONWriter write(Iterator<E> it) throws IOException {
writer.write('[');
writer.push();
- Iterator<E> it = c.iterator();
if (it.hasNext()) writer.newline();
while (it.hasNext()) {
write(it.next());
@@ -183,6 +187,8 @@ public class JSONWriter {
return write(UtilGenerics.<Map<?, ?>>cast(o));
} else if (o instanceof Collection<?>) {
return write(UtilGenerics.<Collection<?>>cast(o));
+ } else if (o instanceof Iterator<?>) {
+ return write(UtilGenerics.<Iterator<?>>cast(o));
} else if (o instanceof Byte) {
return write(((Byte) o).byteValue());
} else if (o instanceof Character) {