diff --git a/maven-plugin/src/main/java/hudson/maven/ModuleName.java b/maven-plugin/src/main/java/hudson/maven/ModuleName.java index bd03ef4596..801ef803f8 100644 --- a/maven-plugin/src/main/java/hudson/maven/ModuleName.java +++ b/maven-plugin/src/main/java/hudson/maven/ModuleName.java @@ -31,6 +31,7 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.ReportPlugin; import java.io.Serializable; +import javax.annotation.Nonnull; /** * Version independent name of a Maven project. GroupID+artifactId. @@ -39,10 +40,16 @@ import java.io.Serializable; * @see ModuleDependency */ public class ModuleName implements Comparable, Serializable { - public final String groupId; - public final String artifactId; + public final @Nonnull String groupId; + public final @Nonnull String artifactId; public ModuleName(String groupId, String artifactId) { + if (groupId == null) { + throw new NullPointerException("Must specify groupId"); + } + if (artifactId == null) { + throw new NullPointerException("Must specify artifactId"); + } this.groupId = groupId; this.artifactId = artifactId; } diff --git a/maven-plugin/src/main/java/hudson/maven/PomInfo.java b/maven-plugin/src/main/java/hudson/maven/PomInfo.java index 531f3093e2..a65240acea 100644 --- a/maven-plugin/src/main/java/hudson/maven/PomInfo.java +++ b/maven-plugin/src/main/java/hudson/maven/PomInfo.java @@ -37,6 +37,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.ArrayList; +import javax.annotation.Nonnull; /** * Serializable representation of the key information obtained from Maven POM. @@ -51,7 +52,7 @@ final class PomInfo implements Serializable { public static final String PACKAGING_TYPE_PLUGIN = "maven-plugin"; - public final ModuleName name; + public final @Nonnull ModuleName name; /** * This is a human readable name of the POM. Not necessarily unique