diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/ModificacionMasivaPricingEspecificoUploadController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/ModificacionMasivaPricingEspecificoUploadController.java index c1c9d5c95..a1c736feb 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/ModificacionMasivaPricingEspecificoUploadController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/ModificacionMasivaPricingEspecificoUploadController.java @@ -207,23 +207,34 @@ public class ModificacionMasivaPricingEspecificoUploadController extends MyGener private Date getDatePorRow(Row row, int numeroCell, StringBuilder erro) throws ParseException { Cell cell = row.getCell(numeroCell); String nome = getNomeCell(numeroCell); + Date date =null; try { if (cell == null) { return null; } - - if (cell.getStringCellValue() == null) { - return null; + + if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + date = cell.getDateCellValue(); + }else{ + if (cell.getStringCellValue() == null) { + return null; + } + DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + date = format.parse(cell.getStringCellValue()); } - - DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); - Date date = format.parse(cell.getStringCellValue()); - return date; - } catch (Exception ex) { + + } catch (ParseException ex) { erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + " está fora do formato.\n"); return null; + } catch (IllegalStateException ex) { + erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + ". Tipo da coluna divergente com dado informado. Ex.: Número no lugar do texto\n"); + return null; + } catch (Exception ex) { + erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + ". Erro desconhecido\n"); + return null; } + return date; } private Boolean isCancelar(Row row) {