Merge pull request #2782 from tfmorris/2306-gdata-empty-cells
Fix Google Sheets export with empty cells
This commit is contained in:
commit
6b00c7b602
@ -80,9 +80,7 @@ final class SpreadsheetSerializer implements TabularSerializer {
|
|||||||
|
|
||||||
for (int c = 0; c < cells.size(); c++) {
|
for (int c = 0; c < cells.size(); c++) {
|
||||||
CellData cellData = cells.get(c);
|
CellData cellData = cells.get(c);
|
||||||
if (cellData != null && cellData.text != null) {
|
cellDatas.add(cellData2sheetCellData(cellData));
|
||||||
cellDatas.add(cellData2sheetCellData(cellData));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rowData.setValues(cellDatas);
|
rowData.setValues(cellDatas);
|
||||||
@ -98,8 +96,12 @@ final class SpreadsheetSerializer implements TabularSerializer {
|
|||||||
com.google.api.services.sheets.v4.model.CellData sheetCellData = new com.google.api.services.sheets.v4.model.CellData();
|
com.google.api.services.sheets.v4.model.CellData sheetCellData = new com.google.api.services.sheets.v4.model.CellData();
|
||||||
|
|
||||||
ExtendedValue ev = new ExtendedValue();
|
ExtendedValue ev = new ExtendedValue();
|
||||||
ev.setStringValue(cellData.value.toString());
|
if (cellData == null || cellData.value == null) {
|
||||||
|
ev.setStringValue("");
|
||||||
|
} else {
|
||||||
|
ev.setStringValue(cellData.value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
sheetCellData.setUserEnteredValue(ev);
|
sheetCellData.setUserEnteredValue(ev);
|
||||||
|
|
||||||
return sheetCellData;
|
return sheetCellData;
|
||||||
|
@ -68,6 +68,8 @@ public class UploadCommand extends Command {
|
|||||||
|
|
||||||
private static final String METADATA_DESCRIPTION = "OpenRefine project dump";
|
private static final String METADATA_DESCRIPTION = "OpenRefine project dump";
|
||||||
private static final String METADATA_ICON_FILE = "logo-openrefine-550.png";
|
private static final String METADATA_ICON_FILE = "logo-openrefine-550.png";
|
||||||
|
|
||||||
|
// TODO: We need a way to provide progress to the user during long uploads
|
||||||
@Override
|
@Override
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
@ -99,7 +101,8 @@ public class UploadCommand extends Command {
|
|||||||
|
|
||||||
List<Exception> exceptions = new LinkedList<Exception>();
|
List<Exception> exceptions = new LinkedList<Exception>();
|
||||||
String url = upload(project, engine, params, token, name, exceptions);
|
String url = upload(project, engine, params, token, name, exceptions);
|
||||||
if (url != null) {
|
// The URL can be non-null even if it doesn't fail
|
||||||
|
if (url != null && exceptions.size() == 0) {
|
||||||
writer.writeStringField("status", "ok");
|
writer.writeStringField("status", "ok");
|
||||||
writer.writeStringField("url", url);
|
writer.writeStringField("url", url);
|
||||||
} else if (exceptions.size() == 0) {
|
} else if (exceptions.size() == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user