Skip to content

Commit

Permalink
TE-582: improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnchuong committed May 23, 2024
1 parent 946e3e8 commit 9aa3002
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ private List<Process> getAllProcesses() {
return processes;
}

private boolean isAcceptedProcess(List<String> folders, String fullQualifiedName) {
return folders.stream().anyMatch(folder -> fullQualifiedName.contains(folder));
}

private static List<BaseElement> getElementOfProcess(Process process) {
var processElements = process.getProcessElements();
var childElments = getElementOfProcesses(processElements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void shouldThrowExceptionWhenFindTasksOnPathAtStartWithFlowNameNull() {
processAnalyzer.findTasksOnPath(start, null, null);
});

String expectedMessage = "Not found path";
String expectedMessage = "Not found path after element 18DD16F8AA39F5DE-f7";
String actualMessage = exception.getMessage();

assertEquals(expectedMessage, actualMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.SetUtils;
import org.apache.commons.lang3.StringUtils;

import com.axonivy.utils.process.analyzer.internal.model.AnalysisPath;
import com.axonivy.utils.process.analyzer.internal.model.CommonElement;
Expand Down Expand Up @@ -369,7 +372,7 @@ private List<AnalysisPath> findAnalysisPaths(ProcessElement from, String flowNam
List<SequenceFlow> outs = getSequenceFlows((NodeElement) from.getElement(), flowName, findType);
if (from.getElement() instanceof Alternative && outs.isEmpty()) {
Ivy.log().error("Can not found the out going from a alternative {0}", from.getPid().getRawPid());
throw new Exception("Not found path");
throw new Exception("Not found path after element " + getAlternativeNameId(from.getElement()));
}

Map<SequenceFlow, List<AnalysisPath>> pathOptions = new LinkedHashMap<>();
Expand All @@ -387,6 +390,11 @@ private List<AnalysisPath> findAnalysisPaths(ProcessElement from, String flowNam
return path;
}

private String getAlternativeNameId(BaseElement alternative) {
return Stream.of(alternative.getName(), alternative.getPid().getRawPid()).filter(StringUtils::isNotEmpty)
.collect(Collectors.joining("-"));
}

private List<AnalysisPath> removeLastTaskSwitchGateway(List<AnalysisPath> paths) {
List<AnalysisPath> result = new ArrayList<>();
for (AnalysisPath path : paths) {
Expand Down

0 comments on commit 9aa3002

Please sign in to comment.