-
Bug Report
-
Resolution: Fixed
-
L3 - Default
-
None
-
None
In our Spring Application, when creating the ProcessEngineConfiguration, we are setting the HistoryLevel to Activity. Looks like this:
@Bean public SpringProcessEngineConfiguration processEngineConfiguration() { ... final SpringProcessEngineConfiguration pec = new SpringProcessEngineConfiguration(); ... pec.setHistoryLevel(HistoryLevel.HISTORY_LEVEL_ACTIVITY); ... return pec; }
When we start our application, we're getting this NPE:
Caused by: java.lang.NullPointerException at org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd.execute(DetermineHistoryLevelCmd.java:30) at org.camunda.bpm.engine.impl.SchemaOperationsProcessEngineBuild.checkHistoryLevel(SchemaOperationsProcessEngineBuild.java:97)
It happens here in DetermineHistoricLevelCmd.java when the loop accesses the historyLevels variable:
if (databaseHistoryLevel != null) { for (final HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == databaseHistoryLevel) { result = historyLevel; break; } }
We think this happens because of this code in ProcessEngineConfigurationImpl.java :
public void initHistoryLevel() { if(historyLevel == null) { if(historyLevels == null) { historyLevels = new ArrayList<HistoryLevel>(); historyLevels.add(HistoryLevel.HISTORY_LEVEL_NONE); historyLevels.add(HistoryLevel.HISTORY_LEVEL_ACTIVITY); historyLevels.add(HistoryLevel.HISTORY_LEVEL_AUDIT); historyLevels.add(HistoryLevel.HISTORY_LEVEL_FULL); }
historyLevels is only ever initialized when historyLevel is null - but in our case, historyLevel is already set to Activity, so historyLevels stays null, which causes the NPE. This happens since 7.4.