Skip to content

Improve readability and simplify null check in ProviderManager.checkState() #19510

Description

@wsdf25867

Expected Behavior
In ProviderManager.checkState(), this.providers should be checked for null elements using modern Spring Framework utilities that offer clear intent and good readability without unnecessary iterator creation.

Current Behavior
Currently, the null check uses Assert.isTrue with a negated CollectionUtils.contains condition:

Assert.isTrue(!CollectionUtils.contains(this.providers.iterator(), null),
      "providers list cannot contain null values");

Context
Since Spring Framework 5.2, Assert.noNullElements(Collection, String) directly supports collections.

Refactoring this line to:

Assert.noNullElements(this.providers,
      "providers list cannot contain null values");

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions