From 47dd5f8da635474d9a7eaec49178a17c26912127 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Fri, 15 Oct 2010 17:10:37 +0000 Subject: [PATCH] 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 --- .../refine/commands/project/ExportRowsCommand.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/src/com/google/refine/commands/project/ExportRowsCommand.java b/main/src/com/google/refine/commands/project/ExportRowsCommand.java index 2a346fb4b..88642aad2 100644 --- a/main/src/com/google/refine/commands/project/ExportRowsCommand.java +++ b/main/src/com/google/refine/commands/project/ExportRowsCommand.java @@ -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")); }