diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index aa71e75bf..6302ea75f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -293,7 +293,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO it = boletos.iterator(); it.hasNext();) { - - FechamentoBoleto fechamentoBoleto = it.next(); - - if(banco == null){ - banco = BancoLayout.getInstanceByCodBanco(remessaCNABBancosDAO.findBanco(fechamentoBoleto.getFechamentoCntcorrente().getEmpresa())); - } - - if(!NossoNumeroUtils.validaNossoNumero(fechamentoBoleto.getNossonumero(), banco)){ - it.remove(); - toReturn = Boolean.FALSE; + if(boletos != null && !boletos.isEmpty()) { + for (java.util.Iterator it = boletos.iterator(); it.hasNext();) { + + FechamentoBoleto fechamentoBoleto = it.next(); + + if(banco == null){ + banco = BancoLayout.getInstanceByCodBanco(remessaCNABBancosDAO.findBanco(fechamentoBoleto.getFechamentoCntcorrente().getEmpresa())); + } + + if(!NossoNumeroUtils.validaNossoNumero(fechamentoBoleto.getNossonumero(), banco)){ + it.remove(); + toReturn = Boolean.FALSE; + } } } @@ -128,12 +130,14 @@ public class ArquivoRemessaCNABImpl implements ArquivoRemessaCNAB { boolean toReturn = Boolean.FALSE; - for (java.util.Iterator it = boletos.iterator(); it.hasNext();) { - - FechamentoBoleto fechamentoBoleto = it.next(); - - if(fechamentoBoleto.getRemessaId() == null){ - return Boolean.TRUE; + if(boletos != null && !boletos.isEmpty()) { + for (java.util.Iterator it = boletos.iterator(); it.hasNext();) { + + FechamentoBoleto fechamentoBoleto = it.next(); + + if(fechamentoBoleto.getRemessaId() == null){ + return Boolean.TRUE; + } } }