diff --git a/src/main/java/io/zeebe/monitor/rest/ProcessesViewController.java b/src/main/java/io/zeebe/monitor/rest/ProcessesViewController.java index 26898062..fef1d8e9 100644 --- a/src/main/java/io/zeebe/monitor/rest/ProcessesViewController.java +++ b/src/main/java/io/zeebe/monitor/rest/ProcessesViewController.java @@ -27,6 +27,7 @@ import io.zeebe.monitor.rest.dto.ProcessDto; import io.zeebe.monitor.rest.dto.ProcessInstanceListDto; import io.zeebe.monitor.rest.dto.TimerDto; +import jakarta.transaction.Transactional; import java.io.ByteArrayInputStream; import java.time.Instant; import java.util.ArrayList; @@ -34,7 +35,6 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import jakarta.transaction.Transactional; import org.camunda.bpm.model.xml.instance.ModelElementInstance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; @@ -221,8 +221,7 @@ private List getElementInstanceStates(final long key) { Collectors.toMap( ElementInstanceStatistics::getElementId, ElementInstanceStatistics::getCount)); - final List elementInstanceStates = - elementEnteredStatistics.stream() + return elementEnteredStatistics.stream() .map( s -> { final ElementInstanceState state = new ElementInstanceState(); @@ -239,7 +238,6 @@ private List getElementInstanceStates(final long key) { return state; }) .collect(Collectors.toList()); - return elementInstanceStates; } static List getBpmnElementInfos(final BpmnModelInstance bpmn) { @@ -282,16 +280,16 @@ static List getBpmnElementInfos(final BpmnModelInstance bpmn) { .getEventDefinitions() .forEach( eventDefinition -> { - if (eventDefinition instanceof ErrorEventDefinition) { - final var errorEventDefinition = (ErrorEventDefinition) eventDefinition; - final var errorCode = errorEventDefinition.getError().getErrorCode(); - - info.setInfo("errorCode: " + errorCode); + if (eventDefinition instanceof ErrorEventDefinition errorEventDefinition) { + if (errorEventDefinition.getError() != null) { + info.setInfo("errorCode: " + errorEventDefinition.getError().getErrorCode()); + } else { + info.setInfo("errorCode: "); + } infos.add(info); } - if (eventDefinition instanceof TimerEventDefinition) { - final var timerEventDefinition = (TimerEventDefinition) eventDefinition; + if (eventDefinition instanceof TimerEventDefinition timerEventDefinition) { Optional.ofNullable( timerEventDefinition.getTimeCycle())