From 602b393ba1ec041c0983b291a94e81902bbd059f Mon Sep 17 00:00:00 2001 From: Vitalij Berdinskih Date: Sat, 16 Nov 2024 20:37:56 +0200 Subject: [PATCH] licenseName is required (#607) * licenseName is required * Remove an unnecessary check --- .../org/codehaus/mojo/license/AbstractLicenseNameMojo.java | 5 +---- .../org/codehaus/mojo/license/model/LicenseRepository.java | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java index 433236bed..1813493cd 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java @@ -114,7 +114,7 @@ public abstract class AbstractLicenseNameMojo extends AbstractLicenseMojo { * @parameter property="license.licenseName" * @since 1.0 */ - @Parameter(property = "license.licenseName") + @Parameter(property = "license.licenseName", required = true) private String licenseName; /** @@ -227,9 +227,6 @@ protected void init() throws Exception { // ---------------------------------------------------------------------- protected License getLicense(String licenseName, boolean checkIfExists) { - if (StringUtils.isEmpty(licenseName)) { - throw new IllegalArgumentException("licenseName can not be null, nor empty"); - } if (licenseStore == null) { throw new IllegalStateException("No license store initialized!"); } diff --git a/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java b/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java index 234911e0e..6ad14b00c 100644 --- a/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java +++ b/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java @@ -165,9 +165,6 @@ public License[] getLicenses() { public License getLicense(String licenseName) { checkInit("getLicense"); - if (StringUtils.isEmpty(licenseName)) { - throw new IllegalArgumentException("licenceName can not be null, nor empty"); - } License license = null; for (License l : this) {