NIFI-12113 Replaced Validate.notNull() with Objects.requireNonNull()

This closes #7779

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Pierre Villard 2023-09-22 16:14:31 +02:00 committed by exceptionfactory
parent 140ac52e9d
commit 4b9eb8361c
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
61 changed files with 166 additions and 235 deletions

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.security.krb; package org.apache.nifi.security.krb;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.exception.ProcessException;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.util.Objects;
/** /**
* Helper class for processors to perform an action as a KerberosUser. * Helper class for processors to perform an action as a KerberosUser.
@ -43,13 +43,10 @@ public class KerberosAction<T> {
final PrivilegedExceptionAction<T> action, final PrivilegedExceptionAction<T> action,
final ComponentLog logger, final ComponentLog logger,
final ClassLoader contextClassLoader) { final ClassLoader contextClassLoader) {
this.kerberosUser = kerberosUser; this.kerberosUser = Objects.requireNonNull(kerberosUser);
this.action = action; this.action = Objects.requireNonNull(action);
this.logger = logger; this.logger = Objects.requireNonNull(logger);
this.contextClassLoader = contextClassLoader; this.contextClassLoader = contextClassLoader;
Validate.notNull(this.kerberosUser);
Validate.notNull(this.action);
Validate.notNull(this.logger);
} }
public T execute() { public T execute() {

View File

@ -16,8 +16,9 @@
*/ */
package org.apache.nifi.processor.util.listen.event; package org.apache.nifi.processor.util.listen.event;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.logging.ComponentLog;
import java.util.Objects;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -42,11 +43,9 @@ public class EventQueue<E extends Event> {
} }
public EventQueue(final BlockingQueue<E> events, final long offerWaitMs, final ComponentLog logger) { public EventQueue(final BlockingQueue<E> events, final long offerWaitMs, final ComponentLog logger) {
this.events = events; this.events = Objects.requireNonNull(events);
this.offerWaitMs = offerWaitMs; this.offerWaitMs = offerWaitMs;
this.logger = logger; this.logger = Objects.requireNonNull(logger);
Validate.notNull(this.events);
Validate.notNull(this.logger);
} }
/** /**

View File

@ -30,6 +30,7 @@ import java.security.AccessControlContext;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.stream.Collectors; 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) public static synchronized UserGroupInformation loginKerberos(final Configuration config, final String principal, final String keyTab)
throws IOException { throws IOException {
Validate.notNull(config); Objects.requireNonNull(config);
Validate.notNull(principal); Objects.requireNonNull(principal);
Validate.notNull(keyTab); Objects.requireNonNull(keyTab);
UserGroupInformation.setConfiguration(config); UserGroupInformation.setConfiguration(config);
UserGroupInformation.loginUserFromKeytab(principal.trim(), keyTab.trim()); UserGroupInformation.loginUserFromKeytab(principal.trim(), keyTab.trim());
@ -128,7 +129,7 @@ public class SecurityUtil {
* @throws IOException if login failed * @throws IOException if login failed
*/ */
public static synchronized UserGroupInformation loginSimple(final Configuration config) throws IOException { public static synchronized UserGroupInformation loginSimple(final Configuration config) throws IOException {
Validate.notNull(config); Objects.requireNonNull(config);
UserGroupInformation.setConfiguration(config); UserGroupInformation.setConfiguration(config);
return UserGroupInformation.getLoginUser(); return UserGroupInformation.getLoginUser();
} }
@ -144,7 +145,7 @@ public class SecurityUtil {
* *
*/ */
public static boolean isSecurityEnabled(final Configuration config) { public static boolean isSecurityEnabled(final Configuration config) {
Validate.notNull(config); Objects.requireNonNull(config);
return KERBEROS.equalsIgnoreCase(config.get(HADOOP_SECURITY_AUTHENTICATION)); return KERBEROS.equalsIgnoreCase(config.get(HADOOP_SECURITY_AUTHENTICATION));
} }

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.registry.client.impl.request; 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.client.RequestConfig;
import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils; import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* Implementation of RequestConfig that produces headers for a request with proxied-entities. * 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; private final String proxiedEntitiesChain;
public ProxiedEntityRequestConfig(final String... proxiedEntities) { public ProxiedEntityRequestConfig(final String... proxiedEntities) {
Validate.notNull(proxiedEntities); Objects.requireNonNull(proxiedEntities);
this.proxiedEntitiesChain = ProxiedEntitiesUtils.getProxiedEntitiesChain(proxiedEntities); this.proxiedEntitiesChain = ProxiedEntitiesUtils.getProxiedEntitiesChain(proxiedEntities);
} }

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.registry.event; 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.Event;
import org.apache.nifi.registry.hook.EventField; import org.apache.nifi.registry.hook.EventField;
import org.apache.nifi.registry.hook.EventFieldName; import org.apache.nifi.registry.hook.EventFieldName;
@ -38,10 +37,9 @@ public class StandardEvent implements Event {
private final List<EventField> eventFields; private final List<EventField> eventFields;
private StandardEvent(final Builder builder) { private StandardEvent(final Builder builder) {
this.eventType = builder.eventType; this.eventType = Objects.requireNonNull(builder.eventType);
this.eventFields = Collections.unmodifiableList(builder.eventFields == null this.eventFields = Collections.unmodifiableList(builder.eventFields == null
? Collections.emptyList() : new ArrayList<>(builder.eventFields)); ? Collections.emptyList() : new ArrayList<>(builder.eventFields));
Validate.notNull(this.eventType);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.registry.event; 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.EventField;
import org.apache.nifi.registry.hook.EventFieldName; import org.apache.nifi.registry.hook.EventFieldName;
@ -32,10 +31,8 @@ public class StandardEventField implements EventField {
private final String value; private final String value;
public StandardEventField(final EventFieldName name, final String value) { public StandardEventField(final EventFieldName name, final String value) {
this.name = name; this.name = Objects.requireNonNull(name);
this.value = value; this.value = Objects.requireNonNull(value);
Validate.notNull(this.name);
Validate.notNull(this.value);
} }
@Override @Override

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.nifi.registry.provider.extension; package org.apache.nifi.registry.provider.extension;
import java.util.Objects;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.extension.BundlePersistenceContext; import org.apache.nifi.registry.extension.BundlePersistenceContext;
import org.apache.nifi.registry.extension.BundleVersionCoordinate; import org.apache.nifi.registry.extension.BundleVersionCoordinate;
@ -28,11 +30,10 @@ public class StandardBundlePersistenceContext implements BundlePersistenceContex
private final long bundleSize; private final long bundleSize;
private StandardBundlePersistenceContext(final Builder builder) { private StandardBundlePersistenceContext(final Builder builder) {
this.coordinate = builder.coordinate; this.coordinate = Objects.requireNonNull(builder.coordinate);
this.bundleSize = builder.bundleSize; this.bundleSize = builder.bundleSize;
this.author = builder.author; this.author = builder.author;
this.timestamp = builder.timestamp; this.timestamp = builder.timestamp;
Validate.notNull(this.coordinate);
Validate.notBlank(this.author); Validate.notBlank(this.author);
} }

View File

@ -17,7 +17,6 @@
package org.apache.nifi.registry.security.authorization; package org.apache.nifi.registry.security.authorization;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.properties.SensitivePropertyProtectionException; import org.apache.nifi.properties.SensitivePropertyProtectionException;
import org.apache.nifi.properties.SensitivePropertyProvider; import org.apache.nifi.properties.SensitivePropertyProvider;
import org.apache.nifi.properties.SensitivePropertyProviderFactory; import org.apache.nifi.properties.SensitivePropertyProviderFactory;
@ -71,6 +70,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
/** /**
@ -125,12 +125,12 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
final DataSource dataSource, final DataSource dataSource,
final IdentityMapper identityMapper) { final IdentityMapper identityMapper) {
this.properties = Validate.notNull(properties); this.properties = Objects.requireNonNull(properties);
this.extensionManager = Validate.notNull(extensionManager); this.extensionManager = Objects.requireNonNull(extensionManager);
this.sensitivePropertyProviderFactory = sensitivePropertyProviderFactory; this.sensitivePropertyProviderFactory = sensitivePropertyProviderFactory;
this.registryService = Validate.notNull(registryService); this.registryService = Objects.requireNonNull(registryService);
this.dataSource = Validate.notNull(dataSource); this.dataSource = Objects.requireNonNull(dataSource);
this.identityMapper = Validate.notNull(identityMapper); this.identityMapper = Objects.requireNonNull(identityMapper);
} }
/***** UserGroupProviderLookup *****/ /***** UserGroupProviderLookup *****/

View File

@ -48,6 +48,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
/** /**
@ -158,7 +159,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override @Override
public AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { public AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy); Objects.requireNonNull(accessPolicy);
// insert to the policy table // insert to the policy table
final String policySql = "INSERT INTO APP_POLICY(IDENTIFIER, RESOURCE, ACTION) VALUES (?, ?, ?)"; final String policySql = "INSERT INTO APP_POLICY(IDENTIFIER, RESOURCE, ACTION) VALUES (?, ?, ?)";
@ -172,7 +173,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override @Override
public AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { public AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy); Objects.requireNonNull(accessPolicy);
// determine if policy exists // determine if policy exists
final DatabaseAccessPolicy existingPolicy = getDatabaseAcessPolicy(accessPolicy.getIdentifier()); final DatabaseAccessPolicy existingPolicy = getDatabaseAcessPolicy(accessPolicy.getIdentifier());
@ -250,7 +251,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override @Override
public AccessPolicy getAccessPolicy(final String resourceIdentifier, RequestAction action) throws AuthorizationAccessException { public AccessPolicy getAccessPolicy(final String resourceIdentifier, RequestAction action) throws AuthorizationAccessException {
Validate.notBlank(resourceIdentifier); Validate.notBlank(resourceIdentifier);
Validate.notNull(action); Objects.requireNonNull(action);
final String policySql = "SELECT * FROM APP_POLICY WHERE RESOURCE = ? AND ACTION = ?"; final String policySql = "SELECT * FROM APP_POLICY WHERE RESOURCE = ? AND ACTION = ?";
final Object[] args = new Object[]{resourceIdentifier, action.toString()}; final Object[] args = new Object[]{resourceIdentifier, action.toString()};
@ -266,7 +267,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override @Override
public AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { public AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy); Objects.requireNonNull(accessPolicy);
final String sql = "DELETE FROM APP_POLICY WHERE IDENTIFIER = ?"; final String sql = "DELETE FROM APP_POLICY WHERE IDENTIFIER = ?";
final int rowsUpdated = jdbcTemplate.update(sql, accessPolicy.getIdentifier()); final int rowsUpdated = jdbcTemplate.update(sql, accessPolicy.getIdentifier());

View File

@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
/** /**
@ -120,7 +121,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public User addUser(final User user) throws AuthorizationAccessException { public User addUser(final User user) throws AuthorizationAccessException {
Validate.notNull(user); Objects.requireNonNull(user);
final String sql = "INSERT INTO UGP_USER(IDENTIFIER, IDENTITY) VALUES (?, ?)"; final String sql = "INSERT INTO UGP_USER(IDENTIFIER, IDENTITY) VALUES (?, ?)";
jdbcTemplate.update(sql, new Object[] {user.getIdentifier(), user.getIdentity()}); jdbcTemplate.update(sql, new Object[] {user.getIdentifier(), user.getIdentity()});
return user; return user;
@ -128,7 +129,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public User updateUser(final User user) throws AuthorizationAccessException { public User updateUser(final User user) throws AuthorizationAccessException {
Validate.notNull(user); Objects.requireNonNull(user);
// update the user identity // update the user identity
final String sql = "UPDATE UGP_USER SET IDENTITY = ? WHERE IDENTIFIER = ?"; final String sql = "UPDATE UGP_USER SET IDENTITY = ? WHERE IDENTIFIER = ?";
@ -226,7 +227,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public User deleteUser(final User user) throws AuthorizationAccessException { 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 = ?"; final String deleteFromUserGroupSql = "DELETE FROM UGP_USER_GROUP WHERE USER_IDENTIFIER = ?";
jdbcTemplate.update(deleteFromUserGroupSql, user.getIdentifier()); jdbcTemplate.update(deleteFromUserGroupSql, user.getIdentifier());
@ -256,7 +257,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public Group addGroup(final Group group) throws AuthorizationAccessException { public Group addGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group); Objects.requireNonNull(group);
// insert to the group table... // insert to the group table...
final String groupSql = "INSERT INTO UGP_GROUP(IDENTIFIER, IDENTITY) VALUES (?, ?)"; final String groupSql = "INSERT INTO UGP_GROUP(IDENTIFIER, IDENTITY) VALUES (?, ?)";
@ -270,7 +271,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public Group updateGroup(final Group group) throws AuthorizationAccessException { public Group updateGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group); Objects.requireNonNull(group);
// update the group identity // update the group identity
final String updateGroupSql = "UPDATE UGP_GROUP SET IDENTITY = ? WHERE IDENTIFIER = ?"; final String updateGroupSql = "UPDATE UGP_GROUP SET IDENTITY = ? WHERE IDENTIFIER = ?";
@ -330,7 +331,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override @Override
public Group deleteGroup(final Group group) throws AuthorizationAccessException { public Group deleteGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group); Objects.requireNonNull(group);
final String sql = "DELETE FROM UGP_GROUP WHERE IDENTIFIER = ?"; final String sql = "DELETE FROM UGP_GROUP WHERE IDENTIFIER = ?";
final int rowsUpdated = jdbcTemplate.update(sql, group.getIdentifier()); final int rowsUpdated = jdbcTemplate.update(sql, group.getIdentifier());

View File

@ -18,7 +18,6 @@ package org.apache.nifi.registry.service;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; 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.Bucket;
import org.apache.nifi.registry.bucket.BucketItem; import org.apache.nifi.registry.bucket.BucketItem;
import org.apache.nifi.registry.db.entity.BucketEntity; import org.apache.nifi.registry.db.entity.BucketEntity;
@ -70,6 +69,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
@ -98,12 +98,12 @@ public class RegistryService {
final FlowContentSerializer flowContentSerializer, final FlowContentSerializer flowContentSerializer,
final Validator validator, final Validator validator,
final RegistryUrlAliasService registryUrlAliasService) { final RegistryUrlAliasService registryUrlAliasService) {
this.metadataService = Validate.notNull(metadataService); this.metadataService = Objects.requireNonNull(metadataService);
this.flowPersistenceProvider = Validate.notNull(flowPersistenceProvider); this.flowPersistenceProvider = Objects.requireNonNull(flowPersistenceProvider);
this.bundlePersistenceProvider = Validate.notNull(bundlePersistenceProvider); this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider);
this.flowContentSerializer = Validate.notNull(flowContentSerializer); this.flowContentSerializer = Objects.requireNonNull(flowContentSerializer);
this.validator = Validate.notNull(validator); this.validator = Objects.requireNonNull(validator);
this.registryUrlAliasService = Validate.notNull(registryUrlAliasService); this.registryUrlAliasService = Objects.requireNonNull(registryUrlAliasService);
} }
private <T> void validate(T t, String invalidMessage) { private <T> void validate(T t, String invalidMessage) {

View File

@ -20,7 +20,6 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; 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.Bucket;
import org.apache.nifi.registry.bundle.extract.BundleExtractor; import org.apache.nifi.registry.bundle.extract.BundleExtractor;
import org.apache.nifi.registry.bundle.model.BundleDetails; import org.apache.nifi.registry.bundle.model.BundleDetails;
@ -89,6 +88,7 @@ import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
@ -118,19 +118,13 @@ public class StandardExtensionService implements ExtensionService {
final BundlePersistenceProvider bundlePersistenceProvider, final BundlePersistenceProvider bundlePersistenceProvider,
final Validator validator, final Validator validator,
final NiFiRegistryProperties properties) { final NiFiRegistryProperties properties) {
this.extensionSerializer = extensionSerializer; this.extensionSerializer = Objects.requireNonNull(extensionSerializer);
this.extensionDocWriter = extensionDocWriter; this.extensionDocWriter = extensionDocWriter;
this.metadataService = metadataService; this.metadataService = Objects.requireNonNull(metadataService);
this.extractors = extractors; this.extractors = Objects.requireNonNull(extractors);
this.bundlePersistenceProvider = bundlePersistenceProvider; this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider);
this.validator = validator; this.validator = Objects.requireNonNull(validator);
this.extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); this.extensionsWorkingDir = Objects.requireNonNull(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);
} }
private <T> void validate(T t, String invalidMessage) { private <T> void validate(T t, String invalidMessage) {

View File

@ -17,7 +17,6 @@
package org.apache.nifi.registry.web.api; package org.apache.nifi.registry.web.api;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.event.EventService; import org.apache.nifi.registry.event.EventService;
import org.apache.nifi.registry.hook.Event; import org.apache.nifi.registry.hook.Event;
import org.apache.nifi.registry.revision.entity.RevisionInfo; 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 javax.ws.rs.core.UriInfo;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Objects;
public class ApplicationResource { public class ApplicationResource {
@ -67,10 +67,8 @@ public class ApplicationResource {
public ApplicationResource(final ServiceFacade serviceFacade, public ApplicationResource(final ServiceFacade serviceFacade,
final EventService eventService) { final EventService eventService) {
this.serviceFacade = serviceFacade; this.serviceFacade = Objects.requireNonNull(serviceFacade);
this.eventService = eventService; this.eventService = Objects.requireNonNull(eventService);
Validate.notNull(this.serviceFacade);
Validate.notNull(this.eventService);
} }
// We don't want an error creating/publishing an event to cause the overall request to fail, so catch all throwables here // We don't want an error creating/publishing an event to cause the overall request to fail, so catch all throwables here

View File

@ -16,7 +16,8 @@
*/ */
package org.apache.nifi.toolkit.cli.api; 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; import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
/** /**
@ -38,12 +39,9 @@ public class ResolvedReference {
final String displayName, final String displayName,
final String resolvedValue) { final String resolvedValue) {
this.option = option; this.option = option;
this.position = position; this.position = Objects.requireNonNull(position);
this.displayName = displayName; this.displayName = Objects.requireNonNull(displayName);
this.resolvedValue = resolvedValue; this.resolvedValue = Objects.requireNonNull(resolvedValue);
Validate.notNull(this.position);
Validate.notNull(this.displayName);
Validate.notNull(this.resolvedValue);
} }
public CommandOption getOption() { public CommandOption getOption() {

View File

@ -18,7 +18,6 @@ package org.apache.nifi.toolkit.cli.impl.client;
import org.apache.commons.cli.MissingOptionException; import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.security.util.KeystoreType; import org.apache.nifi.registry.security.util.KeystoreType;
import org.apache.nifi.toolkit.cli.api.ClientFactory; import org.apache.nifi.toolkit.cli.api.ClientFactory;
import org.apache.nifi.toolkit.cli.impl.client.nifi.AccessClient; 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 org.apache.nifi.toolkit.cli.impl.command.CommandOption;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
import java.util.Properties; import java.util.Properties;
/** /**
@ -195,7 +195,7 @@ public class NiFiClientFactory implements ClientFactory<NiFiClient> {
public NiFiClientWithRequestConfig(final NiFiClient wrappedClient, final RequestConfig requestConfig) { public NiFiClientWithRequestConfig(final NiFiClient wrappedClient, final RequestConfig requestConfig) {
this.wrappedClient = wrappedClient; this.wrappedClient = wrappedClient;
this.requestConfig = Validate.notNull(requestConfig); this.requestConfig = Objects.requireNonNull(requestConfig);
} }
@Override @Override

View File

@ -17,7 +17,6 @@
package org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request; package org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils; import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils;
import org.apache.nifi.toolkit.cli.impl.client.nifi.RequestConfig; 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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -35,7 +35,7 @@ public class ProxiedEntityRequestConfig implements RequestConfig {
private final String[] proxiedEntities; private final String[] proxiedEntities;
public ProxiedEntityRequestConfig(final String... proxiedEntities) { public ProxiedEntityRequestConfig(final String... proxiedEntities) {
this.proxiedEntities = Validate.notNull(proxiedEntities); this.proxiedEntities = Objects.requireNonNull(proxiedEntities);
} }
@Override @Override

View File

@ -22,7 +22,6 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; 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.Command;
import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.Result; import org.apache.nifi.toolkit.cli.api.Result;
@ -36,6 +35,7 @@ import java.net.URI;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Objects;
import java.util.Properties; import java.util.Properties;
/** /**
@ -51,13 +51,9 @@ public abstract class AbstractCommand<R extends Result> implements Command<R> {
private PrintStream output; private PrintStream output;
public AbstractCommand(final String name, final Class<R> resultClass) { public AbstractCommand(final String name, final Class<R> resultClass) {
this.name = name; this.name = Objects.requireNonNull(name);
this.resultClass = resultClass; this.resultClass = Objects.requireNonNull(resultClass);
Validate.notNull(this.name);
Validate.notNull(this.resultClass);
this.options = createBaseOptions(); this.options = createBaseOptions();
Validate.notNull(this.options);
} }
protected Options createBaseOptions() { protected Options createBaseOptions() {
@ -94,10 +90,8 @@ public abstract class AbstractCommand<R extends Result> implements Command<R> {
@Override @Override
public final void initialize(final Context context) { public final void initialize(final Context context) {
Validate.notNull(context); this.context = Objects.requireNonNull(context);
Validate.notNull(context.getOutput()); this.output = Objects.requireNonNull(context.getOutput());
this.context = context;
this.output = context.getOutput();
this.doInitialize(context); this.doInitialize(context);
} }

View File

@ -26,6 +26,7 @@ import java.io.PrintStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Base class for CommandGroups to extend from. * Base class for CommandGroups to extend from.
@ -43,7 +44,7 @@ public abstract class AbstractCommandGroup implements CommandGroup {
@Override @Override
public final void initialize(final Context context) { public final void initialize(final Context context) {
Validate.notNull(context); Objects.requireNonNull(context);
this.output = context.getOutput(); this.output = context.getOutput();
this.commands = Collections.unmodifiableList(createCommands()); this.commands = Collections.unmodifiableList(createCommands());
this.commands.stream().forEach(c -> c.initialize(context)); this.commands.stream().forEach(c -> c.initialize(context));

View File

@ -21,7 +21,6 @@ import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; 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.Command;
import org.apache.nifi.toolkit.cli.api.CommandException; import org.apache.nifi.toolkit.cli.api.CommandException;
import org.apache.nifi.toolkit.cli.api.CommandGroup; import org.apache.nifi.toolkit.cli.api.CommandGroup;
@ -37,6 +36,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
/** /**
@ -54,14 +54,10 @@ public class CommandProcessor {
private final AtomicReference<ReferenceResolver> backReferenceHolder = new AtomicReference<>(null); private final AtomicReference<ReferenceResolver> backReferenceHolder = new AtomicReference<>(null);
public CommandProcessor(final Map<String,Command> topLevelCommands, final Map<String,CommandGroup> commandGroups, final Context context) { public CommandProcessor(final Map<String,Command> topLevelCommands, final Map<String,CommandGroup> commandGroups, final Context context) {
this.topLevelCommands = topLevelCommands; this.topLevelCommands = Objects.requireNonNull(topLevelCommands);
this.commandGroups = commandGroups; this.commandGroups = Objects.requireNonNull(commandGroups);
this.context = context; this.context = Objects.requireNonNull(context);
this.out = context.getOutput(); this.out = Objects.requireNonNull(context.getOutput());
Validate.notNull(this.topLevelCommands);
Validate.notNull(this.commandGroups);
Validate.notNull(this.context);
Validate.notNull(this.out);
} }
public void printBasicUsage(String errorMessage) { public void printBasicUsage(String errorMessage) {

View File

@ -17,7 +17,6 @@
package org.apache.nifi.toolkit.cli.impl.command.nifi.params; package org.apache.nifi.toolkit.cli.impl.command.nifi.params;
import org.apache.commons.cli.MissingOptionException; 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.CommandException;
import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.WritableResult; import org.apache.nifi.toolkit.cli.api.WritableResult;
@ -38,6 +37,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.Objects;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -116,9 +116,8 @@ public class ExportParamContext extends AbstractNiFiCommand<ExportParamContext.E
private final String outputFilename; private final String outputFilename;
public ExportedParamContextResult(final ParameterContextDTO parameterContext, final String outputFilename) { public ExportedParamContextResult(final ParameterContextDTO parameterContext, final String outputFilename) {
this.parameterContext = parameterContext; this.parameterContext = Objects.requireNonNull(parameterContext);
this.outputFilename = outputFilename; this.outputFilename = outputFilename;
Validate.notNull(this.parameterContext);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.context; package org.apache.nifi.toolkit.cli.impl.context;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.client.NiFiRegistryClient; import org.apache.nifi.registry.client.NiFiRegistryClient;
import org.apache.nifi.toolkit.cli.api.ClientFactory; import org.apache.nifi.toolkit.cli.api.ClientFactory;
import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Context;
@ -24,6 +23,7 @@ import org.apache.nifi.toolkit.cli.api.Session;
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient; import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Context for the CLI which will be passed to each command. * Context for the CLI which will be passed to each command.
@ -37,16 +37,11 @@ public class StandardContext implements Context {
private final boolean isInteractive; private final boolean isInteractive;
private StandardContext(final Builder builder) { private StandardContext(final Builder builder) {
this.niFiClientFactory = builder.niFiClientFactory; this.niFiClientFactory = Objects.requireNonNull(builder.niFiClientFactory);
this.niFiRegistryClientFactory = builder.niFiRegistryClientFactory; this.niFiRegistryClientFactory = Objects.requireNonNull(builder.niFiRegistryClientFactory);
this.session = builder.session; this.session = Objects.requireNonNull(builder.session);
this.output = builder.output; this.output = Objects.requireNonNull(builder.output);
this.isInteractive = builder.isInteractive; this.isInteractive = builder.isInteractive;
Validate.notNull(this.niFiClientFactory);
Validate.notNull(this.niFiRegistryClientFactory);
Validate.notNull(this.session);
Validate.notNull(this.output);
} }
@Override @Override

View File

@ -16,13 +16,13 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result; package org.apache.nifi.toolkit.cli.impl.result;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.api.WritableResult; import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils; import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Base class for writable results that have either JSON or simple output. * Base class for writable results that have either JSON or simple output.
@ -34,8 +34,7 @@ public abstract class AbstractWritableResult<T> implements WritableResult<T> {
protected final ResultType resultType; protected final ResultType resultType;
public AbstractWritableResult(final ResultType resultType) { public AbstractWritableResult(final ResultType resultType) {
this.resultType = resultType; this.resultType = Objects.requireNonNull(resultType);
Validate.notNull(resultType);
} }
@Override @Override

View File

@ -16,10 +16,10 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result; package org.apache.nifi.toolkit.cli.impl.result;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.WritableResult; import org.apache.nifi.toolkit.cli.api.WritableResult;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for a single string value. * Result for a single string value.
@ -30,9 +30,8 @@ public class StringResult implements WritableResult<String> {
private final boolean isInteractive; private final boolean isInteractive;
public StringResult(final String value, final boolean isInteractive) { public StringResult(final String value, final boolean isInteractive) {
this.value = value; this.value = Objects.requireNonNull(value);
this.isInteractive = isInteractive; this.isInteractive = isInteractive;
Validate.notNull(this.value);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.AccessPolicyDTO; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -34,8 +34,7 @@ public class AccessPolicyResult extends AbstractWritableResult<AccessPolicyEntit
public AccessPolicyResult(ResultType resultType, AccessPolicyEntity accessPolicyEntity) { public AccessPolicyResult(ResultType resultType, AccessPolicyEntity accessPolicyEntity) {
super(resultType); super(resultType);
this.accessPolicyEntity = accessPolicyEntity; this.accessPolicyEntity = Objects.requireNonNull(accessPolicyEntity);
Validate.notNull(accessPolicyEntity);
} }
@Override @Override

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.ClusteSummaryEntity; import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for CurrentUserEntity from NiFi. * Result for CurrentUserEntity from NiFi.
@ -32,8 +32,7 @@ public class ClusterSummaryEntityResult extends AbstractWritableResult<ClusteSum
public ClusterSummaryEntityResult(final ResultType resultType, final ClusteSummaryEntity clusteSummaryEntity) { public ClusterSummaryEntityResult(final ResultType resultType, final ClusteSummaryEntity clusteSummaryEntity) {
super(resultType); super(resultType);
this.clusteSummaryEntity = clusteSummaryEntity; this.clusteSummaryEntity = Objects.requireNonNull(clusteSummaryEntity);
Validate.notNull(this.clusteSummaryEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils; import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -24,14 +23,14 @@ import org.apache.nifi.web.api.entity.ControllerConfigurationEntity;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class ControllerConfigurationResult extends AbstractWritableResult<ControllerConfigurationEntity> { public class ControllerConfigurationResult extends AbstractWritableResult<ControllerConfigurationEntity> {
private final ControllerConfigurationEntity controllerConfigurationEntity; private final ControllerConfigurationEntity controllerConfigurationEntity;
public ControllerConfigurationResult(final ResultType resultType, final ControllerConfigurationEntity controllerConfigurationEntity) { public ControllerConfigurationResult(final ResultType resultType, final ControllerConfigurationEntity controllerConfigurationEntity) {
super(resultType); super(resultType);
this.controllerConfigurationEntity = controllerConfigurationEntity; this.controllerConfigurationEntity = Objects.requireNonNull(controllerConfigurationEntity);
Validate.notNull(controllerConfigurationEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class ControllerServiceResult extends AbstractWritableResult<ControllerServiceEntity> { public class ControllerServiceResult extends AbstractWritableResult<ControllerServiceEntity> {
@ -32,8 +32,7 @@ public class ControllerServiceResult extends AbstractWritableResult<ControllerSe
public ControllerServiceResult(ResultType resultType, ControllerServiceEntity controllerServiceEntity) { public ControllerServiceResult(ResultType resultType, ControllerServiceEntity controllerServiceEntity) {
super(resultType); super(resultType);
this.controllerServiceEntity = controllerServiceEntity; this.controllerServiceEntity = Objects.requireNonNull(controllerServiceEntity);
Validate.notNull(controllerServiceEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -31,6 +30,7 @@ import java.io.PrintStream;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -43,8 +43,7 @@ public class ControllerServicesResult extends AbstractWritableResult<ControllerS
public ControllerServicesResult(final ResultType resultType, final ControllerServicesEntity controllerServicesEntity) { public ControllerServicesResult(final ResultType resultType, final ControllerServicesEntity controllerServicesEntity) {
super(resultType); super(resultType);
this.controllerServicesEntity = controllerServicesEntity; this.controllerServicesEntity = Objects.requireNonNull(controllerServicesEntity);
Validate.notNull(this.controllerServicesEntity);
} }
@Override @Override

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.CurrentUserEntity; import org.apache.nifi.web.api.entity.CurrentUserEntity;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for CurrentUserEntity from NiFi. * Result for CurrentUserEntity from NiFi.
@ -32,8 +32,7 @@ public class CurrentUserEntityResult extends AbstractWritableResult<CurrentUserE
public CurrentUserEntityResult(final ResultType resultType, final CurrentUserEntity currentUserEntity) { public CurrentUserEntityResult(final ResultType resultType, final CurrentUserEntity currentUserEntity) {
super(resultType); super(resultType);
this.currentUserEntity = currentUserEntity; this.currentUserEntity = Objects.requireNonNull(currentUserEntity);
Validate.notNull(this.currentUserEntity);
} }
@Override @Override

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.CurrentUser; import org.apache.nifi.registry.authorization.CurrentUser;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for CurrentUser from registry. * Result for CurrentUser from registry.
@ -32,8 +32,7 @@ public class CurrentUserResult extends AbstractWritableResult<CurrentUser> {
public CurrentUserResult(final ResultType resultType, final CurrentUser currentUser) { public CurrentUserResult(final ResultType resultType, final CurrentUser currentUser) {
super(resultType); super(resultType);
this.currentUser = currentUser; this.currentUser = Objects.requireNonNull(currentUser);
Validate.notNull(this.currentUser);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.NodeDTO; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class NodeResult extends AbstractWritableResult<NodeEntity> { public class NodeResult extends AbstractWritableResult<NodeEntity> {
@ -31,8 +31,7 @@ public class NodeResult extends AbstractWritableResult<NodeEntity> {
public NodeResult(ResultType resultType, NodeEntity nodeEntity) { public NodeResult(ResultType resultType, NodeEntity nodeEntity) {
super(resultType); super(resultType);
this.nodeEntity = nodeEntity; this.nodeEntity = Objects.requireNonNull(nodeEntity);
Validate.notNull(nodeEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
public class NodesResult extends AbstractWritableResult<ClusterEntity> { public class NodesResult extends AbstractWritableResult<ClusterEntity> {
@ -36,8 +36,7 @@ public class NodesResult extends AbstractWritableResult<ClusterEntity> {
public NodesResult(ResultType resultType, ClusterEntity clusterEntity) { public NodesResult(ResultType resultType, ClusterEntity clusterEntity) {
super(resultType); super(resultType);
this.clusterEntity = clusterEntity; this.clusterEntity = Objects.requireNonNull(clusterEntity);
Validate.notNull(clusterEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver; import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
import org.apache.nifi.toolkit.cli.api.Referenceable; import org.apache.nifi.toolkit.cli.api.Referenceable;
@ -38,6 +37,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -49,7 +49,7 @@ public class ParamContextsResult extends AbstractWritableResult<ParameterContext
public ParamContextsResult(final ResultType resultType, final ParameterContextsEntity parameterContexts) { public ParamContextsResult(final ResultType resultType, final ParameterContextsEntity parameterContexts) {
super(resultType); super(resultType);
this.parameterContexts = Validate.notNull(parameterContexts); this.parameterContexts = Objects.requireNonNull(parameterContexts);
this.results = new ArrayList<>(); this.results = new ArrayList<>();
// If there is a param context that the user doesn't have permissions to then the entity will be returned with // If there is a param context that the user doesn't have permissions to then the entity will be returned with

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.ProcessGroupEntity; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Collections; import java.util.Collections;
import java.util.Objects;
public class ProcessGroupResult extends AbstractWritableResult<ProcessGroupEntity> { public class ProcessGroupResult extends AbstractWritableResult<ProcessGroupEntity> {
@ -31,8 +31,7 @@ public class ProcessGroupResult extends AbstractWritableResult<ProcessGroupEntit
public ProcessGroupResult(final ResultType resultType, final ProcessGroupEntity entity) { public ProcessGroupResult(final ResultType resultType, final ProcessGroupEntity entity) {
super(resultType); super(resultType);
this.entity = entity; this.entity = Objects.requireNonNull(entity);
Validate.notNull(entity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver; import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
import org.apache.nifi.toolkit.cli.api.Referenceable; import org.apache.nifi.toolkit.cli.api.Referenceable;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
@ -45,8 +45,7 @@ public class ProcessGroupsResult extends AbstractWritableResult<List<ProcessGrou
public ProcessGroupsResult(final ResultType resultType, final List<ProcessGroupDTO> processGroups) { public ProcessGroupsResult(final ResultType resultType, final List<ProcessGroupDTO> processGroups) {
super(resultType); super(resultType);
this.processGroups = processGroups; this.processGroups = Objects.requireNonNull(processGroups);
Validate.notNull(this.processGroups);
this.processGroups.sort(Comparator.comparing(ProcessGroupDTO::getName)); this.processGroups.sort(Comparator.comparing(ProcessGroupDTO::getName));
} }

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO; 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.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class ProcessorResult extends AbstractWritableResult<ProcessorEntity> { public class ProcessorResult extends AbstractWritableResult<ProcessorEntity> {
@ -32,8 +32,7 @@ public class ProcessorResult extends AbstractWritableResult<ProcessorEntity> {
public ProcessorResult(ResultType resultType, ProcessorEntity processorEntity) { public ProcessorResult(ResultType resultType, ProcessorEntity processorEntity) {
super(resultType); super(resultType);
this.processorEntity = processorEntity; this.processorEntity = Objects.requireNonNull(processorEntity);
Validate.notNull(processorEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -30,6 +29,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -39,8 +39,7 @@ public class ProcessorsResult extends AbstractWritableResult<ProcessorsEntity> {
public ProcessorsResult(ResultType resultType, ProcessorsEntity processorsEntity) { public ProcessorsResult(ResultType resultType, ProcessorsEntity processorsEntity) {
super(resultType); super(resultType);
this.processorsEntity = processorsEntity; this.processorsEntity = Objects.requireNonNull(processorsEntity);
Validate.notNull(processorsEntity);
} }
@Override @Override

View File

@ -16,12 +16,12 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.FlowRegistryClientDTO; import org.apache.nifi.web.api.dto.FlowRegistryClientDTO;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class RegistryClientIDResult extends AbstractWritableResult<FlowRegistryClientDTO> { public class RegistryClientIDResult extends AbstractWritableResult<FlowRegistryClientDTO> {
@ -29,8 +29,7 @@ public class RegistryClientIDResult extends AbstractWritableResult<FlowRegistryC
public RegistryClientIDResult(final ResultType resultType, final FlowRegistryClientDTO flowRegistryClientDTO) { public RegistryClientIDResult(final ResultType resultType, final FlowRegistryClientDTO flowRegistryClientDTO) {
super(resultType); super(resultType);
this.flowRegistryClientDTO = flowRegistryClientDTO; this.flowRegistryClientDTO = Objects.requireNonNull(flowRegistryClientDTO);
Validate.notNull(this.flowRegistryClientDTO);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -29,6 +28,7 @@ import org.apache.nifi.web.api.entity.FlowRegistryClientsEntity;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -41,8 +41,7 @@ public class RegistryClientsResult extends AbstractWritableResult<FlowRegistryCl
public RegistryClientsResult(final ResultType resultType, final FlowRegistryClientsEntity registryClients) { public RegistryClientsResult(final ResultType resultType, final FlowRegistryClientsEntity registryClients) {
super(resultType); super(resultType);
this.registryClients = registryClients; this.registryClients = Objects.requireNonNull(registryClients);
Validate.notNull(this.registryClients);
} }
@Override @Override

View File

@ -17,7 +17,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO; import org.apache.nifi.web.api.dto.BundleDTO;
@ -26,6 +25,7 @@ import org.apache.nifi.web.api.entity.ReportingTaskEntity;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
public class ReportingTaskResult extends AbstractWritableResult<ReportingTaskEntity> { public class ReportingTaskResult extends AbstractWritableResult<ReportingTaskEntity> {
@ -33,8 +33,7 @@ public class ReportingTaskResult extends AbstractWritableResult<ReportingTaskEnt
public ReportingTaskResult(final ResultType resultType, final ReportingTaskEntity reportingTaskEntity) { public ReportingTaskResult(final ResultType resultType, final ReportingTaskEntity reportingTaskEntity) {
super(resultType); super(resultType);
this.reportingTaskEntity = reportingTaskEntity; this.reportingTaskEntity = Objects.requireNonNull(reportingTaskEntity);
Validate.notNull(reportingTaskEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -30,6 +29,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -42,8 +42,7 @@ public class ReportingTasksResult extends AbstractWritableResult<ReportingTasksE
public ReportingTasksResult(final ResultType resultType, final ReportingTasksEntity reportingTasksEntity) { public ReportingTasksResult(final ResultType resultType, final ReportingTasksEntity reportingTasksEntity) {
super(resultType); super(resultType);
this.reportingTasksEntity = reportingTasksEntity; this.reportingTasksEntity = Objects.requireNonNull(reportingTasksEntity);
Validate.notNull(this.reportingTasksEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; 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.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -43,8 +43,7 @@ public class UserGroupsResult extends AbstractWritableResult<UserGroupsEntity> {
public UserGroupsResult(final ResultType resultType, final UserGroupsEntity userGroupsEntity) { public UserGroupsResult(final ResultType resultType, final UserGroupsEntity userGroupsEntity) {
super(resultType); super(resultType);
this.userGroupsEntity = userGroupsEntity; this.userGroupsEntity = Objects.requireNonNull(userGroupsEntity);
Validate.notNull(this.userGroupsEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; 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.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -43,8 +43,7 @@ public class UsersResult extends AbstractWritableResult<UsersEntity> {
public UsersResult(final ResultType resultType, final UsersEntity usersEntity) { public UsersResult(final ResultType resultType, final UsersEntity usersEntity) {
super(resultType); super(resultType);
this.usersEntity = usersEntity; this.usersEntity = Objects.requireNonNull(usersEntity);
Validate.notNull(this.usersEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; 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.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -41,8 +41,7 @@ public class VariableRegistryResult extends AbstractWritableResult<VariableRegis
public VariableRegistryResult(final ResultType resultType, final VariableRegistryEntity variableRegistryEntity) { public VariableRegistryResult(final ResultType resultType, final VariableRegistryEntity variableRegistryEntity) {
super(resultType); super(resultType);
this.variableRegistryEntity = variableRegistryEntity; this.variableRegistryEntity = Objects.requireNonNull(variableRegistryEntity);
Validate.notNull(this.variableRegistryEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.nifi; 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.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult; import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter; import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -26,6 +25,7 @@ import org.apache.nifi.web.api.dto.VersionControlInformationDTO;
import org.apache.nifi.web.api.entity.VersionControlInformationEntity; import org.apache.nifi.web.api.entity.VersionControlInformationEntity;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for VersionControlInformationEntity. * Result for VersionControlInformationEntity.
@ -37,8 +37,7 @@ public class VersionControlInfoResult extends AbstractWritableResult<VersionCont
public VersionControlInfoResult(final ResultType resultType, public VersionControlInfoResult(final ResultType resultType,
final VersionControlInformationEntity versionControlInformationEntity) { final VersionControlInformationEntity versionControlInformationEntity) {
super(resultType); super(resultType);
this.versionControlInformationEntity = versionControlInformationEntity; this.versionControlInformationEntity = Objects.requireNonNull(versionControlInformationEntity);
Validate.notNull(this.versionControlInformationEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.AccessPolicy; import org.apache.nifi.registry.authorization.AccessPolicy;
import org.apache.nifi.registry.authorization.Tenant; import org.apache.nifi.registry.authorization.Tenant;
import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.api.ResultType;
@ -24,6 +23,7 @@ import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -32,8 +32,7 @@ public class AccessPolicyResult extends AbstractWritableResult<AccessPolicy> {
public AccessPolicyResult(ResultType resultType, AccessPolicy accessPolicy) { public AccessPolicyResult(ResultType resultType, AccessPolicy accessPolicy) {
super(resultType); super(resultType);
this.accessPolicy = accessPolicy; this.accessPolicy = Objects.requireNonNull(accessPolicy);
Validate.notNull(accessPolicy);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.bucket.Bucket;
import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver; import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
@ -45,8 +45,7 @@ public class BucketsResult extends AbstractWritableResult<List<Bucket>> implemen
public BucketsResult(final ResultType resultType, final List<Bucket> buckets) { public BucketsResult(final ResultType resultType, final List<Bucket> buckets) {
super(resultType); super(resultType);
this.buckets = buckets; this.buckets = Objects.requireNonNull(buckets);
Validate.notNull(buckets);
// NOTE: it is important that the order the buckets are printed is the same order for the ReferenceResolver // 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)); this.buckets.sort(Comparator.comparing(Bucket::getName));

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.extension.ExtensionMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
public class ExtensionMetadataResult extends AbstractWritableResult<List<ExtensionMetadata>> { public class ExtensionMetadataResult extends AbstractWritableResult<List<ExtensionMetadata>> {
@ -34,8 +34,7 @@ public class ExtensionMetadataResult extends AbstractWritableResult<List<Extensi
public ExtensionMetadataResult(final ResultType resultType, final List<ExtensionMetadata> extensionMetadata) { public ExtensionMetadataResult(final ResultType resultType, final List<ExtensionMetadata> extensionMetadata) {
super(resultType); super(resultType);
this.extensionMetadata = extensionMetadata; this.extensionMetadata = Objects.requireNonNull(this.extensionMetadata);
Validate.notNull(this.extensionMetadata);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.extension.repo.ExtensionRepoArtifact;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Result for list of bundle artifacts. * Result for list of bundle artifacts.
@ -38,8 +38,7 @@ public class ExtensionRepoArtifactsResult extends AbstractWritableResult<List<Ex
public ExtensionRepoArtifactsResult(final ResultType resultType, final List<ExtensionRepoArtifact> bundleArtifacts) { public ExtensionRepoArtifactsResult(final ResultType resultType, final List<ExtensionRepoArtifact> bundleArtifacts) {
super(resultType); super(resultType);
this.bundleArtifacts = bundleArtifacts; this.bundleArtifacts = Objects.requireNonNull(bundleArtifacts);
Validate.notNull(this.bundleArtifacts);
this.bundleArtifacts.sort( this.bundleArtifacts.sort(
Comparator.comparing(ExtensionRepoArtifact::getBucketName) Comparator.comparing(ExtensionRepoArtifact::getBucketName)

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.extension.repo.ExtensionRepoGroup;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Result for list of bundle groups. * Result for list of bundle groups.
@ -38,8 +38,7 @@ public class ExtensionRepoGroupsResult extends AbstractWritableResult<List<Exten
public ExtensionRepoGroupsResult(final ResultType resultType, final List<ExtensionRepoGroup> bundleGroups) { public ExtensionRepoGroupsResult(final ResultType resultType, final List<ExtensionRepoGroup> bundleGroups) {
super(resultType); super(resultType);
this.bundleGroups = bundleGroups; this.bundleGroups = Objects.requireNonNull(bundleGroups);
Validate.notNull(this.bundleGroups);
this.bundleGroups.sort( this.bundleGroups.sort(
Comparator.comparing(ExtensionRepoGroup::getBucketName) Comparator.comparing(ExtensionRepoGroup::getBucketName)

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.extension.repo.ExtensionRepoVersionSummary;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult<List<ExtensionRepoVersionSummary>> { public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult<List<ExtensionRepoVersionSummary>> {
@ -34,8 +34,7 @@ public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult<
public ExtensionRepoVersionSummariesResult(final ResultType resultType, final List<ExtensionRepoVersionSummary> bundleVersions) { public ExtensionRepoVersionSummariesResult(final ResultType resultType, final List<ExtensionRepoVersionSummary> bundleVersions) {
super(resultType); super(resultType);
this.bundleVersions = bundleVersions; this.bundleVersions = Objects.requireNonNull(bundleVersions);
Validate.notNull(this.bundleVersions);
this.bundleVersions.sort( this.bundleVersions.sort(
Comparator.comparing(ExtensionRepoVersionSummary::getBucketName) Comparator.comparing(ExtensionRepoVersionSummary::getBucketName)

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.flow.VersionedFlowSnapshotMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.PrintStream;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Result for a list of RegisteredFlowSnapshotMetadata. * Result for a list of RegisteredFlowSnapshotMetadata.
@ -38,8 +38,7 @@ public class RegisteredFlowSnapshotMetadataResult extends AbstractWritableResult
public RegisteredFlowSnapshotMetadataResult(final ResultType resultType, final List<VersionedFlowSnapshotMetadata> versions) { public RegisteredFlowSnapshotMetadataResult(final ResultType resultType, final List<VersionedFlowSnapshotMetadata> versions) {
super(resultType); super(resultType);
this.versions = versions; this.versions = Objects.requireNonNull(versions);
Validate.notNull(this.versions);
this.versions.sort(Comparator.comparing(VersionedFlowSnapshotMetadata::getVersion)); this.versions.sort(Comparator.comparing(VersionedFlowSnapshotMetadata::getVersion));
} }

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.extension.TagCount;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
public class TagCountResult extends AbstractWritableResult<List<TagCount>> { public class TagCountResult extends AbstractWritableResult<List<TagCount>> {
@ -34,8 +34,7 @@ public class TagCountResult extends AbstractWritableResult<List<TagCount>> {
public TagCountResult(ResultType resultType, final List<TagCount> tagCounts) { public TagCountResult(ResultType resultType, final List<TagCount> tagCounts) {
super(resultType); super(resultType);
this.tagCounts = tagCounts; this.tagCounts = Objects.requireNonNull(tagCounts);
Validate.notNull(this.tagCounts);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.Tenant;
import org.apache.nifi.registry.authorization.UserGroup; import org.apache.nifi.registry.authorization.UserGroup;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -38,8 +38,7 @@ public class UserGroupsResult extends AbstractWritableResult<List<UserGroup>> {
public UserGroupsResult(final ResultType resultType, final List<UserGroup> userGroups) { public UserGroupsResult(final ResultType resultType, final List<UserGroup> userGroups) {
super(resultType); super(resultType);
this.userGroups = userGroups; this.userGroups = Objects.requireNonNull(userGroups);
Validate.notNull(userGroups);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.authorization.User;
import org.apache.nifi.toolkit.cli.api.ResultType; 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.AbstractWritableResult;
@ -26,6 +25,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Result for a list of users. * Result for a list of users.
@ -35,8 +35,7 @@ public class UsersResult extends AbstractWritableResult<List<User>> {
public UsersResult(ResultType resultType, List<User> users) { public UsersResult(ResultType resultType, List<User> users) {
super(resultType); super(resultType);
this.users = users; this.users = Objects.requireNonNull(users);
Validate.notNull(users);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.ComponentDifference;
import org.apache.nifi.registry.diff.ComponentDifferenceGroup; import org.apache.nifi.registry.diff.ComponentDifferenceGroup;
import org.apache.nifi.registry.diff.VersionedFlowDifference; import org.apache.nifi.registry.diff.VersionedFlowDifference;
@ -32,6 +31,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
public class VersionedFlowDifferenceResult extends AbstractWritableResult<VersionedFlowDifference> { public class VersionedFlowDifferenceResult extends AbstractWritableResult<VersionedFlowDifference> {
@ -39,7 +39,7 @@ public class VersionedFlowDifferenceResult extends AbstractWritableResult<Versio
public VersionedFlowDifferenceResult(final ResultType resultType, final VersionedFlowDifference flowDifference) { public VersionedFlowDifferenceResult(final ResultType resultType, final VersionedFlowDifference flowDifference) {
super(resultType); super(resultType);
this.flowDifference = Validate.notNull(flowDifference); this.flowDifference = Objects.requireNonNull(flowDifference);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.RegisteredFlowSnapshotMetadata; import org.apache.nifi.registry.flow.RegisteredFlowSnapshotMetadata;
import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata; import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType; import org.apache.nifi.toolkit.cli.api.ResultType;
@ -28,6 +27,7 @@ import org.apache.nifi.web.api.entity.VersionedFlowSnapshotMetadataSetEntity;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -41,8 +41,7 @@ public class VersionedFlowSnapshotMetadataSetResult extends AbstractWritableResu
public VersionedFlowSnapshotMetadataSetResult(final ResultType resultType, public VersionedFlowSnapshotMetadataSetResult(final ResultType resultType,
final VersionedFlowSnapshotMetadataSetEntity versionedFlowSnapshotMetadataSetEntity) { final VersionedFlowSnapshotMetadataSetEntity versionedFlowSnapshotMetadataSetEntity) {
super(resultType); super(resultType);
this.versionedFlowSnapshotMetadataSetEntity = versionedFlowSnapshotMetadataSetEntity; this.versionedFlowSnapshotMetadataSetEntity = Objects.requireNonNull(versionedFlowSnapshotMetadataSetEntity);
Validate.notNull(this.versionedFlowSnapshotMetadataSetEntity);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlowSnapshot; import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
import org.apache.nifi.toolkit.cli.api.WritableResult; import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils; import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -25,6 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
/** /**
* Result for a VersionedFlowSnapshot. * Result for a VersionedFlowSnapshot.
@ -42,9 +42,8 @@ public class VersionedFlowSnapshotResult implements WritableResult<VersionedFlow
private final String exportFileName; private final String exportFileName;
public VersionedFlowSnapshotResult(final VersionedFlowSnapshot versionedFlowSnapshot, final String exportFileName) { public VersionedFlowSnapshotResult(final VersionedFlowSnapshot versionedFlowSnapshot, final String exportFileName) {
this.versionedFlowSnapshot = versionedFlowSnapshot; this.versionedFlowSnapshot = Objects.requireNonNull(versionedFlowSnapshot);
this.exportFileName = exportFileName; this.exportFileName = exportFileName;
Validate.notNull(this.versionedFlowSnapshot);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlowSnapshot; import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
import org.apache.nifi.toolkit.cli.api.WritableResult; import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils; import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -27,6 +26,7 @@ import java.io.PrintStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Iterator; import java.util.Iterator;
import java.util.Objects;
/** /**
* Result for a list of VersionedFlowSnapshots. * Result for a list of VersionedFlowSnapshots.
@ -47,9 +47,8 @@ public class VersionedFlowSnapshotsResult implements WritableResult<Iterator<Ver
private final String exportDirectoryName; private final String exportDirectoryName;
public VersionedFlowSnapshotsResult(final Iterator<VersionedFlowSnapshot> versionedFlowSnapshots, final String exportDirectoryName) { public VersionedFlowSnapshotsResult(final Iterator<VersionedFlowSnapshot> versionedFlowSnapshots, final String exportDirectoryName) {
this.versionedFlowSnapshots = versionedFlowSnapshots; this.versionedFlowSnapshots = Objects.requireNonNull(versionedFlowSnapshots);
this.exportDirectoryName = exportDirectoryName; this.exportDirectoryName = exportDirectoryName;
Validate.notNull(this.versionedFlowSnapshots);
} }
@Override @Override

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.result.registry; 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.registry.flow.VersionedFlow;
import org.apache.nifi.toolkit.cli.api.Context; import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver; import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
@ -45,8 +45,7 @@ public class VersionedFlowsResult extends AbstractWritableResult<List<VersionedF
public VersionedFlowsResult(final ResultType resultType, final List<VersionedFlow> flows) { public VersionedFlowsResult(final ResultType resultType, final List<VersionedFlow> flows) {
super(resultType); super(resultType);
this.versionedFlows = flows; this.versionedFlows = Objects.requireNonNull(flows);
Validate.notNull(this.versionedFlows);
// NOTE: it is important that the order the flows are printed is the same order for the ReferenceResolver // 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)); this.versionedFlows.sort(Comparator.comparing(VersionedFlow::getName));

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.nifi.toolkit.cli.impl.session; 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.Session;
import org.apache.nifi.toolkit.cli.api.SessionException; import org.apache.nifi.toolkit.cli.api.SessionException;
@ -26,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Objects;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
@ -36,10 +36,8 @@ public class PersistentSession implements Session {
private final Session wrappedSession; private final Session wrappedSession;
public PersistentSession(final File persistenceFile, final Session wrappedSession) { public PersistentSession(final File persistenceFile, final Session wrappedSession) {
this.persistenceFile = persistenceFile; this.persistenceFile = Objects.requireNonNull(persistenceFile);
this.wrappedSession = wrappedSession; this.wrappedSession = Objects.requireNonNull(wrappedSession);
Validate.notNull(persistenceFile);
Validate.notNull(wrappedSession);
} }
@Override @Override