Migrate ColumnSplitChange to Jackson
This commit is contained in:
parent
fa8e7d0e50
commit
f08f488006
@ -42,9 +42,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.json.JSONTokener;
|
|
||||||
|
|
||||||
import com.google.refine.ProjectManager;
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Cell;
|
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.ColumnGroup;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
import com.google.refine.util.Pool;
|
import com.google.refine.util.Pool;
|
||||||
|
|
||||||
public class ColumnSplitChange implements Change {
|
public class ColumnSplitChange implements Change {
|
||||||
@ -272,7 +270,7 @@ public class ColumnSplitChange implements Change {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
writer.write("null");
|
writer.write("null");
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
writer.write(JSONObject.quote((String) value));
|
writer.write(ParsingUtilities.mapper.writeValueAsString((String) value));
|
||||||
} else {
|
} else {
|
||||||
writer.write(value.toString());
|
writer.write(value.toString());
|
||||||
}
|
}
|
||||||
@ -361,10 +359,7 @@ public class ColumnSplitChange implements Change {
|
|||||||
for (int r = 0; r < valueCount; r++) {
|
for (int r = 0; r < valueCount; r++) {
|
||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
|
|
||||||
JSONTokener t = new JSONTokener(line);
|
tuple.add((Serializable) ParsingUtilities.mapper.readValue(line, Object.class));
|
||||||
Object o = t.nextValue();
|
|
||||||
|
|
||||||
tuple.add((o != JSONObject.NULL) ? (Serializable) o : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tuples.add(tuple);
|
tuples.add(tuple);
|
||||||
|
Loading…
Reference in New Issue
Block a user