From dae112b920db9ce52acb005cd9c2d00bcd7c3a39 Mon Sep 17 00:00:00 2001 From: Salvatore La Manna Date: Wed, 13 Oct 2021 14:22:39 +0200 Subject: [PATCH] Fix definitivo per caratteri non validi nel nome dei file all'interno degli zip --- .../liferay/portos/bo/portlet/AllegatiManualiPortlet.java | 6 +++++- .../liferay/portos/bo/portlet/DocAggiuntivaPortlet.java | 6 +++++- .../it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java | 1 - .../docroot/WEB-INF/src/service.properties | 4 ++-- .../liferay/portos/fe/portlet/AllegatiPraticaPortlet.java | 5 ++++- .../portos-fe-portlet/docroot/html/allegatipratica/view.jsp | 5 ++++- .../html/portlet/workflow_tasks/workflow_task_action.jsp | 3 ++- 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java index 7648a347..f2643f28 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java @@ -7,6 +7,7 @@ import it.tref.liferay.portos.bo.service.AllegatoManualeServiceUtil; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.List; @@ -104,7 +105,10 @@ public class AllegatiManualiPortlet extends MVCPortlet { FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getFileEntryId()); inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); - String name = fileEntry.getTitle() + StringPool.PERIOD + fileEntry.getExtension(); + String s = new String(fileEntry.getTitle().getBytes(StandardCharsets.UTF_8)); + byte[] b = s.getBytes(StandardCharsets.ISO_8859_1); + String name = new String(b, StandardCharsets.ISO_8859_1) + StringPool.PERIOD + + fileEntry.getExtension(); zipWriter.addEntry(name, inputStream); } finally { StreamUtil.cleanUp(inputStream); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/DocAggiuntivaPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/DocAggiuntivaPortlet.java index 0308e9b9..6b774528 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/DocAggiuntivaPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/DocAggiuntivaPortlet.java @@ -7,6 +7,7 @@ import it.tref.liferay.portos.bo.service.DocAggiuntivaServiceUtil; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.List; @@ -106,7 +107,10 @@ public class DocAggiuntivaPortlet extends MVCPortlet { inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); - String name = fileEntry.getTitle() + StringPool.PERIOD + fileEntry.getExtension(); + String s = new String(fileEntry.getTitle().getBytes(StandardCharsets.UTF_8)); + byte[] b = s.getBytes(StandardCharsets.ISO_8859_1); + String name = new String(b, StandardCharsets.ISO_8859_1) + StringPool.PERIOD + + fileEntry.getExtension(); zipWriter.addEntry(name, inputStream); } finally { StreamUtil.cleanUp(inputStream); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java index d25a79ea..4cf8e193 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java @@ -339,7 +339,6 @@ public class FascicoloPortlet extends MVCPortlet { if (Validator.isNull(doc.getDlFileEntryId())) { continue; } - FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getDlFileEntryId()); inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index c0cb64c9..6676009b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=2712 - build.date=1632147297567 + build.number=2713 + build.date=1633514794474 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/AllegatiPraticaPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/AllegatiPraticaPortlet.java index b7431607..7ffe5932 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/AllegatiPraticaPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/AllegatiPraticaPortlet.java @@ -12,6 +12,7 @@ import it.tref.liferay.portos.bo.util.DelegheUtil; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.ArrayList; import java.util.Date; @@ -263,7 +264,9 @@ public class AllegatiPraticaPortlet extends MVCPortlet { FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getDlFileEntryId()); inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); - String name = fileEntry.getTitle(); + String s = new String(fileEntry.getTitle().getBytes(StandardCharsets.UTF_8)); + byte[] b = s.getBytes(StandardCharsets.ISO_8859_1); + String name = new String(b, StandardCharsets.ISO_8859_1); zipWriter.addEntry(name, inputStream); } finally { if (inputStream != null) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp index d7ef5543..3fda7f00 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp @@ -1,3 +1,4 @@ +<%@page import="com.liferay.portal.kernel.exception.PortalException"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="it.tref.liferay.portos.bo.util.ValidazionePraticaUtil"%> <%@page import="it.tref.liferay.portos.bo.shared.util.SessionUtil"%> @@ -58,7 +59,9 @@ if (isFineLavori) { if (dettPraticaIdParam == 0) { dettPraticaIdParam = GetterUtil.getLong(httpServletRequest.getParameter("classPk")); } - dettPratica = DettPraticaServiceUtil.getDettPratica(dettPraticaIdParam); + if (dettPraticaIdParam != 0) { + dettPratica = DettPraticaServiceUtil.getDettPratica(dettPraticaIdParam); + } } if (dettPratica == null) { dettPratica = DettPraticaServiceUtil.getDettPratica(classPk); diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/workflow_task_action.jsp b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/workflow_task_action.jsp index 0191912b..0bbab4d6 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/workflow_task_action.jsp +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/workflow_task_action.jsp @@ -45,7 +45,8 @@ if (row != null) { else { workflowTask = (WorkflowTask) request.getAttribute(WebKeys.WORKFLOW_TASK); } -long[] pooledActorsIds = WorkflowTaskManagerUtil.getPooledActorsIds(company.getCompanyId(), workflowTask.getWorkflowTaskId()); +long[] pooledActorsIds = WorkflowTaskManagerUtil + .getPooledActorsIds(company.getCompanyId(), workflowTask.getWorkflowTaskId()); %>