Fix issue #1509
This commit is contained in:
parent
b51dbdcbf2
commit
32c5838a8d
@ -92,6 +92,7 @@ import com.google.refine.ProjectManager;
|
|||||||
import com.google.refine.RefineServlet;
|
import com.google.refine.RefineServlet;
|
||||||
import com.google.refine.importing.ImportingManager.Format;
|
import com.google.refine.importing.ImportingManager.Format;
|
||||||
import com.google.refine.importing.UrlRewriter.Result;
|
import com.google.refine.importing.UrlRewriter.Result;
|
||||||
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.ColumnModel;
|
import com.google.refine.model.ColumnModel;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -1131,8 +1132,19 @@ public class ImportingUtilities {
|
|||||||
List<Row> rows = project.rows
|
List<Row> rows = project.rows
|
||||||
.stream()
|
.stream()
|
||||||
.limit(INFER_ROW_LIMIT)
|
.limit(INFER_ROW_LIMIT)
|
||||||
|
.map(Row::dup)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
rows.forEach(r->listCells.add(r.cells.toArray()));
|
// convert the null object to prevent the NPE
|
||||||
|
for (Row row : rows) {
|
||||||
|
for (int i = 0; i < row.cells.size(); i++) {
|
||||||
|
Cell cell = row.cells.get(i);
|
||||||
|
if (cell == null) {
|
||||||
|
row.cells.set(i, new Cell(StringUtils.EMPTY, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listCells.add(row.cells.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject fieldsJSON = TypeInferrer.getInstance().infer(listCells,
|
JSONObject fieldsJSON = TypeInferrer.getInstance().infer(listCells,
|
||||||
project.columnModel.getColumnNames().toArray(new String[0]),
|
project.columnModel.getColumnNames().toArray(new String[0]),
|
||||||
|
Loading…
Reference in New Issue
Block a user