From 09d1c96685b333c50bbd8f6699c9415c1fc1b25f Mon Sep 17 00:00:00 2001 From: Gabriele Zigurella Date: Mon, 27 Feb 2023 12:49:20 +0100 Subject: [PATCH] fix: handle null FileEntry on riparaPermessiAvvisi method --- .../it/mwg/sismica/bo/util/SismicaUtil.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java index 042d432b..8e097fff 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java @@ -1551,10 +1551,14 @@ public class SismicaUtil { FileEntry fileEntry = null; try { fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdBase()); - } catch (Exception e) {} - corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " - + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento - + StringPool.SPACE + documento.getPrimaryKey()); + } catch (Exception e) { + _log.error(e,e); + } + if(Validator.isNotNull(fileEntry)){ + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " + + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento + + StringPool.SPACE + documento.getPrimaryKey()); + } } if (Validator.isNotNull(pratica) && (documento.getFileEntryIdInvio() != 0)) { @@ -1562,20 +1566,28 @@ public class SismicaUtil { FileEntry fileEntry = null; try { fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdInvio()); - } catch (Exception e) {} - corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " - + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento - + StringPool.SPACE + documento.getPrimaryKey()); + } catch (Exception e) { + _log.error(e,e); + } + if(Validator.isNotNull(fileEntry)){ + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " + + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento + + StringPool.SPACE + documento.getPrimaryKey()); + } } if (Validator.isNotNull(pratica) && (documento.getFileEntryIdProtocollo() != 0)) { Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica.getTerritorioId()); FileEntry fileEntry = null; try { fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdProtocollo()); - } catch (Exception e) {} - corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " - + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento - + StringPool.SPACE + documento.getPrimaryKey()); + } catch (Exception e) { + _log.error(e,e); + } + if(Validator.isNotNull(fileEntry)){ + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, "Pratica " + + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + "), " + tipoDocumento + + StringPool.SPACE + documento.getPrimaryKey()); + } } } inizio += SLICE;