flowable / flowable/flowable-engine

EndEventParseHandler not setting correct error code for ErrorEndEventActivityBehavior

Aperta
#2,841 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
9.5k
Fork
2.9k
Merge medio
7h 8m
PR unite (30g)
2

Descrizione

**Describe the bug**
Error end events use the `errorRef` attribute as the error code, but they should be using the error code of the *error* pointed by the ref. What happens in the [EndEventParserHandler.executeParse](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/parser/handler/EndEventParseHandler.java#L48-L58) method class at (snip):

```java
ErrorEventDefinition errorDefinition = (ErrorEventDefinition) eventDefinition;
if (bpmnParse.getBpmnModel().containsErrorRef(errorDefinition.getErrorCode())) {
String errorCode = bpmnParse.getBpmnModel().getErrors().get(errorDefinition.getErrorCode());
if (StringUtils.isEmpty(errorCode)) {
LOGGER.warn("errorCode is required for an error event {}", endEvent.getId());
}
}
endEvent.setBehavior(bpmnParse.getActivityBehaviorFactory().createErrorEndEventActivityBehavior(endEvent, errorDefinition));
```

Is that the errorCode from the model's error map is not given to the assigned errorDefinition activity. So, `String errorCode` does contain the right error code, but it's not set to the ErrorEndEventActivity.

The behaviour seems to be a regression in Flowable 6. If we look at the code from [flowable5](https://github.com/flowable/flowable-engine/blob/master/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/EndEventParseHandler.java#L51-L60):

```java
org.flowable.bpmn.model.ErrorEventDefinition errorDefinition = (org.flowable.bpmn.model.ErrorEventDefinition) eventDefinition;
if (bpmnParse.getBpmnModel().containsErrorRef(errorDefinition.getErrorCode())) {
String errorCode = bpmnParse.getBpmnModel().getErrors().get(errorDefinition.getErrorCode());
if (StringUtils.isEmpty(errorCode)) {
LOGGER.warn("errorCode is required for an error event {}", endEvent.getId());
}
endEventActivity.setProperty("type", "errorEndEvent");
errorDefinition.setErrorCode(errorCode);
}
endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createErrorEndEventActivityBehavior(endEvent, errorDefinition));
```

On line 58 we see the errorCode being set to the errorDefinition. If we compare the code between escalation and error events, the behaviour in both was to assign the correct code to the created ActivityBehavior class.

**Expected behavior**
The error code of the created ErrorEndEvent should be the error code of the error pointed by the error definition referenced by the `errorRef` attribute, not the value of the `errorRef` itself.

**Additional context**
flowable-engine 6.6.0

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia da modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/parser/handler/EndEventParseHandler.java, concentrandoti su executeParse e sul relativo ramo ErrorEventDefinition. Confrontalo con il comportamento di flowable5 EndEventParseHandler mostrato nell’issue. Il lavoro è completato quando ErrorEndEventActivityBehavior riceve il codice di errore risolto dalla mappa degli errori del modello invece del valore di errorRef.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
backend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.