From 4b9eb8361ce6352c1e155c99748fd1f97df76c0c Mon Sep 17 00:00:00 2001 From: Pierre Villard Date: Fri, 22 Sep 2023 16:14:31 +0200 Subject: [PATCH] NIFI-12113 Replaced Validate.notNull() with Objects.requireNonNull() This closes #7779 Signed-off-by: David Handermann --- .../nifi/security/krb/KerberosAction.java | 11 ++++------ .../util/listen/event/EventQueue.java | 9 ++++----- .../org/apache/nifi/hadoop/SecurityUtil.java | 11 +++++----- .../request/ProxiedEntityRequestConfig.java | 4 ++-- .../nifi/registry/event/StandardEvent.java | 4 +--- .../registry/event/StandardEventField.java | 7 ++----- .../StandardBundlePersistenceContext.java | 5 +++-- .../authorization/AuthorizerFactory.java | 12 +++++------ .../DatabaseAccessPolicyProvider.java | 9 +++++---- .../database/DatabaseUserGroupProvider.java | 13 ++++++------ .../registry/service/RegistryService.java | 14 ++++++------- .../extension/StandardExtensionService.java | 20 +++++++------------ .../registry/web/api/ApplicationResource.java | 8 +++----- .../toolkit/cli/api/ResolvedReference.java | 12 +++++------ .../cli/impl/client/NiFiClientFactory.java | 4 ++-- .../request/ProxiedEntityRequestConfig.java | 4 ++-- .../cli/impl/command/AbstractCommand.java | 16 +++++---------- .../impl/command/AbstractCommandGroup.java | 3 ++- .../cli/impl/command/CommandProcessor.java | 14 +++++-------- .../nifi/params/ExportParamContext.java | 5 ++--- .../cli/impl/context/StandardContext.java | 15 +++++--------- .../impl/result/AbstractWritableResult.java | 5 ++--- .../toolkit/cli/impl/result/StringResult.java | 5 ++--- .../impl/result/nifi/AccessPolicyResult.java | 5 ++--- .../nifi/ClusterSummaryEntityResult.java | 5 ++--- .../nifi/ControllerConfigurationResult.java | 5 ++--- .../result/nifi/ControllerServiceResult.java | 5 ++--- .../result/nifi/ControllerServicesResult.java | 5 ++--- .../result/nifi/CurrentUserEntityResult.java | 5 ++--- .../impl/result/nifi/CurrentUserResult.java | 5 ++--- .../cli/impl/result/nifi/NodeResult.java | 5 ++--- .../cli/impl/result/nifi/NodesResult.java | 5 ++--- .../impl/result/nifi/ParamContextsResult.java | 4 ++-- .../impl/result/nifi/ProcessGroupResult.java | 5 ++--- .../impl/result/nifi/ProcessGroupsResult.java | 5 ++--- .../cli/impl/result/nifi/ProcessorResult.java | 5 ++--- .../impl/result/nifi/ProcessorsResult.java | 5 ++--- .../result/nifi/RegistryClientIDResult.java | 5 ++--- .../result/nifi/RegistryClientsResult.java | 5 ++--- .../impl/result/nifi/ReportingTaskResult.java | 5 ++--- .../result/nifi/ReportingTasksResult.java | 5 ++--- .../impl/result/nifi/UserGroupsResult.java | 5 ++--- .../cli/impl/result/nifi/UsersResult.java | 5 ++--- .../result/nifi/VariableRegistryResult.java | 5 ++--- .../result/nifi/VersionControlInfoResult.java | 5 ++--- .../result/registry/AccessPolicyResult.java | 5 ++--- .../impl/result/registry/BucketsResult.java | 5 ++--- .../registry/ExtensionMetadataResult.java | 5 ++--- .../ExtensionRepoArtifactsResult.java | 5 ++--- .../registry/ExtensionRepoGroupsResult.java | 5 ++--- .../ExtensionRepoVersionSummariesResult.java | 5 ++--- .../RegisteredFlowSnapshotMetadataResult.java | 5 ++--- .../impl/result/registry/TagCountResult.java | 5 ++--- .../result/registry/UserGroupsResult.java | 5 ++--- .../cli/impl/result/registry/UsersResult.java | 5 ++--- .../VersionedFlowDifferenceResult.java | 4 ++-- ...ersionedFlowSnapshotMetadataSetResult.java | 5 ++--- .../registry/VersionedFlowSnapshotResult.java | 5 ++--- .../VersionedFlowSnapshotsResult.java | 5 ++--- .../result/registry/VersionedFlowsResult.java | 5 ++--- .../cli/impl/session/PersistentSession.java | 8 +++----- 61 files changed, 166 insertions(+), 235 deletions(-) diff --git a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/KerberosAction.java b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/KerberosAction.java index ee1bfbf321..62938647ce 100644 --- a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/KerberosAction.java +++ b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/KerberosAction.java @@ -16,12 +16,12 @@ */ package org.apache.nifi.security.krb; -import org.apache.commons.lang3.Validate; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.exception.ProcessException; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Objects; /** * Helper class for processors to perform an action as a KerberosUser. @@ -43,13 +43,10 @@ public class KerberosAction { final PrivilegedExceptionAction action, final ComponentLog logger, final ClassLoader contextClassLoader) { - this.kerberosUser = kerberosUser; - this.action = action; - this.logger = logger; + this.kerberosUser = Objects.requireNonNull(kerberosUser); + this.action = Objects.requireNonNull(action); + this.logger = Objects.requireNonNull(logger); this.contextClassLoader = contextClassLoader; - Validate.notNull(this.kerberosUser); - Validate.notNull(this.action); - Validate.notNull(this.logger); } public T execute() { diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/EventQueue.java b/nifi-nar-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/EventQueue.java index 35e9ae0a12..df0161cf67 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/EventQueue.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/EventQueue.java @@ -16,8 +16,9 @@ */ package org.apache.nifi.processor.util.listen.event; -import org.apache.commons.lang3.Validate; import org.apache.nifi.logging.ComponentLog; + +import java.util.Objects; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; @@ -42,11 +43,9 @@ public class EventQueue { } public EventQueue(final BlockingQueue events, final long offerWaitMs, final ComponentLog logger) { - this.events = events; + this.events = Objects.requireNonNull(events); this.offerWaitMs = offerWaitMs; - this.logger = logger; - Validate.notNull(this.events); - Validate.notNull(this.logger); + this.logger = Objects.requireNonNull(logger); } /** diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java index 0a9c0236ce..d3340dad76 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java @@ -30,6 +30,7 @@ import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Objects; import java.util.Random; import java.util.stream.Collectors; @@ -70,9 +71,9 @@ public class SecurityUtil { */ public static synchronized UserGroupInformation loginKerberos(final Configuration config, final String principal, final String keyTab) throws IOException { - Validate.notNull(config); - Validate.notNull(principal); - Validate.notNull(keyTab); + Objects.requireNonNull(config); + Objects.requireNonNull(principal); + Objects.requireNonNull(keyTab); UserGroupInformation.setConfiguration(config); UserGroupInformation.loginUserFromKeytab(principal.trim(), keyTab.trim()); @@ -128,7 +129,7 @@ public class SecurityUtil { * @throws IOException if login failed */ public static synchronized UserGroupInformation loginSimple(final Configuration config) throws IOException { - Validate.notNull(config); + Objects.requireNonNull(config); UserGroupInformation.setConfiguration(config); return UserGroupInformation.getLoginUser(); } @@ -144,7 +145,7 @@ public class SecurityUtil { * */ public static boolean isSecurityEnabled(final Configuration config) { - Validate.notNull(config); + Objects.requireNonNull(config); return KERBEROS.equalsIgnoreCase(config.get(HADOOP_SECURITY_AUTHENTICATION)); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-client/src/main/java/org/apache/nifi/registry/client/impl/request/ProxiedEntityRequestConfig.java b/nifi-registry/nifi-registry-core/nifi-registry-client/src/main/java/org/apache/nifi/registry/client/impl/request/ProxiedEntityRequestConfig.java index 08da6b4acc..c3b727d9a7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-client/src/main/java/org/apache/nifi/registry/client/impl/request/ProxiedEntityRequestConfig.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-client/src/main/java/org/apache/nifi/registry/client/impl/request/ProxiedEntityRequestConfig.java @@ -16,12 +16,12 @@ */ package org.apache.nifi.registry.client.impl.request; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.client.RequestConfig; import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** * Implementation of RequestConfig that produces headers for a request with proxied-entities. @@ -31,7 +31,7 @@ public class ProxiedEntityRequestConfig implements RequestConfig { private final String proxiedEntitiesChain; public ProxiedEntityRequestConfig(final String... proxiedEntities) { - Validate.notNull(proxiedEntities); + Objects.requireNonNull(proxiedEntities); this.proxiedEntitiesChain = ProxiedEntitiesUtils.getProxiedEntitiesChain(proxiedEntities); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java index 26ca93c606..ec428a6ea4 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.registry.event; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.hook.Event; import org.apache.nifi.registry.hook.EventField; import org.apache.nifi.registry.hook.EventFieldName; @@ -38,10 +37,9 @@ public class StandardEvent implements Event { private final List eventFields; private StandardEvent(final Builder builder) { - this.eventType = builder.eventType; + this.eventType = Objects.requireNonNull(builder.eventType); this.eventFields = Collections.unmodifiableList(builder.eventFields == null ? Collections.emptyList() : new ArrayList<>(builder.eventFields)); - Validate.notNull(this.eventType); } @Override diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEventField.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEventField.java index 978d6fe116..b6cc6c0747 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEventField.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEventField.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.registry.event; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.hook.EventField; import org.apache.nifi.registry.hook.EventFieldName; @@ -32,10 +31,8 @@ public class StandardEventField implements EventField { private final String value; public StandardEventField(final EventFieldName name, final String value) { - this.name = name; - this.value = value; - Validate.notNull(this.name); - Validate.notNull(this.value); + this.name = Objects.requireNonNull(name); + this.value = Objects.requireNonNull(value); } @Override diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/StandardBundlePersistenceContext.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/StandardBundlePersistenceContext.java index 249be1918e..e7f05c9102 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/StandardBundlePersistenceContext.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/StandardBundlePersistenceContext.java @@ -16,6 +16,8 @@ */ package org.apache.nifi.registry.provider.extension; +import java.util.Objects; + import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.extension.BundlePersistenceContext; import org.apache.nifi.registry.extension.BundleVersionCoordinate; @@ -28,11 +30,10 @@ public class StandardBundlePersistenceContext implements BundlePersistenceContex private final long bundleSize; private StandardBundlePersistenceContext(final Builder builder) { - this.coordinate = builder.coordinate; + this.coordinate = Objects.requireNonNull(builder.coordinate); this.bundleSize = builder.bundleSize; this.author = builder.author; this.timestamp = builder.timestamp; - Validate.notNull(this.coordinate); Validate.notBlank(this.author); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java index 90a3f0b5a8..dbd594aff0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java @@ -17,7 +17,6 @@ package org.apache.nifi.registry.security.authorization; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.properties.SensitivePropertyProtectionException; import org.apache.nifi.properties.SensitivePropertyProvider; import org.apache.nifi.properties.SensitivePropertyProviderFactory; @@ -71,6 +70,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -125,12 +125,12 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP final DataSource dataSource, final IdentityMapper identityMapper) { - this.properties = Validate.notNull(properties); - this.extensionManager = Validate.notNull(extensionManager); + this.properties = Objects.requireNonNull(properties); + this.extensionManager = Objects.requireNonNull(extensionManager); this.sensitivePropertyProviderFactory = sensitivePropertyProviderFactory; - this.registryService = Validate.notNull(registryService); - this.dataSource = Validate.notNull(dataSource); - this.identityMapper = Validate.notNull(identityMapper); + this.registryService = Objects.requireNonNull(registryService); + this.dataSource = Objects.requireNonNull(dataSource); + this.identityMapper = Objects.requireNonNull(identityMapper); } /***** UserGroupProviderLookup *****/ diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java index c5d82bdff0..c39599f194 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java @@ -48,6 +48,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -158,7 +159,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli @Override public AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { - Validate.notNull(accessPolicy); + Objects.requireNonNull(accessPolicy); // insert to the policy table final String policySql = "INSERT INTO APP_POLICY(IDENTIFIER, RESOURCE, ACTION) VALUES (?, ?, ?)"; @@ -172,7 +173,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli @Override public AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { - Validate.notNull(accessPolicy); + Objects.requireNonNull(accessPolicy); // determine if policy exists final DatabaseAccessPolicy existingPolicy = getDatabaseAcessPolicy(accessPolicy.getIdentifier()); @@ -250,7 +251,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli @Override public AccessPolicy getAccessPolicy(final String resourceIdentifier, RequestAction action) throws AuthorizationAccessException { Validate.notBlank(resourceIdentifier); - Validate.notNull(action); + Objects.requireNonNull(action); final String policySql = "SELECT * FROM APP_POLICY WHERE RESOURCE = ? AND ACTION = ?"; final Object[] args = new Object[]{resourceIdentifier, action.toString()}; @@ -266,7 +267,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli @Override public AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { - Validate.notNull(accessPolicy); + Objects.requireNonNull(accessPolicy); final String sql = "DELETE FROM APP_POLICY WHERE IDENTIFIER = ?"; final int rowsUpdated = jdbcTemplate.update(sql, accessPolicy.getIdentifier()); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseUserGroupProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseUserGroupProvider.java index 03f8ed2fa5..d8322afa1c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseUserGroupProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseUserGroupProvider.java @@ -46,6 +46,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -120,7 +121,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public User addUser(final User user) throws AuthorizationAccessException { - Validate.notNull(user); + Objects.requireNonNull(user); final String sql = "INSERT INTO UGP_USER(IDENTIFIER, IDENTITY) VALUES (?, ?)"; jdbcTemplate.update(sql, new Object[] {user.getIdentifier(), user.getIdentity()}); return user; @@ -128,7 +129,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public User updateUser(final User user) throws AuthorizationAccessException { - Validate.notNull(user); + Objects.requireNonNull(user); // update the user identity final String sql = "UPDATE UGP_USER SET IDENTITY = ? WHERE IDENTIFIER = ?"; @@ -226,7 +227,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public User deleteUser(final User user) throws AuthorizationAccessException { - Validate.notNull(user); + Objects.requireNonNull(user); final String deleteFromUserGroupSql = "DELETE FROM UGP_USER_GROUP WHERE USER_IDENTIFIER = ?"; jdbcTemplate.update(deleteFromUserGroupSql, user.getIdentifier()); @@ -256,7 +257,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public Group addGroup(final Group group) throws AuthorizationAccessException { - Validate.notNull(group); + Objects.requireNonNull(group); // insert to the group table... final String groupSql = "INSERT INTO UGP_GROUP(IDENTIFIER, IDENTITY) VALUES (?, ?)"; @@ -270,7 +271,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public Group updateGroup(final Group group) throws AuthorizationAccessException { - Validate.notNull(group); + Objects.requireNonNull(group); // update the group identity final String updateGroupSql = "UPDATE UGP_GROUP SET IDENTITY = ? WHERE IDENTIFIER = ?"; @@ -330,7 +331,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider @Override public Group deleteGroup(final Group group) throws AuthorizationAccessException { - Validate.notNull(group); + Objects.requireNonNull(group); final String sql = "DELETE FROM UGP_GROUP WHERE IDENTIFIER = ?"; final int rowsUpdated = jdbcTemplate.update(sql, group.getIdentifier()); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java index 04d3f8642a..247ecd0c7f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java @@ -18,7 +18,6 @@ package org.apache.nifi.registry.service; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.bucket.Bucket; import org.apache.nifi.registry.bucket.BucketItem; import org.apache.nifi.registry.db.entity.BucketEntity; @@ -70,6 +69,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -98,12 +98,12 @@ public class RegistryService { final FlowContentSerializer flowContentSerializer, final Validator validator, final RegistryUrlAliasService registryUrlAliasService) { - this.metadataService = Validate.notNull(metadataService); - this.flowPersistenceProvider = Validate.notNull(flowPersistenceProvider); - this.bundlePersistenceProvider = Validate.notNull(bundlePersistenceProvider); - this.flowContentSerializer = Validate.notNull(flowContentSerializer); - this.validator = Validate.notNull(validator); - this.registryUrlAliasService = Validate.notNull(registryUrlAliasService); + this.metadataService = Objects.requireNonNull(metadataService); + this.flowPersistenceProvider = Objects.requireNonNull(flowPersistenceProvider); + this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider); + this.flowContentSerializer = Objects.requireNonNull(flowContentSerializer); + this.validator = Objects.requireNonNull(validator); + this.registryUrlAliasService = Objects.requireNonNull(registryUrlAliasService); } private void validate(T t, String invalidMessage) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/extension/StandardExtensionService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/extension/StandardExtensionService.java index c66fd387a9..49ae7fb9b6 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/extension/StandardExtensionService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/extension/StandardExtensionService.java @@ -20,7 +20,6 @@ import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.bucket.Bucket; import org.apache.nifi.registry.bundle.extract.BundleExtractor; import org.apache.nifi.registry.bundle.model.BundleDetails; @@ -89,6 +88,7 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -118,19 +118,13 @@ public class StandardExtensionService implements ExtensionService { final BundlePersistenceProvider bundlePersistenceProvider, final Validator validator, final NiFiRegistryProperties properties) { - this.extensionSerializer = extensionSerializer; + this.extensionSerializer = Objects.requireNonNull(extensionSerializer); this.extensionDocWriter = extensionDocWriter; - this.metadataService = metadataService; - this.extractors = extractors; - this.bundlePersistenceProvider = bundlePersistenceProvider; - this.validator = validator; - this.extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); - Validate.notNull(this.extensionSerializer); - Validate.notNull(this.metadataService); - Validate.notNull(this.extractors); - Validate.notNull(this.bundlePersistenceProvider); - Validate.notNull(this.validator); - Validate.notNull(this.extensionsWorkingDir); + this.metadataService = Objects.requireNonNull(metadataService); + this.extractors = Objects.requireNonNull(extractors); + this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider); + this.validator = Objects.requireNonNull(validator); + this.extensionsWorkingDir = Objects.requireNonNull(properties.getExtensionsWorkingDirectory()); } private void validate(T t, String invalidMessage) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java index b16bae5905..c6cb923497 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java @@ -17,7 +17,6 @@ package org.apache.nifi.registry.web.api; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.event.EventService; import org.apache.nifi.registry.hook.Event; import org.apache.nifi.registry.revision.entity.RevisionInfo; @@ -36,6 +35,7 @@ import javax.ws.rs.core.UriBuilderException; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.net.URISyntaxException; +import java.util.Objects; public class ApplicationResource { @@ -67,10 +67,8 @@ public class ApplicationResource { public ApplicationResource(final ServiceFacade serviceFacade, final EventService eventService) { - this.serviceFacade = serviceFacade; - this.eventService = eventService; - Validate.notNull(this.serviceFacade); - Validate.notNull(this.eventService); + this.serviceFacade = Objects.requireNonNull(serviceFacade); + this.eventService = Objects.requireNonNull(eventService); } // We don't want an error creating/publishing an event to cause the overall request to fail, so catch all throwables here diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/api/ResolvedReference.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/api/ResolvedReference.java index b96568f41c..bf8251a8e2 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/api/ResolvedReference.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/api/ResolvedReference.java @@ -16,7 +16,8 @@ */ package org.apache.nifi.toolkit.cli.api; -import org.apache.commons.lang3.Validate; +import java.util.Objects; + import org.apache.nifi.toolkit.cli.impl.command.CommandOption; /** @@ -38,12 +39,9 @@ public class ResolvedReference { final String displayName, final String resolvedValue) { this.option = option; - this.position = position; - this.displayName = displayName; - this.resolvedValue = resolvedValue; - Validate.notNull(this.position); - Validate.notNull(this.displayName); - Validate.notNull(this.resolvedValue); + this.position = Objects.requireNonNull(position); + this.displayName = Objects.requireNonNull(displayName); + this.resolvedValue = Objects.requireNonNull(resolvedValue); } public CommandOption getOption() { diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/NiFiClientFactory.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/NiFiClientFactory.java index 9470717933..4933cd6304 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/NiFiClientFactory.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/NiFiClientFactory.java @@ -18,7 +18,6 @@ package org.apache.nifi.toolkit.cli.impl.client; import org.apache.commons.cli.MissingOptionException; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.security.util.KeystoreType; import org.apache.nifi.toolkit.cli.api.ClientFactory; import org.apache.nifi.toolkit.cli.impl.client.nifi.AccessClient; @@ -51,6 +50,7 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request.ProxiedEntityRe import org.apache.nifi.toolkit.cli.impl.command.CommandOption; import java.io.IOException; +import java.util.Objects; import java.util.Properties; /** @@ -195,7 +195,7 @@ public class NiFiClientFactory implements ClientFactory { public NiFiClientWithRequestConfig(final NiFiClient wrappedClient, final RequestConfig requestConfig) { this.wrappedClient = wrappedClient; - this.requestConfig = Validate.notNull(requestConfig); + this.requestConfig = Objects.requireNonNull(requestConfig); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/request/ProxiedEntityRequestConfig.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/request/ProxiedEntityRequestConfig.java index 3ece9ca809..0837a8e225 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/request/ProxiedEntityRequestConfig.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/request/ProxiedEntityRequestConfig.java @@ -17,7 +17,6 @@ package org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils; import org.apache.nifi.toolkit.cli.impl.client.nifi.RequestConfig; @@ -25,6 +24,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -35,7 +35,7 @@ public class ProxiedEntityRequestConfig implements RequestConfig { private final String[] proxiedEntities; public ProxiedEntityRequestConfig(final String... proxiedEntities) { - this.proxiedEntities = Validate.notNull(proxiedEntities); + this.proxiedEntities = Objects.requireNonNull(proxiedEntities); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommand.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommand.java index efb3a42376..b699918c09 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommand.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommand.java @@ -22,7 +22,6 @@ import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.Command; import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Result; @@ -36,6 +35,7 @@ import java.net.URI; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; +import java.util.Objects; import java.util.Properties; /** @@ -51,13 +51,9 @@ public abstract class AbstractCommand implements Command { private PrintStream output; public AbstractCommand(final String name, final Class resultClass) { - this.name = name; - this.resultClass = resultClass; - Validate.notNull(this.name); - Validate.notNull(this.resultClass); - + this.name = Objects.requireNonNull(name); + this.resultClass = Objects.requireNonNull(resultClass); this.options = createBaseOptions(); - Validate.notNull(this.options); } protected Options createBaseOptions() { @@ -94,10 +90,8 @@ public abstract class AbstractCommand implements Command { @Override public final void initialize(final Context context) { - Validate.notNull(context); - Validate.notNull(context.getOutput()); - this.context = context; - this.output = context.getOutput(); + this.context = Objects.requireNonNull(context); + this.output = Objects.requireNonNull(context.getOutput()); this.doInitialize(context); } diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommandGroup.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommandGroup.java index 40a95dadf4..2b6792d8e4 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommandGroup.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/AbstractCommandGroup.java @@ -26,6 +26,7 @@ import java.io.PrintStream; import java.io.PrintWriter; import java.util.Collections; import java.util.List; +import java.util.Objects; /** * Base class for CommandGroups to extend from. @@ -43,7 +44,7 @@ public abstract class AbstractCommandGroup implements CommandGroup { @Override public final void initialize(final Context context) { - Validate.notNull(context); + Objects.requireNonNull(context); this.output = context.getOutput(); this.commands = Collections.unmodifiableList(createCommands()); this.commands.stream().forEach(c -> c.initialize(context)); diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandProcessor.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandProcessor.java index 8b8d58fbbc..c2664bce94 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandProcessor.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandProcessor.java @@ -21,7 +21,6 @@ import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.Command; import org.apache.nifi.toolkit.cli.api.CommandException; import org.apache.nifi.toolkit.cli.api.CommandGroup; @@ -37,6 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; /** @@ -54,14 +54,10 @@ public class CommandProcessor { private final AtomicReference backReferenceHolder = new AtomicReference<>(null); public CommandProcessor(final Map topLevelCommands, final Map commandGroups, final Context context) { - this.topLevelCommands = topLevelCommands; - this.commandGroups = commandGroups; - this.context = context; - this.out = context.getOutput(); - Validate.notNull(this.topLevelCommands); - Validate.notNull(this.commandGroups); - Validate.notNull(this.context); - Validate.notNull(this.out); + this.topLevelCommands = Objects.requireNonNull(topLevelCommands); + this.commandGroups = Objects.requireNonNull(commandGroups); + this.context = Objects.requireNonNull(context); + this.out = Objects.requireNonNull(context.getOutput()); } public void printBasicUsage(String errorMessage) { diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/ExportParamContext.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/ExportParamContext.java index 8bce845a0c..3e08035bd4 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/ExportParamContext.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/ExportParamContext.java @@ -17,7 +17,6 @@ package org.apache.nifi.toolkit.cli.impl.command.nifi.params; import org.apache.commons.cli.MissingOptionException; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.CommandException; import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.WritableResult; @@ -38,6 +37,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.util.Comparator; +import java.util.Objects; import java.util.Properties; import java.util.Set; import java.util.TreeSet; @@ -116,9 +116,8 @@ public class ExportParamContext extends AbstractNiFiCommand implements WritableResult { protected final ResultType resultType; public AbstractWritableResult(final ResultType resultType) { - this.resultType = resultType; - Validate.notNull(resultType); + this.resultType = Objects.requireNonNull(resultType); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/StringResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/StringResult.java index e75c62d0bc..63104b4dbd 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/StringResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/StringResult.java @@ -16,10 +16,10 @@ */ package org.apache.nifi.toolkit.cli.impl.result; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.WritableResult; import java.io.PrintStream; +import java.util.Objects; /** * Result for a single string value. @@ -30,9 +30,8 @@ public class StringResult implements WritableResult { private final boolean isInteractive; public StringResult(final String value, final boolean isInteractive) { - this.value = value; + this.value = Objects.requireNonNull(value); this.isInteractive = isInteractive; - Validate.notNull(this.value); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/AccessPolicyResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/AccessPolicyResult.java index c66e4d12eb..e96d8d62bd 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/AccessPolicyResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/AccessPolicyResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.dto.AccessPolicyDTO; @@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.TenantEntity; import java.io.IOException; import java.io.PrintStream; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -34,8 +34,7 @@ public class AccessPolicyResult extends AbstractWritableResult { private final ControllerConfigurationEntity controllerConfigurationEntity; public ControllerConfigurationResult(final ResultType resultType, final ControllerConfigurationEntity controllerConfigurationEntity) { super(resultType); - this.controllerConfigurationEntity = controllerConfigurationEntity; - Validate.notNull(controllerConfigurationEntity); + this.controllerConfigurationEntity = Objects.requireNonNull(controllerConfigurationEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ControllerServiceResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ControllerServiceResult.java index 444f391943..986e92bbaf 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ControllerServiceResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ControllerServiceResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.dto.BundleDTO; @@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.ControllerServiceEntity; import java.io.IOException; import java.io.PrintStream; +import java.util.Objects; public class ControllerServiceResult extends AbstractWritableResult { @@ -32,8 +32,7 @@ public class ControllerServiceResult extends AbstractWritableResult { public CurrentUserResult(final ResultType resultType, final CurrentUser currentUser) { super(resultType); - this.currentUser = currentUser; - Validate.notNull(this.currentUser); + this.currentUser = Objects.requireNonNull(currentUser); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodeResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodeResult.java index 004025b457..264a1c154a 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodeResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodeResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.dto.NodeDTO; @@ -24,6 +23,7 @@ import org.apache.nifi.web.api.entity.NodeEntity; import java.io.IOException; import java.io.PrintStream; +import java.util.Objects; public class NodeResult extends AbstractWritableResult { @@ -31,8 +31,7 @@ public class NodeResult extends AbstractWritableResult { public NodeResult(ResultType resultType, NodeEntity nodeEntity) { super(resultType); - this.nodeEntity = nodeEntity; - Validate.notNull(nodeEntity); + this.nodeEntity = Objects.requireNonNull(nodeEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodesResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodesResult.java index e997dd3e66..f90503b6f4 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodesResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/NodesResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; @@ -29,6 +28,7 @@ import org.glassfish.jersey.internal.guava.Lists; import java.io.IOException; import java.io.PrintStream; import java.util.List; +import java.util.Objects; public class NodesResult extends AbstractWritableResult { @@ -36,8 +36,7 @@ public class NodesResult extends AbstractWritableResult { public NodesResult(ResultType resultType, ClusterEntity clusterEntity) { super(resultType); - this.clusterEntity = clusterEntity; - Validate.notNull(clusterEntity); + this.clusterEntity = Objects.requireNonNull(clusterEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ParamContextsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ParamContextsResult.java index ca8dfa99b8..01dcfcb0b2 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ParamContextsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ParamContextsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.ReferenceResolver; import org.apache.nifi.toolkit.cli.api.Referenceable; @@ -38,6 +37,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -49,7 +49,7 @@ public class ParamContextsResult extends AbstractWritableResult(); // If there is a param context that the user doesn't have permissions to then the entity will be returned with diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessGroupResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessGroupResult.java index 8def19c5bc..e3b3456f48 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessGroupResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessGroupResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.entity.ProcessGroupEntity; @@ -24,6 +23,7 @@ import org.apache.nifi.web.api.entity.ProcessGroupEntity; import java.io.IOException; import java.io.PrintStream; import java.util.Collections; +import java.util.Objects; public class ProcessGroupResult extends AbstractWritableResult { @@ -31,8 +31,7 @@ public class ProcessGroupResult extends AbstractWritableResult processGroups) { super(resultType); - this.processGroups = processGroups; - Validate.notNull(this.processGroups); + this.processGroups = Objects.requireNonNull(processGroups); this.processGroups.sort(Comparator.comparing(ProcessGroupDTO::getName)); } diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorResult.java index ff3f83a422..4593833d36 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.dto.BundleDTO; @@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.ProcessorEntity; import java.io.IOException; import java.io.PrintStream; +import java.util.Objects; public class ProcessorResult extends AbstractWritableResult { @@ -32,8 +32,7 @@ public class ProcessorResult extends AbstractWritableResult { public ProcessorResult(ResultType resultType, ProcessorEntity processorEntity) { super(resultType); - this.processorEntity = processorEntity; - Validate.notNull(processorEntity); + this.processorEntity = Objects.requireNonNull(processorEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorsResult.java index 42617a6c66..06d07304ca 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/ProcessorsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; @@ -30,6 +29,7 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -39,8 +39,7 @@ public class ProcessorsResult extends AbstractWritableResult { public ProcessorsResult(ResultType resultType, ProcessorsEntity processorsEntity) { super(resultType); - this.processorsEntity = processorsEntity; - Validate.notNull(processorsEntity); + this.processorsEntity = Objects.requireNonNull(processorsEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/RegistryClientIDResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/RegistryClientIDResult.java index a4ced6974b..fe9142ff32 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/RegistryClientIDResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/RegistryClientIDResult.java @@ -16,12 +16,12 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.web.api.dto.FlowRegistryClientDTO; import java.io.PrintStream; +import java.util.Objects; public class RegistryClientIDResult extends AbstractWritableResult { @@ -29,8 +29,7 @@ public class RegistryClientIDResult extends AbstractWritableResult { @@ -33,8 +33,7 @@ public class ReportingTaskResult extends AbstractWritableResult { public UserGroupsResult(final ResultType resultType, final UserGroupsEntity userGroupsEntity) { super(resultType); - this.userGroupsEntity = userGroupsEntity; - Validate.notNull(this.userGroupsEntity); + this.userGroupsEntity = Objects.requireNonNull(userGroupsEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/UsersResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/UsersResult.java index 74ad327693..f7614213c2 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/UsersResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/UsersResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; @@ -32,6 +31,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -43,8 +43,7 @@ public class UsersResult extends AbstractWritableResult { public UsersResult(final ResultType resultType, final UsersEntity usersEntity) { super(resultType); - this.usersEntity = usersEntity; - Validate.notNull(this.usersEntity); + this.usersEntity = Objects.requireNonNull(usersEntity); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/VariableRegistryResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/VariableRegistryResult.java index ec8430bc50..7da9ef350c 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/VariableRegistryResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/nifi/VariableRegistryResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.nifi; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; @@ -30,6 +29,7 @@ import java.io.PrintStream; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -41,8 +41,7 @@ public class VariableRegistryResult extends AbstractWritableResult { public AccessPolicyResult(ResultType resultType, AccessPolicy accessPolicy) { super(resultType); - this.accessPolicy = accessPolicy; - Validate.notNull(accessPolicy); + this.accessPolicy = Objects.requireNonNull(accessPolicy); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/BucketsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/BucketsResult.java index 6f8eac7fe2..d51476e1cd 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/BucketsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/BucketsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.bucket.Bucket; import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.ReferenceResolver; @@ -34,6 +33,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** @@ -45,8 +45,7 @@ public class BucketsResult extends AbstractWritableResult> implemen public BucketsResult(final ResultType resultType, final List buckets) { super(resultType); - this.buckets = buckets; - Validate.notNull(buckets); + this.buckets = Objects.requireNonNull(buckets); // NOTE: it is important that the order the buckets are printed is the same order for the ReferenceResolver this.buckets.sort(Comparator.comparing(Bucket::getName)); diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionMetadataResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionMetadataResult.java index a7e087e996..f501a122b6 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionMetadataResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionMetadataResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.extension.ExtensionMetadata; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter; import java.io.IOException; import java.io.PrintStream; import java.util.List; +import java.util.Objects; public class ExtensionMetadataResult extends AbstractWritableResult> { @@ -34,8 +34,7 @@ public class ExtensionMetadataResult extends AbstractWritableResult extensionMetadata) { super(resultType); - this.extensionMetadata = extensionMetadata; - Validate.notNull(this.extensionMetadata); + this.extensionMetadata = Objects.requireNonNull(this.extensionMetadata); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoArtifactsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoArtifactsResult.java index 2bad238070..a5e974c3cc 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoArtifactsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoArtifactsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.extension.repo.ExtensionRepoArtifact; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -28,6 +27,7 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Comparator; import java.util.List; +import java.util.Objects; /** * Result for list of bundle artifacts. @@ -38,8 +38,7 @@ public class ExtensionRepoArtifactsResult extends AbstractWritableResult bundleArtifacts) { super(resultType); - this.bundleArtifacts = bundleArtifacts; - Validate.notNull(this.bundleArtifacts); + this.bundleArtifacts = Objects.requireNonNull(bundleArtifacts); this.bundleArtifacts.sort( Comparator.comparing(ExtensionRepoArtifact::getBucketName) diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoGroupsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoGroupsResult.java index c3ccddd49b..fe810e128d 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoGroupsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoGroupsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.extension.repo.ExtensionRepoGroup; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -28,6 +27,7 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Comparator; import java.util.List; +import java.util.Objects; /** * Result for list of bundle groups. @@ -38,8 +38,7 @@ public class ExtensionRepoGroupsResult extends AbstractWritableResult bundleGroups) { super(resultType); - this.bundleGroups = bundleGroups; - Validate.notNull(this.bundleGroups); + this.bundleGroups = Objects.requireNonNull(bundleGroups); this.bundleGroups.sort( Comparator.comparing(ExtensionRepoGroup::getBucketName) diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoVersionSummariesResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoVersionSummariesResult.java index 655705a100..d847105ebd 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoVersionSummariesResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/ExtensionRepoVersionSummariesResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.extension.repo.ExtensionRepoVersionSummary; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter; import java.io.PrintStream; import java.util.Comparator; import java.util.List; +import java.util.Objects; public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult> { @@ -34,8 +34,7 @@ public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult< public ExtensionRepoVersionSummariesResult(final ResultType resultType, final List bundleVersions) { super(resultType); - this.bundleVersions = bundleVersions; - Validate.notNull(this.bundleVersions); + this.bundleVersions = Objects.requireNonNull(bundleVersions); this.bundleVersions.sort( Comparator.comparing(ExtensionRepoVersionSummary::getBucketName) diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/RegisteredFlowSnapshotMetadataResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/RegisteredFlowSnapshotMetadataResult.java index 6ad575013c..e0e1d5f10c 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/RegisteredFlowSnapshotMetadataResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/RegisteredFlowSnapshotMetadataResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -28,6 +27,7 @@ import java.io.PrintStream; import java.util.Comparator; import java.util.Date; import java.util.List; +import java.util.Objects; /** * Result for a list of RegisteredFlowSnapshotMetadata. @@ -38,8 +38,7 @@ public class RegisteredFlowSnapshotMetadataResult extends AbstractWritableResult public RegisteredFlowSnapshotMetadataResult(final ResultType resultType, final List versions) { super(resultType); - this.versions = versions; - Validate.notNull(this.versions); + this.versions = Objects.requireNonNull(versions); this.versions.sort(Comparator.comparing(VersionedFlowSnapshotMetadata::getVersion)); } diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/TagCountResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/TagCountResult.java index aeecd26cc5..80747961bd 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/TagCountResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/TagCountResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.extension.TagCount; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter; import java.io.IOException; import java.io.PrintStream; import java.util.List; +import java.util.Objects; public class TagCountResult extends AbstractWritableResult> { @@ -34,8 +34,7 @@ public class TagCountResult extends AbstractWritableResult> { public TagCountResult(ResultType resultType, final List tagCounts) { super(resultType); - this.tagCounts = tagCounts; - Validate.notNull(this.tagCounts); + this.tagCounts = Objects.requireNonNull(tagCounts); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UserGroupsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UserGroupsResult.java index d517ceff6c..cce3aac7fe 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UserGroupsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UserGroupsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.authorization.Tenant; import org.apache.nifi.registry.authorization.UserGroup; import org.apache.nifi.toolkit.cli.api.ResultType; @@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter; import java.io.PrintStream; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -38,8 +38,7 @@ public class UserGroupsResult extends AbstractWritableResult> { public UserGroupsResult(final ResultType resultType, final List userGroups) { super(resultType); - this.userGroups = userGroups; - Validate.notNull(userGroups); + this.userGroups = Objects.requireNonNull(userGroups); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UsersResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UsersResult.java index 4d19a3bbaa..ccb1058d3c 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UsersResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/UsersResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.authorization.User; import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; @@ -26,6 +25,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter; import java.io.PrintStream; import java.util.List; +import java.util.Objects; /** * Result for a list of users. @@ -35,8 +35,7 @@ public class UsersResult extends AbstractWritableResult> { public UsersResult(ResultType resultType, List users) { super(resultType); - this.users = users; - Validate.notNull(users); + this.users = Objects.requireNonNull(users); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowDifferenceResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowDifferenceResult.java index 00d1b8f120..fbc9f508e9 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowDifferenceResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowDifferenceResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.diff.ComponentDifference; import org.apache.nifi.registry.diff.ComponentDifferenceGroup; import org.apache.nifi.registry.diff.VersionedFlowDifference; @@ -32,6 +31,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Objects; public class VersionedFlowDifferenceResult extends AbstractWritableResult { @@ -39,7 +39,7 @@ public class VersionedFlowDifferenceResult extends AbstractWritableResult versionedFlowSnapshots, final String exportDirectoryName) { - this.versionedFlowSnapshots = versionedFlowSnapshots; + this.versionedFlowSnapshots = Objects.requireNonNull(versionedFlowSnapshots); this.exportDirectoryName = exportDirectoryName; - Validate.notNull(this.versionedFlowSnapshots); } @Override diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowsResult.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowsResult.java index facfa2916f..0ec505ab44 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowsResult.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/registry/VersionedFlowsResult.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.result.registry; -import org.apache.commons.lang3.Validate; import org.apache.nifi.registry.flow.VersionedFlow; import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.ReferenceResolver; @@ -34,6 +33,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** @@ -45,8 +45,7 @@ public class VersionedFlowsResult extends AbstractWritableResult flows) { super(resultType); - this.versionedFlows = flows; - Validate.notNull(this.versionedFlows); + this.versionedFlows = Objects.requireNonNull(flows); // NOTE: it is important that the order the flows are printed is the same order for the ReferenceResolver this.versionedFlows.sort(Comparator.comparing(VersionedFlow::getName)); diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/session/PersistentSession.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/session/PersistentSession.java index 9cf83020a8..403cb0607b 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/session/PersistentSession.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/session/PersistentSession.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.toolkit.cli.impl.session; -import org.apache.commons.lang3.Validate; import org.apache.nifi.toolkit.cli.api.Session; import org.apache.nifi.toolkit.cli.api.SessionException; @@ -26,6 +25,7 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; +import java.util.Objects; import java.util.Properties; import java.util.Set; @@ -36,10 +36,8 @@ public class PersistentSession implements Session { private final Session wrappedSession; public PersistentSession(final File persistenceFile, final Session wrappedSession) { - this.persistenceFile = persistenceFile; - this.wrappedSession = wrappedSession; - Validate.notNull(persistenceFile); - Validate.notNull(wrappedSession); + this.persistenceFile = Objects.requireNonNull(persistenceFile); + this.wrappedSession = Objects.requireNonNull(wrappedSession); } @Override