Skip to content

Commit

Permalink
fix - add null checks for groupId, artifactId, and version attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Milic committed Nov 12, 2024
1 parent 1c66653 commit c7fb5d6
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,16 @@ private List<IClasspathEntry> getDependencyJars(DependencyModulesResult dependen
attributes.add(optionalAttribute);
}
attributes.add(buildServerAttribute);
attributes.add(JavaCore.newClasspathAttribute("groupId", mavenDependencyModule.getOrganization()));
attributes.add(JavaCore.newClasspathAttribute("artifactId", mavenDependencyModule.getName()));
attributes.add(JavaCore.newClasspathAttribute("version", mavenDependencyModule.getVersion()));

String groupId = mavenDependencyModule.getOrganization();
String artifactId = mavenDependencyModule.getName();
String version = mavenDependencyModule.getVersion();
if (StringUtils.isNotBlank(groupId) && StringUtils.isNotBlank(artifactId)
&& StringUtils.isNotBlank(version)) {
attributes.add(JavaCore.newClasspathAttribute("groupId", groupId));
attributes.add(JavaCore.newClasspathAttribute("artifactId", artifactId));
attributes.add(JavaCore.newClasspathAttribute("version", version));
}

dependencyEntries.add(JavaCore.newLibraryEntry(
new Path(artifact.getAbsolutePath()),
Expand Down

0 comments on commit c7fb5d6

Please sign in to comment.