Remove more spurious JSONException uses
This commit is contained in:
parent
472dc7f2ac
commit
25aa076836
@ -39,8 +39,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
|
|
||||||
@ -50,11 +48,7 @@ public class GetHistoryCommand extends Command {
|
|||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
Project project = getProject(request);
|
Project project = getProject(request);
|
||||||
try {
|
|
||||||
respondJSON(response, project.history);
|
respondJSON(response, project.history);
|
||||||
} catch (JSONException e) {
|
|
||||||
respondException(response, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
|
|
||||||
@ -51,11 +49,7 @@ public class GetProcessesCommand extends Command {
|
|||||||
|
|
||||||
Project project = getProject(request);
|
Project project = getProject(request);
|
||||||
|
|
||||||
try {
|
|
||||||
respondJSON(response, project.processManager);
|
respondJSON(response, project.processManager);
|
||||||
} catch (JSONException e) {
|
|
||||||
respondException(response, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,8 +41,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
import com.google.refine.commands.HttpHeadersSupport;
|
import com.google.refine.commands.HttpHeadersSupport;
|
||||||
@ -113,7 +111,6 @@ public class GetModelsCommand extends Command {
|
|||||||
project = getProject(request);
|
project = getProject(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
response.setHeader("Cache-Control", "no-cache");
|
response.setHeader("Cache-Control", "no-cache");
|
||||||
|
|
||||||
Map<String, LanguageInfo> prefixesMap = new HashMap<>();
|
Map<String, LanguageInfo> prefixesMap = new HashMap<>();
|
||||||
@ -134,9 +131,6 @@ public class GetModelsCommand extends Command {
|
|||||||
project.overlayModels,
|
project.overlayModels,
|
||||||
prefixesMap,
|
prefixesMap,
|
||||||
headersMap));
|
headersMap));
|
||||||
} catch (JSONException e) {
|
|
||||||
HttpUtilities.respondException(response, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.google.refine.ProjectManager;
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -50,7 +48,6 @@ public class GetProjectMetadataCommand extends Command {
|
|||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
try {
|
|
||||||
Project project;
|
Project project;
|
||||||
try {
|
try {
|
||||||
project = getProject(request);
|
project = getProject(request);
|
||||||
@ -60,8 +57,5 @@ public class GetProjectMetadataCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
respondJSON(response, ProjectManager.singleton.getProjectMetadata(project.id));
|
respondJSON(response, ProjectManager.singleton.getProjectMetadata(project.id));
|
||||||
} catch (JSONException e) {
|
|
||||||
respondException(response, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.google.refine.ProjectManager;
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.ProjectMetadata;
|
import com.google.refine.ProjectMetadata;
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
@ -37,8 +35,6 @@ public class SetProjectMetadataCommand extends Command {
|
|||||||
ProjectManager.singleton.saveMetadata(meta, project.id);
|
ProjectManager.singleton.saveMetadata(meta, project.id);
|
||||||
|
|
||||||
respond(response, "{ \"code\" : \"ok\" }");
|
respond(response, "{ \"code\" : \"ok\" }");
|
||||||
} catch (JSONException e) {
|
|
||||||
respondException(response, e);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
respondException(response, e);
|
respondException(response, e);
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.google.refine.ProjectManager;
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.ProjectMetadata;
|
import com.google.refine.ProjectMetadata;
|
||||||
import com.google.refine.commands.Command;
|
import com.google.refine.commands.Command;
|
||||||
@ -47,7 +45,6 @@ public class SetProjectTagsCommand extends Command {
|
|||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
response.setHeader("Content-Type", "application/json");
|
response.setHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
try {
|
|
||||||
Project project;
|
Project project;
|
||||||
try {
|
try {
|
||||||
project = getProject(request);
|
project = getProject(request);
|
||||||
@ -98,9 +95,5 @@ public class SetProjectTagsCommand extends Command {
|
|||||||
metadata.updateModified();
|
metadata.updateModified();
|
||||||
|
|
||||||
respond(response, "{ \"code\" : \"ok\" }");
|
respond(response, "{ \"code\" : \"ok\" }");
|
||||||
|
|
||||||
} catch (JSONException e) {
|
|
||||||
respondException(response, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,7 +44,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
|
||||||
import org.odftoolkit.odfdom.doc.OdfDocument;
|
import org.odftoolkit.odfdom.doc.OdfDocument;
|
||||||
import org.odftoolkit.odfdom.doc.table.OdfTable;
|
import org.odftoolkit.odfdom.doc.table.OdfTable;
|
||||||
import org.odftoolkit.odfdom.doc.table.OdfTableCell;
|
import org.odftoolkit.odfdom.doc.table.OdfTableCell;
|
||||||
|
@ -45,8 +45,6 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
@ -110,7 +108,6 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
job.updating = true;
|
job.updating = true;
|
||||||
try {
|
|
||||||
ObjectNode config = job.getOrCreateDefaultConfig();
|
ObjectNode config = job.getOrCreateDefaultConfig();
|
||||||
if (!("new".equals(JSONUtilities.getString(config, "state", null)))) {
|
if (!("new".equals(JSONUtilities.getString(config, "state", null)))) {
|
||||||
HttpUtilities.respond(response, "error", "Job already started; cannot load more data");
|
HttpUtilities.respond(response, "error", "Job already started; cannot load more data");
|
||||||
@ -119,13 +116,9 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
|
|
||||||
ImportingUtilities.loadDataAndPrepareJob(
|
ImportingUtilities.loadDataAndPrepareJob(
|
||||||
request, response, parameters, job, config);
|
request, response, parameters, job, config);
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new ServletException(e);
|
|
||||||
} finally {
|
|
||||||
job.touch();
|
job.touch();
|
||||||
job.updating = false;
|
job.updating = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void doUpdateFileSelection(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
private void doUpdateFileSelection(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
@ -138,7 +131,6 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
job.updating = true;
|
job.updating = true;
|
||||||
try {
|
|
||||||
ObjectNode config = job.getOrCreateDefaultConfig();
|
ObjectNode config = job.getOrCreateDefaultConfig();
|
||||||
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
||||||
HttpUtilities.respond(response, "error", "Job not ready");
|
HttpUtilities.respond(response, "error", "Job not ready");
|
||||||
@ -151,13 +143,9 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
ImportingUtilities.updateJobWithNewFileSelection(job, fileSelectionArray);
|
ImportingUtilities.updateJobWithNewFileSelection(job, fileSelectionArray);
|
||||||
|
|
||||||
replyWithJobData(request, response, job);
|
replyWithJobData(request, response, job);
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new ServletException(e);
|
|
||||||
} finally {
|
|
||||||
job.touch();
|
job.touch();
|
||||||
job.updating = false;
|
job.updating = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void doUpdateFormatAndOptions(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
private void doUpdateFormatAndOptions(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
@ -170,7 +158,6 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
job.updating = true;
|
job.updating = true;
|
||||||
try {
|
|
||||||
ObjectNode config = job.getOrCreateDefaultConfig();
|
ObjectNode config = job.getOrCreateDefaultConfig();
|
||||||
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
||||||
HttpUtilities.respond(response, "error", "Job not ready");
|
HttpUtilities.respond(response, "error", "Job not ready");
|
||||||
@ -208,13 +195,9 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
w.flush();
|
w.flush();
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new ServletException(e);
|
|
||||||
} finally {
|
|
||||||
job.touch();
|
job.touch();
|
||||||
job.updating = false;
|
job.updating = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void doInitializeParserUI(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
private void doInitializeParserUI(HttpServletRequest request, HttpServletResponse response, Properties parameters)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
@ -253,7 +236,6 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
|
|
||||||
job.updating = true;
|
job.updating = true;
|
||||||
job.touch();
|
job.touch();
|
||||||
try {
|
|
||||||
ObjectNode config = job.getOrCreateDefaultConfig();
|
ObjectNode config = job.getOrCreateDefaultConfig();
|
||||||
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
if (!("ready".equals(JSONUtilities.getString(config, "state", null)))) {
|
||||||
HttpUtilities.respond(response, "error", "Job not ready");
|
HttpUtilities.respond(response, "error", "Job not ready");
|
||||||
@ -269,9 +251,6 @@ public class DefaultImportingController implements ImportingController {
|
|||||||
ImportingUtilities.createProject(job, format, optionObj, exceptions, false);
|
ImportingUtilities.createProject(job, format, optionObj, exceptions, false);
|
||||||
|
|
||||||
HttpUtilities.respond(response, "ok", "done");
|
HttpUtilities.respond(response, "ok", "done");
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new ServletException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class JobResponse {
|
protected static class JobResponse {
|
||||||
|
Loading…
Reference in New Issue
Block a user