Skip to content

SPEL: Null-safeness of boolean operators [SPR-6059] #10727

@spring-projects-issues

Description

@spring-projects-issues

Oliver Becker opened SPR-6059 and commented

Boolean operators, e.g. OperatorNot, OpAnd, etc are not null-safe.

From OperatorNot:

boolean value = (Boolean)state.convertValue(children[0].getValueInternal(state), BOOLEAN_TYPE_DESCRIPTOR);

The value on the right side might be null, so the assignment to the primitive boolean value will cause a NullPointerException (auto unboxing).

I think it is better to prevent the NPE here and throw instead an EvaluationException in this case. This will help to locate the cause of the exception.


Affects: 3.0 M4

Referenced from: commits f4460dc, 53eb612

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions