Source:
private void tryUpgradeTask () { final StartupAPI startupAPI = APILocator.getStartupAPI(); final List<Class<?>> alwaysTaskClasses = startupAPI.getStartupRunAlwaysTaskClasses(); final List<Class<?>> onceTaskClasses = startupAPI.getStartupRunOnceTaskClasses(); Logger.info(this, ()->"Running the always upgrade tasks"); for (final Class<?> alwaysTaskClass : alwaysTaskClasses) { try { Logger.info(this, ()->"Running the upgrade task: " + alwaysTaskClass.getCanonicalName()); startupAPI.runStartup(alwaysTaskClass); } catch (DotDataException e) { Logger.info(this, ()->"Error on running the upgrade task: " + alwaysTaskClass.getCanonicalName() + ", msg: " + e.getMessage()); if (Config.getBooleanProperty("dotcms.integrationtest.run.upgradetask.stoponerror", true)) { fail(e.getMessage()); } } } Logger.info(this, ()->"Ran the always upgrade tasks"); Logger.info(this, ()->"Running the once upgrade tasks"); for (final Class<?> onceTaskClass : onceTaskClasses) { try { Logger.info(this, ()->"Running the upgrade task: " + onceTaskClass.getCanonicalName()); startupAPI.runStartup(onceTaskClass); Logger.info(this, ()->"Ran the upgrade task: " + onceTaskClass.getCanonicalName()); } catch (Exception e) { Logger.info(this, ()->"Error on running the upgrade task: " + onceTaskClass.getCanonicalName() + ", msg: " + e.getMessage()); if (Config.getBooleanProperty("dotcms.integrationtest.run.upgradetask.stoponerror", true)) { fail(e.getMessage()); } } } Logger.info(this, ()->"Ran the once upgrade tasks"); }

Target:
private void tryUpgradeTask () { final StartupAPI startupAPI = APILocator.getStartupAPI(); final List<Class<?>> alwaysTaskClasses = startupAPI.getStartupRunAlwaysTaskClasses(); final List<Class<?>> onceTaskClasses = startupAPI.getStartupRunOnceTaskClassesUnsorted(); Logger.info(this, ()->"Running the always upgrade tasks"); for (final Class<?> alwaysTaskClass : alwaysTaskClasses) { try { Logger.info(this, ()->"Running the upgrade task: " + alwaysTaskClass.getCanonicalName()); startupAPI.runStartup(alwaysTaskClass); } catch (DotDataException e) { Logger.info(this, ()->"Error on running the upgrade task: " + alwaysTaskClass.getCanonicalName() + ", msg: " + e.getMessage()); if (Config.getBooleanProperty("dotcms.integrationtest.run.upgradetask.stoponerror", true)) { fail(e.getMessage()); } } } Logger.info(this, ()->"Ran the run-always upgrade tasks"); Logger.info(this, ()->"Running the run-once upgrade tasks"); boolean is257UpgradeTask = false; for (final Class<?> onceTaskClass : onceTaskClasses) { try { if (!is257UpgradeTask && onceTaskClass.equals(Task03005CreateModDateForFieldIfNeeded.class)) { is257UpgradeTask = true; } if (is257UpgradeTask) { Logger.info(this, () -> "Running the upgrade task: " + onceTaskClass.getCanonicalName()); startupAPI.runStartup(onceTaskClass); Logger.info(this, () -> "Ran the upgrade task: " + onceTaskClass.getCanonicalName()); } } catch (Exception e) { Logger.info(this, ()->"Error on running the upgrade task: " + onceTaskClass.getCanonicalName() + ", msg: " + e.getMessage()); if (Config.getBooleanProperty("dotcms.integrationtest.run.upgradetask.stoponerror", true)) { fail(onceTaskClass + ": " + e.getMessage()); } } } Logger.info(this, ()->"Ran the run-once upgrade tasks"); }