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 — Potential NPE in AbstractAnalyzeMojo.filterArtifactsByScope() · Issue #1619 · apache/maven-dependency-plugin

Potential NPE in AbstractAnalyzeMojo.filterArtifactsByScope() #1619

New issue
Copy link
New issue
Copy link
Closed
#1622
Closed
Potential NPE in AbstractAnalyzeMojo.filterArtifactsByScope()#1619
#1622
Copy link
Labels
bugSomething isn't working

Description

@elharo
elharo
opened on May 17, 2026
Issue body actions

Problem

The filterArtifactsByScope() method at line 452 calls artifact.getScope().equals(scope) without checking if getScope() returns null:

private void filterArtifactsByScope(Set<Artifact> artifacts, String scope) {
    artifacts.removeIf(artifact -> artifact.getScope().equals(scope));
}

If artifact.getScope() returns null, this throws a NullPointerException.

Fix

Reverse the comparison or use Objects.equals():

artifacts.removeIf(artifact -> Objects.equals(artifact.getScope(), scope));

File

src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java:451-453

Activity

  1. elharo
    added
    bugSomething isn't working
    on May 17, 2026
  2. elharo
    closed this as completedin #1622on May 17, 2026
  3. slawekjaranowski
    marked Potential NPE in AbstractAnalyzeMojo.filterArtifactsByScope() #1615 as a duplicate of this issue on May 23, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — 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.