Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NPE in AccessTokenRequestParams#addExtraParameters method #1082

@NathalieGprog

Description

@NathalieGprog

The method throw NullPointerException each time that it call when the class variable extraParameters is null because the initialisation is done for the parameter variable and not for the class variable with the same name. The this. is missing.

    public AccessTokenRequestParams addExtraParameters(Map<String, String> extraParameters) {
        if (extraParameters == null || extraParameters.isEmpty()) {
            return this;
        }
        if (this.extraParameters == null) {
            extraParameters = new HashMap<>(); // Error
        }
        this.extraParameters.putAll(extraParameters);
        return this;
    }

It should be :

        if (this.extraParameters == null) {
            this.extraParameters = new HashMap<>();
        }

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