From c7fb5d62f84339a3f07a392ccebd756102f9a7cb Mon Sep 17 00:00:00 2001 From: Marko Milic Date: Tue, 12 Nov 2024 08:13:15 +0100 Subject: [PATCH] fix - add null checks for groupId, artifactId, and version attributes --- .../bs/importer/GradleBuildServerBuildSupport.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java index 3a71e56b0..c7bc9c71d 100644 --- a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java +++ b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java @@ -676,9 +676,16 @@ private List 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()),