diff --git a/main/src/com/google/refine/ProjectManager.java b/main/src/com/google/refine/ProjectManager.java index 8b016d175..66f2e6dcd 100644 --- a/main/src/com/google/refine/ProjectManager.java +++ b/main/src/com/google/refine/ProjectManager.java @@ -45,9 +45,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.tools.tar.TarOutputStream; -import org.json.JSONException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -418,15 +416,10 @@ public abstract class ProjectManager { initDisplay(jsonObjArray); - try { - String userMeta = (String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY); - if (userMeta == null) - return; - userMetadataPreference = ParsingUtilities.mapper.createArrayNode(); - } catch (JSONException e1) { - logger.warn("wrong definition of userMetadata format. Please use form [{\"name\": \"client name\", \"display\":true}, {\"name\": \"progress\", \"display\":false}]"); - logger.error(ExceptionUtils.getFullStackTrace(e1)); - } + String userMeta = (String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY); + if (userMeta == null) + return; + userMetadataPreference = ParsingUtilities.mapper.createArrayNode(); for (int index = 0; index < userMetadataPreference.size(); index++) { boolean found = false; diff --git a/main/src/com/google/refine/commands/browsing/GetScatterplotCommand.java b/main/src/com/google/refine/commands/browsing/GetScatterplotCommand.java index d54bf2230..6d0f87b08 100644 --- a/main/src/com/google/refine/commands/browsing/GetScatterplotCommand.java +++ b/main/src/com/google/refine/commands/browsing/GetScatterplotCommand.java @@ -44,7 +44,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,7 +94,7 @@ public class GetScatterplotCommand extends Command { } } - public void draw(OutputStream output, Project project, Engine engine, JSONObject o) throws IOException, JSONException { + public void draw(OutputStream output, Project project, Engine engine, JSONObject o) throws IOException { double min_x = 0; double min_y = 0; diff --git a/main/src/com/google/refine/expr/functions/arrays/Join.java b/main/src/com/google/refine/expr/functions/arrays/Join.java index 492ab9448..c59522231 100644 --- a/main/src/com/google/refine/expr/functions/arrays/Join.java +++ b/main/src/com/google/refine/expr/functions/arrays/Join.java @@ -36,8 +36,6 @@ package com.google.refine.expr.functions.arrays; import java.util.List; import java.util.Properties; -import org.json.JSONException; - import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.refine.expr.EvalError; import com.google.refine.expr.ExpressionUtils; @@ -75,12 +73,7 @@ public class Join implements Function { if (sb.length() > 0) { sb.append(separator); } - try { - sb.append(JsonValueConverter.convert(a.get(i)).toString()); - } catch (JSONException e) { - return new EvalError(ControlFunctionRegistry.getFunctionName(this) + - " cannot retrieve element " + i + " of array"); - } + sb.append(JsonValueConverter.convert(a.get(i)).toString()); } } else { for (Object o : ExpressionUtils.toObjectList(v)) { diff --git a/main/src/com/google/refine/importers/ExcelImporter.java b/main/src/com/google/refine/importers/ExcelImporter.java index 8bce9bcad..173fc1e73 100644 --- a/main/src/com/google/refine/importers/ExcelImporter.java +++ b/main/src/com/google/refine/importers/ExcelImporter.java @@ -44,7 +44,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.poi.POIXMLDocument; import org.apache.poi.POIXMLException; import org.apache.poi.common.usermodel.Hyperlink; @@ -54,7 +53,6 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.json.JSONException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -187,13 +185,9 @@ public class ExcelImporter extends TabularImportingParserBase { for(int i=0;i entry : _projectsMetadata.entrySet()) { ProjectMetadata metadata = entry.getValue(); if (metadata != null && metadata.isDirty()) { @@ -305,7 +304,7 @@ public class FileProjectManager extends ProjectManager { } } - protected boolean saveToFile(File file) throws IOException, JSONException { + protected boolean saveToFile(File file) throws IOException { FileWriter writer = new FileWriter(file); boolean saveWasNeeded = saveNeeded(); try { diff --git a/main/src/com/google/refine/io/ProjectMetadataUtilities.java b/main/src/com/google/refine/io/ProjectMetadataUtilities.java index 63601f3c9..61d5d227e 100644 --- a/main/src/com/google/refine/io/ProjectMetadataUtilities.java +++ b/main/src/com/google/refine/io/ProjectMetadataUtilities.java @@ -46,10 +46,6 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.json.JSONWriter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +57,7 @@ import com.google.refine.util.ParsingUtilities; public class ProjectMetadataUtilities { final static Logger logger = LoggerFactory.getLogger("project_metadata_utilities"); - public static void save(ProjectMetadata projectMeta, File projectDir) throws JSONException, IOException { + public static void save(ProjectMetadata projectMeta, File projectDir) throws IOException { File tempFile = new File(projectDir, "metadata.temp.json"); saveToFile(projectMeta, tempFile); @@ -79,7 +75,7 @@ public class ProjectMetadataUtilities { tempFile.renameTo(file); } - protected static void saveToFile(ProjectMetadata projectMeta, File metadataFile) throws JSONException, IOException { + protected static void saveToFile(ProjectMetadata projectMeta, File metadataFile) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(metadataFile)); try { ParsingUtilities.defaultWriter.writeValue(writer, projectMeta); diff --git a/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java b/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java index 4251235e5..a120d8651 100644 --- a/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java +++ b/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java @@ -45,8 +45,6 @@ import java.util.List; import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.json.JSONException; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.cache.CacheBuilder; @@ -224,7 +222,7 @@ public class ColumnAdditionByFetchingURLsOperation extends EngineDependentOperat Evaluable eval, String description, boolean cacheResponses - ) throws JSONException { + ) { super(description); _project = project; _engine = engine; diff --git a/main/src/com/google/refine/operations/recon/ExtendDataOperation.java b/main/src/com/google/refine/operations/recon/ExtendDataOperation.java index 670adda23..32dfe1538 100644 --- a/main/src/com/google/refine/operations/recon/ExtendDataOperation.java +++ b/main/src/com/google/refine/operations/recon/ExtendDataOperation.java @@ -41,8 +41,6 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.json.JSONException; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.refine.browsing.Engine; @@ -140,7 +138,7 @@ public class ExtendDataOperation extends EngineDependentOperation { Project project, EngineConfig engineConfig, String description - ) throws JSONException { + ) { super(description); _project = project; _engineConfig = engineConfig; diff --git a/main/src/com/google/refine/sorting/BaseSorter.java b/main/src/com/google/refine/sorting/BaseSorter.java index 1f5346d9d..67fa23f1a 100644 --- a/main/src/com/google/refine/sorting/BaseSorter.java +++ b/main/src/com/google/refine/sorting/BaseSorter.java @@ -35,8 +35,6 @@ package com.google.refine.sorting; import java.util.List; -import org.json.JSONException; - import com.google.refine.expr.EvalError; import com.google.refine.model.Project; import com.google.refine.sorting.Criterion.KeyMaker; @@ -102,7 +100,7 @@ abstract public class BaseSorter { } } - public void initializeFromConfig(Project project, SortingConfig config) throws JSONException { + public void initializeFromConfig(Project project, SortingConfig config) { _criteria = config.getCriteria(); int count = _criteria.length; _keyMakers = new KeyMaker[count];