Make sure to always return an empty list rather than a null

This commit is contained in:
2023-12-28 10:32:47 -06:00
parent 345d8022c1
commit 2da6878e70
2 changed files with 18 additions and 0 deletions

View File

@ -132,6 +132,15 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
//////////////////////////////////// ////////////////////////////////////
InsertOutput insertOutput = insertInterface.execute(insertInput); InsertOutput insertOutput = insertInterface.execute(insertInput);
if(insertOutput.getRecords() == null)
{
////////////////////////////////////////////////////////////////////////////////////
// in case the module failed to set record in the output, put an empty list there //
// to avoid so many downstream NPE's //
////////////////////////////////////////////////////////////////////////////////////
insertOutput.setRecords(new ArrayList<>());
}
////////////////////////////// //////////////////////////////
// log if there were errors // // log if there were errors //
////////////////////////////// //////////////////////////////

View File

@ -137,6 +137,15 @@ public class UpdateAction
//////////////////////////////////// ////////////////////////////////////
UpdateOutput updateOutput = updateInterface.execute(updateInput); UpdateOutput updateOutput = updateInterface.execute(updateInput);
if(updateOutput.getRecords() == null)
{
////////////////////////////////////////////////////////////////////////////////////
// in case the module failed to set record in the output, put an empty list there //
// to avoid so many downstream NPE's //
////////////////////////////////////////////////////////////////////////////////////
updateOutput.setRecords(new ArrayList<>());
}
////////////////////////////// //////////////////////////////
// log if there were errors // // log if there were errors //
////////////////////////////// //////////////////////////////