IDEMPIERE-6017 Fix NPE in MoveClient when a column does not exist (#2218)

This commit is contained in:
Carlos Ruiz 2024-01-31 05:04:22 +01:00
parent 6b05bde8a9
commit 8422123487
2 changed files with 10 additions and 9 deletions

View File

@ -981,7 +981,7 @@ public class Login
at = "P|" + rs.getString(1); at = "P|" + rs.getString(1);
else else
at = "P" + AD_Window_ID + "|" + rs.getString(1); at = "P" + AD_Window_ID + "|" + rs.getString(1);
}else if ("P".equals(PreferenceFor)){ // preference for processs }else if ("P".equals(PreferenceFor)){ // preference for process
// when apply for all window or all process format is "P0|0|m_Attribute; // when apply for all window or all process format is "P0|0|m_Attribute;
at = "P" + AD_Window_ID + "|" + AD_InfoWindow_ID + "|" + AD_Process_ID + "|" + rs.getString(1); at = "P" + AD_Window_ID + "|" + AD_InfoWindow_ID + "|" + AD_Process_ID + "|" + rs.getString(1);
}else if ("I".equals(PreferenceFor)){ // preference for infoWindow }else if ("I".equals(PreferenceFor)){ // preference for infoWindow

View File

@ -441,6 +441,15 @@ public class MoveClient extends SvrProcess {
*/ */
private void validateExternalTable(String tableName) { private void validateExternalTable(String tableName) {
statusUpdate("Validating table " + tableName); statusUpdate("Validating table " + tableName);
// if table is not present in target
// inform blocking as it has client data
MTable localTable = MTable.get(getCtx(), tableName);
if (localTable == null || localTable.getAD_Table_ID() <= 0) {
p_errorList.add("Table " + tableName + " doesn't exist");
return;
}
// if table doesn't have client data (taking into account include/exclude) in the source DB // if table doesn't have client data (taking into account include/exclude) in the source DB
// add to the list of tables to ignore // add to the list of tables to ignore
// ignore and continue with next table // ignore and continue with next table
@ -471,14 +480,6 @@ public class MoveClient extends SvrProcess {
} }
} }
// if table is not present in target
// inform blocking as it has client data
MTable localTable = MTable.get(getCtx(), tableName);
if (localTable == null || localTable.getAD_Table_ID() <= 0) {
p_errorList.add("Table " + tableName + " doesn't exist");
return;
}
// for each source column // for each source column
final String sqlRemoteColumnsST = "" final String sqlRemoteColumnsST = ""
+ " SELECT AD_Column.ColumnName, AD_Column.AD_Reference_ID, AD_Column.FieldLength" + " SELECT AD_Column.ColumnName, AD_Column.AD_Reference_ID, AD_Column.FieldLength"