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