From d201650cf415332d5080be396485a3c03d549f1c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 23 Apr 2023 07:19:38 +0200 Subject: [PATCH] Fixes IDEMPIERE-5684 Bad naming of Automatic 2Packs stop the whole process (#1794) --- .../src/org/adempiere/plugin/utils/AbstractActivator.java | 5 +++++ .../plugin/utils/PackInApplicationActivator.java | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java index 574cd60633..1d94bc5ab9 100644 --- a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java +++ b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java @@ -122,6 +122,11 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack int clientId = Env.getAD_Client_ID(Env.getCtx()); if (version == null) { String [] parts = fileName.split("_"); + if (parts.length < 2) { + logger.warning("Wrong name, ignored " + fileName); + return false; + } + logger.warning(fileName); String clientValue = parts[1]; clientId = DB.getSQLValueEx(null, "SELECT AD_Client_ID FROM AD_Client WHERE Value=?", clientValue); if (clientId < 0) diff --git a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java index 74f14a4f93..e6c8b899e0 100644 --- a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java +++ b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java @@ -150,12 +150,14 @@ public class PackInApplicationActivator extends AbstractActivator{ private boolean packIn(File packinFile) { if (packinFile != null) { String fileName = packinFile.getName(); - logger.warning("Installing " + fileName + " ..."); - // The convention for package names is: yyyymmddHHMM_ClientValue_InformationalDescription.zip String [] parts = fileName.split("_"); + if (parts.length < 2) { + logger.warning("Wrong name, ignored " + fileName); + return false; + } + logger.warning("Installing " + fileName + " ..."); String clientValue = parts[1]; - boolean allClients = clientValue.startsWith("ALL-CLIENTS"); int[] clientIDs;