Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access suppressed failures of an EvaluationResult from Java #726

Open
saig0 opened this issue Sep 20, 2023 · 1 comment
Open

Can't access suppressed failures of an EvaluationResult from Java #726

saig0 opened this issue Sep 20, 2023 · 1 comment

Comments

@saig0
Copy link
Member

saig0 commented Sep 20, 2023

Describe the bug
From a Java application, I can't access the suppressed failures of an EvaluationResult smoothly. The result returns the failures as a Scala list that is not easy to consume from Java code. See here

To Reproduce
Steps to reproduce the behavior:

  1. From Java code, access the suppressed failures of an EvaluationResult.
final java.util.List<EvaluationFailure> failures = result.suppressedFailures();
  1. Verify that the code snipped doesn't compile because it returns a Scala list

Expected behavior
From Java code, I can't access the list of evaluation failures natively (i.e. without any type transformation).

Related to #539.

Environment

  • FEEL engine version: 1.17.0
  • Affects:
    • Camunda Automation Platform 7: [7.x]
    • Zeebe broker: [0.x]
@saig0
Copy link
Member Author

saig0 commented Sep 20, 2023

Workaround

In my Java code, I use the following snippet to collect the suppressed failures:

private static List<FeelEvaluationWarning> collectEvaluationWarnings(EvaluationResult result) {
    final var warnings = new ArrayList<FeelEvaluationWarning>();
    result
        .suppressedFailures()
        .foreach(
            failure -> {
              final var warning =
                  FeelEvaluationWarning.of(
                      failure.failureType().toString(), failure.failureMessage());
              warnings.add(warning);
              return null;
            });
    return warnings;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant