Make sure the stream/writer is flushed in case the exporter forgets to do it

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1569 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2010-10-15 17:10:37 +00:00
parent aba75a9b4a
commit 47dd5f8da6

View File

@ -1,6 +1,7 @@
package com.google.refine.commands.project;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.Properties;
@ -55,10 +56,13 @@ public class ExportRowsCommand extends Command {
if (exporter instanceof WriterExporter) {
PrintWriter writer = response.getWriter();
((WriterExporter) exporter).export(project, options, engine, writer);
writer.flush();
} else if (exporter instanceof StreamExporter) {
((StreamExporter) exporter).export(project, options, engine, response.getOutputStream());
} else if (exporter instanceof StreamExporter) {
((StreamExporter) exporter).export(project, options, engine, response.getOutputStream());
OutputStream stream = response.getOutputStream();
((StreamExporter) exporter).export(project, options, engine, stream);
stream.flush();
// } else if (exporter instanceof UrlExporter) {
// ((UrlExporter) exporter).export(project, options, engine);
} else {
respondException(response, new RuntimeException("Unknown exporter type"));
}