Migrate ColumnSplitChange to Jackson

This commit is contained in:
Antonin Delpeuch 2018-11-20 17:01:09 +00:00
parent fa8e7d0e50
commit f08f488006

View File

@ -42,9 +42,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import org.json.JSONObject;
import org.json.JSONTokener;
import com.google.refine.ProjectManager;
import com.google.refine.history.Change;
import com.google.refine.model.Cell;
@ -52,6 +49,7 @@ import com.google.refine.model.Column;
import com.google.refine.model.ColumnGroup;
import com.google.refine.model.Project;
import com.google.refine.model.Row;
import com.google.refine.util.ParsingUtilities;
import com.google.refine.util.Pool;
public class ColumnSplitChange implements Change {
@ -272,7 +270,7 @@ public class ColumnSplitChange implements Change {
if (value == null) {
writer.write("null");
} else if (value instanceof String) {
writer.write(JSONObject.quote((String) value));
writer.write(ParsingUtilities.mapper.writeValueAsString((String) value));
} else {
writer.write(value.toString());
}
@ -361,10 +359,7 @@ public class ColumnSplitChange implements Change {
for (int r = 0; r < valueCount; r++) {
line = reader.readLine();
JSONTokener t = new JSONTokener(line);
Object o = t.nextValue();
tuple.add((o != JSONObject.NULL) ? (Serializable) o : null);
tuple.add((Serializable) ParsingUtilities.mapper.readValue(line, Object.class));
}
tuples.add(tuple);