GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — NPE in AccessTokenRequestParams#addExtraParameters method · Issue #1082 · scribejava/scribejava

NPE in AccessTokenRequestParams#addExtraParameters method #1082

New issue
Copy link
New issue
Copy link
Open
Open
NPE in AccessTokenRequestParams#addExtraParameters method#1082
Copy link

Description

@NathalieGprog
NathalieGprog
opened on Apr 18, 2025
Issue body actions

scribejava/scribejava-core/src/main/java/com/github/scribejava/core/oauth/AccessTokenRequestParams.java

Line 45 in 8970e8e

extraParameters = new HashMap<>();

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<>();
        }

Activity

  1. king-407 commented on Jun 16, 2026

    @king-407
    king-407
    on Jun 16, 2026
    More actions

    Hi, I would like to work on this issue.

    From what I understand, AccessTokenRequestParams#addExtraParameters initializes the method parameter instead of the this.extraParameters field when the field is null. Because of that, the following this.extraParameters.putAll(...) call can throw a NullPointerException.

    I can add a focused regression test for this case and then fix the initialization to assign this.extraParameters = new HashMap<>().

    Would a contribution in this direction be welcome?

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

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.