From 00daca9c948ebc726140ff34dd70bc495de48713 Mon Sep 17 00:00:00 2001 From: Fr Jeremy Krieg Date: Thu, 4 Aug 2022 18:35:32 +0930 Subject: [PATCH] IDEMPIERE-5366 Better error reporting on Pack In failure (#1422) [pipo] Throw useful exception when table not found With this commit, Pack In will throw an informative error message if it can't find a table (including the table name). Without this fix, you simply get an NPE which doesn't help with debugging. IDEMPIERE-5366 #resolve --- org.adempiere.pipo/src/org/adempiere/pipo2/POFinder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/POFinder.java b/org.adempiere.pipo/src/org/adempiere/pipo2/POFinder.java index 15153c4b5a..cdec49b919 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/POFinder.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/POFinder.java @@ -48,6 +48,9 @@ public class POFinder { if (AD_Client_ID==0) return uuid; MTable table = MTable.get(ctx, tableName); + if (table == null) { + throw new IllegalStateException("getTargetUUID couldn't find table named " + tableName); + } String sql = "SELECT Target_UUID FROM AD_Package_UUID_Map WHERE AD_Client_ID=? AND AD_Table_ID=? AND Source_UUID=?"; String uid = DB.getSQLValueString(trxName, sql, AD_Client_ID, table.getAD_Table_ID(), uuid); return Util.isEmpty(uid) ? uuid : uid;