Revision: 18197
          http://sourceforge.net/p/gate/code/18197
Author:   markagreenwood
Date:     2014-07-18 09:53:54 +0000 (Fri, 18 Jul 2014)
Log Message:
-----------
fixed a bug that could lead to corrup json files

Modified Paths:
--------------
    gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java

Modified: gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java
===================================================================
--- gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java     2014-07-18 
01:19:41 UTC (rev 18196)
+++ gate/trunk/src/main/gate/corpora/DocumentJsonUtils.java     2014-07-18 
09:53:54 UTC (rev 18197)
@@ -366,5 +366,12 @@
       }
     }
     json.writeEndObject(); // end of document
+
+    // Make sure that everything we have generated is flushed to the
+    // underlying OutputStream. It seems that not doing this can easily
+    // lead to corrupt files that just end in the middle of a JSON
+    // object. This occurs even if you flush the OutputStream instance
+    // as the data never leaves the JsonGenerator
+    json.flush();
   }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to