Skip to content

LenientMode not respected when accessing structure fields #555

@AranyaniSharma

Description

@AranyaniSharma

Description

The lenientMode configuration option is not properly respected when accessing structure fields in expressions. When lenientMode(true) is configured, accessing a missing field in a structure or accessing a property on NULL_VALUE still throws an EvaluationException instead of gracefully returning NULL_VALUE.

Environment

  • EvalEx Version: 3.6.0

Expected Behavior

When lenientMode is enabled:

  • Accessing a missing field in a structure should return NULL_VALUE instead of throwing an exception
  • Accessing a property on NULL_VALUE should return NULL_VALUE instead of throwing an exception

Actual Behavior

The evaluateStructureSeparator() method in Expression.java always throws exceptions for:

  1. Missing fields: Field 'xyz' not found in structure
  2. Property access on null: Unsupported data types in operation

Even when configuration.isLenientMode() returns true.

Example Code to Reproduce

ExpressionConfiguration config = ExpressionConfiguration.builder()
.lenientMode(true)
.build();

Map<String, Object> data = new HashMap<>();

Expression expression = new Expression("user.name", config);
EvaluationValue result = expression.evaluate(); // Throws exception instead of returning NULL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions