From 1b0e1430ce676a2bdebc2db8d301a9a153ed5017 Mon Sep 17 00:00:00 2001 From: valdevir Date: Thu, 18 Aug 2022 20:05:02 +0000 Subject: [PATCH] fixes bug#24703 AL-1236 qua: dev:Valdir git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@113903 d1611594-4594-4d17-8e1d-87c2c4800839 --- ...sivaPricingEspecificoUploadController.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) 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) {