Skip to content

Commit e6b952e

Browse files
sebtiemolamy
authored andcommitted
add null safety, more usable exception message
1 parent 84b2837 commit e6b952e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,9 +2882,10 @@ private List<CommandLineOption> commandLineOptions() {
28822882

28832883
private void warnIfDefunctGroupsCombinations() throws MojoFailureException, MojoExecutionException {
28842884
Artifact junitArtifact = getJunitArtifact();
2885-
if (!isWithinVersionSpec(junitArtifact, "[4.12,)")) {
2886-
throw new MojoFailureException(
2887-
"The used JUnit Version is not supported anymore. Please update to version 4.12+");
2885+
if (junitArtifact != null && !isWithinVersionSpec(junitArtifact, "[4.12,)")) {
2886+
throw new MojoFailureException(String.format(
2887+
"The used JUnit Version %s is not supported anymore. Please update to version 4.12+",
2888+
junitArtifact.getVersion()));
28882889
}
28892890
if (isAnyGroupsSelected()) {
28902891
if (getTestNgArtifact() == null) {

0 commit comments

Comments
 (0)