From 4c176e2a3fb3ee4fb7f9ca31fad1208244695dfa Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 26 Feb 2024 19:36:20 +0100 Subject: [PATCH] Flip equals to prevent NPE for nullable plugin.groupId --- .../openrewrite/maven/RemoveRedundantDependencyVersions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/RemoveRedundantDependencyVersions.java b/rewrite-maven/src/main/java/org/openrewrite/maven/RemoveRedundantDependencyVersions.java index 7e9c1a447f8..615bd042977 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/RemoveRedundantDependencyVersions.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/RemoveRedundantDependencyVersions.java @@ -173,9 +173,9 @@ && matchesGlob(d.getArtifactId(), exceptedArtifactId)) { } @Nullable - private static String getManagedPluginVersion(ResolvedPom resolvedPom, String groupId, String artifactId) { + private static String getManagedPluginVersion(ResolvedPom resolvedPom, @Nullable String groupId, String artifactId) { for (Plugin p : resolvedPom.getPluginManagement()) { - if (groupId.equals(p.getGroupId()) && artifactId.equals(p.getArtifactId())) { + if (p.getGroupId().equals(groupId) && p.getArtifactId().equals(artifactId)) { return resolvedPom.getValue(p.getVersion()); } }