Add missing .flush(); .close() on JsonGenerator
This commit is contained in:
parent
7156c49c4d
commit
c9620a5d9a
@ -35,12 +35,9 @@ import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
import edu.mit.simile.butterfly.ButterflyModuleImpl;
|
||||
|
||||
|
||||
|
@ -31,9 +31,7 @@ import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
import org.openrefine.wikidata.editing.ConnectionManager;
|
||||
import org.openrefine.wikidata.editing.EditBatchProcessor;
|
||||
import org.openrefine.wikidata.editing.NewItemLibrary;
|
||||
@ -56,7 +54,6 @@ import com.google.refine.history.HistoryEntry;
|
||||
import com.google.refine.model.AbstractOperation;
|
||||
import com.google.refine.model.Project;
|
||||
import com.google.refine.operations.EngineDependentOperation;
|
||||
import com.google.refine.operations.OperationRegistry;
|
||||
import com.google.refine.process.LongRunningProcess;
|
||||
import com.google.refine.process.Process;
|
||||
import com.google.refine.util.Pool;
|
||||
|
@ -28,9 +28,7 @@ import java.io.LineNumberReader;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
import org.openrefine.wikidata.schema.WikibaseSchema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@ -39,7 +37,6 @@ import com.google.refine.history.Change;
|
||||
import com.google.refine.history.HistoryEntry;
|
||||
import com.google.refine.model.AbstractOperation;
|
||||
import com.google.refine.model.Project;
|
||||
import com.google.refine.operations.OperationRegistry;
|
||||
import com.google.refine.util.ParsingUtilities;
|
||||
import com.google.refine.util.Pool;
|
||||
|
||||
|
@ -26,11 +26,9 @@ package org.openrefine.wikidata.schema;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
import org.openrefine.wikidata.qa.QAWarningStore;
|
||||
import org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException;
|
||||
import org.openrefine.wikidata.updates.ItemUpdate;
|
||||
|
@ -295,6 +295,8 @@ public abstract class Command {
|
||||
writer.writeStringField("status", status);
|
||||
writer.writeStringField("message", message);
|
||||
writer.writeEndObject();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
w.flush();
|
||||
w.close();
|
||||
}
|
||||
@ -360,6 +362,8 @@ public abstract class Command {
|
||||
|
||||
writer.writeStringField("stack", sw.toString());
|
||||
writer.writeEndObject();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
w.flush();
|
||||
w.close();
|
||||
} catch (JSONException e1) {
|
||||
|
@ -49,6 +49,8 @@ abstract public class HttpUtilities {
|
||||
writer.writeStringField("status", status);
|
||||
writer.writeStringField("message", message);
|
||||
writer.writeEndObject();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
w.flush();
|
||||
w.close();
|
||||
} catch (JSONException e) {
|
||||
@ -101,6 +103,8 @@ abstract public class HttpUtilities {
|
||||
writer.writeStringField("message", e.getMessage());
|
||||
writer.writeStringField("stack", sw.toString());
|
||||
writer.writeEndObject();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
w.flush();
|
||||
w.close();
|
||||
} catch (JSONException e1) {
|
||||
|
@ -73,6 +73,8 @@ public class GetColumnsInfoCommand extends Command {
|
||||
writer.writeEndObject();
|
||||
}
|
||||
writer.writeEndArray();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
respondException(response, e);
|
||||
|
@ -201,6 +201,8 @@ public class DefaultImportingController implements ImportingController {
|
||||
writer.writeEndArray();
|
||||
}
|
||||
writer.writeEndObject();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new ServletException(e);
|
||||
} finally {
|
||||
@ -298,7 +300,7 @@ public class DefaultImportingController implements ImportingController {
|
||||
throws ServletException, IOException {
|
||||
|
||||
Writer w = response.getWriter();
|
||||
ParsingUtilities.defaultWriter.writeValue(w, job);
|
||||
ParsingUtilities.defaultWriter.writeValue(w, new JobResponse("ok",job));
|
||||
w.flush();
|
||||
w.close();
|
||||
}
|
||||
|
@ -6,12 +6,10 @@ import static org.mockito.Mockito.when;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
Loading…
Reference in New Issue
Block a user