abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1056350 - in /abdera/java/trunk/extensions/json/src: main/java/org/apache/abdera/ext/json/JSONWriter.java test/java/org/apache/abdera/ext/json/JSONStreamTest.java
Date Fri, 07 Jan 2011 15:28:03 GMT
Author: antelder
Date: Fri Jan  7 15:28:03 2011
New Revision: 1056350

URL: http://svn.apache.org/viewvc?rev=1056350&view=rev
Log:
ABDERA-277: Correct application of patch to fix Excessive calls to flush() on the Writer responsible
for writing JSONStream data

Modified:
    abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONWriter.java
    abdera/java/trunk/extensions/json/src/test/java/org/apache/abdera/ext/json/JSONStreamTest.java

Modified: abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONWriter.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONWriter.java?rev=1056350&r1=1056349&r2=1056350&view=diff
==============================================================================
--- abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONWriter.java
(original)
+++ abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONWriter.java
Fri Jan  7 15:28:03 2011
@@ -69,6 +69,7 @@ public class JSONWriter extends Abstract
     public void writeTo(Base base, java.io.Writer out, WriterOptions options) throws IOException
{
         try {
             JSONUtil.toJson(base, out);
+            out.flush();
             if (options.getAutoClose())
                 out.close();
         } catch (Exception e) {

Modified: abdera/java/trunk/extensions/json/src/test/java/org/apache/abdera/ext/json/JSONStreamTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/extensions/json/src/test/java/org/apache/abdera/ext/json/JSONStreamTest.java?rev=1056350&r1=1056349&r2=1056350&view=diff
==============================================================================
--- abdera/java/trunk/extensions/json/src/test/java/org/apache/abdera/ext/json/JSONStreamTest.java
(original)
+++ abdera/java/trunk/extensions/json/src/test/java/org/apache/abdera/ext/json/JSONStreamTest.java
Fri Jan  7 15:28:03 2011
@@ -18,14 +18,12 @@
 package org.apache.abdera.ext.json;
 
 import static org.junit.Assert.assertTrue;
-
 import java.io.ByteArrayOutputStream;
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.writer.Writer;
-import org.apache.abdera.writer.WriterOptions;
 import org.junit.Test;
 
 public class JSONStreamTest {
@@ -39,9 +37,7 @@ public class JSONStreamTest {
 
         Writer json = abdera.getWriterFactory().getWriter("json");
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        WriterOptions opts = entry.getDefaultWriterOptions();
-        opts.setAutoClose(true);
-        entry.writeTo(json, outputStream, opts);
+        entry.writeTo(json, outputStream);
         String output = outputStream.toString();
         assertTrue(output.contains("\"type\":\"text/xml\""));
         assertTrue(output.contains("\"src\":\"http://example.org/xml\""));



Mime
View raw message