Commit 1fe2b612 authored by Alina Habibulina's avatar Alina Habibulina

[FIX] более подробные логи

parent 9ec6cff3
...@@ -233,20 +233,28 @@ public class ImportBean { ...@@ -233,20 +233,28 @@ public class ImportBean {
Cell cell = iter.next(); Cell cell = iter.next();
CellValue cellValue = evaluator.evaluate(cell); CellValue cellValue = evaluator.evaluate(cell);
if(cellValue == null || cellValue.equals("")) continue;
//получили заголовок ячейки //получили заголовок ячейки
String header = cell.getSheet().getRow(0).getCell(cell.getColumnIndex()).getRichStringCellValue().toString(); String header = cell.getSheet().getRow(0).getCell(cell.getColumnIndex()).getRichStringCellValue().toString();
try {
//получили заголовок ячейки
if (header.equals(NO) || header.equals("")) {
continue;
}
if (header.equals(NO)) { if (header.equals(NO)) {
continue; continue;
} }
FormField defField = formFields.get(header); FormField defField = formFields.get(header);
if (defField == null) { if (defField == null) {
errors.add(row); errors.add(row);
LOGGER.error("Import error in line :" + (row.getRowNum() + 1)); LOGGER.error("Import error in line :" + (row.getRowNum() + 1));
} }
FormField valueFF = new FormField(defField); FormField valueFF = new FormField(defField);
if(cellValue == null) continue; if(cellValue == null) continue;
switch (cellValue.getCellType()) { switch (cellValue.getCellType()) {
...@@ -317,7 +325,12 @@ public class ImportBean { ...@@ -317,7 +325,12 @@ public class ImportBean {
} }
rowFF.add(valueFF); rowFF.add(valueFF);
} catch (Exception e){
LOGGER.error("Error in line :" + (row.getRowNum() + 1) + ". Something wrong with cell of type: " + cellValue.getCellType() +
", and value: \"" + cellValue.formatAsString() + "\". The header is: \"" + header + "\".");
LOGGER.error(e.getMessage());
}
} }
if (rowFF != null && !rowFF.isEmpty()) { if (rowFF != null && !rowFF.isEmpty()) {
...@@ -381,8 +394,12 @@ public class ImportBean { ...@@ -381,8 +394,12 @@ public class ImportBean {
ff.setElements(elements); ff.setElements(elements);
} }
} else if(formField.get("dataSource") != null){ } else if(formField.get("dataSource") != null){
JsonObject dataSource = formField.get("dataSource").getAsJsonObject(); try {
ff.setElements(getDictionary(dataSource.get("dict").getAsString(), dataSource.get("key").getAsString(), dataSource.get("value").getAsString(), login, password)); JsonObject dataSource = formField.get("dataSource").getAsJsonObject();
ff.setElements(getDictionary(dataSource.get("dict").getAsString(), dataSource.get("key").getAsString(), dataSource.get("value").getAsString(), login, password));
} catch (Exception e){
LOGGER.error(e.getMessage());
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment