Fix NullPointerException in POMAnalyzer
@@ -648,12 +648,14 @@ public class DataExtractor {
.selectSingleNode("./*[local-name()='artifactId']");
var exclusionGroupNode = exclusionNode
.selectSingleNode("./*[local-name()='groupId']");
+ if (exclusionArtifactNode != null && exclusionGroupNode != null) {
exclusions.add(new Dependency.Exclusion(
exclusionArtifactNode.getText(),
exclusionGroupNode.getText()
));
}
}
+ }
var scopeNode = dependencyNode
.selectSingleNode("./*[local-name()='scope']");
var optionalNode = dependencyNode
@@ -668,20 +670,21 @@ public class DataExtractor {
} else {
version = null;
}
+ if (groupNode != null && artifactNode != null) {
dependencies.add(new Dependency(
- artifactNode.getText(),
groupNode.getText(),
+ artifactNode.getText(),
version,
exclusions,
(scopeNode != null) ? scopeNode.getText() : "",
- (optionalNode != null) && Boolean.parseBoolean(
- optionalNode.getText()
- ),
+ (optionalNode != null)
+ && Boolean.parseBoolean(optionalNode.getText()),
(typeNode != null) ? typeNode.getText() : "",
(classifierNode != null) ? classifierNode.getText() : ""
));
}
}
+ }
return dependencies;
}
