Skip to content

Commit

Permalink
NIFI-9618 Upgraded Checkstyle to 9.2.1
Browse files Browse the repository at this point in the history
- Corrected several missing return statements
- Increased Maven heap size to 3 GB for ci-workflow

This closes apache#5700

Signed-off-by: David Handermann <[email protected]>
  • Loading branch information
exceptionfactory committed Jan 22, 2022
1 parent 3d05844 commit e224350
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on: [push, pull_request]

env:
DEFAULT_MAVEN_OPTS: >-
-Xmx2g
-Xmx3g
-XX:ReservedCodeCacheSize=1g
-XX:+UseG1GC
-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static boolean fileExists(String filename) {
* This would indicate that the user intends to auto-generate a keystore and truststore, rather than
* using their existing kestore and truststore.
* @param nifiProperties The nifi properties
* @return
* @return HTTPS Security Configured status
*/
private static boolean isHttpsSecurityConfiguredWithEmptyPasswords(final Properties nifiProperties) {
if (StringUtils.isEmpty(nifiProperties.getProperty(NiFiProperties.WEB_HTTPS_PORT, StringUtils.EMPTY))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static class HashiCorpVaultPropertiesBuilder {
* Set the Vault URI (e.g., http://localhost:8200). If using https protocol, the KeyStore and TrustStore
* properties are expected to also be set.
* @param uri Vault's URI
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setUri(String uri) {
this.uri = uri;
Expand All @@ -123,7 +123,7 @@ public HashiCorpVaultPropertiesBuilder setUri(String uri) {
/**
* Sets the path to the keyStore.
* @param keyStore Path to the keyStore
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setKeyStore(String keyStore) {
this.keyStore = keyStore;
Expand All @@ -133,7 +133,7 @@ public HashiCorpVaultPropertiesBuilder setKeyStore(String keyStore) {
/**
* Sets keyStore type (e.g., JKS, PKCS12).
* @param keyStoreType KeyStore type
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setKeyStoreType(String keyStoreType) {
this.keyStoreType = keyStoreType;
Expand All @@ -143,7 +143,7 @@ public HashiCorpVaultPropertiesBuilder setKeyStoreType(String keyStoreType) {
/**
* Sets the keyStore password.
* @param keyStorePassword KeyStore password
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setKeyStorePassword(String keyStorePassword) {
this.keyStorePassword = keyStorePassword;
Expand All @@ -153,7 +153,7 @@ public HashiCorpVaultPropertiesBuilder setKeyStorePassword(String keyStorePasswo
/**
* Sets the path to the trustStore.
* @param trustStore Path to the trustStore
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setTrustStore(String trustStore) {
this.trustStore = trustStore;
Expand All @@ -163,7 +163,7 @@ public HashiCorpVaultPropertiesBuilder setTrustStore(String trustStore) {
/**
* Sets the trustStore type (e.g., JKS, PKCS12).
* @param trustStoreType TrustStore type
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setTrustStoreType(String trustStoreType) {
this.trustStoreType = trustStoreType;
Expand All @@ -173,7 +173,7 @@ public HashiCorpVaultPropertiesBuilder setTrustStoreType(String trustStoreType)
/**
* Sets the trustStore passsword.
* @param trustStorePassword TrustStore password
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setTrustStorePassword(String trustStorePassword) {
this.trustStorePassword = trustStorePassword;
Expand All @@ -188,7 +188,7 @@ public HashiCorpVaultPropertiesBuilder setTrustStorePassword(String trustStorePa
* https://docs.spring.io/spring-vault/docs/2.3.1/reference/html/#vault.core.environment-vault-configuration</a>
* @param authPropertiesFilename The filename of a properties file containing Spring Vault authentication
* properties
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setAuthPropertiesFilename(String authPropertiesFilename) {
this.authPropertiesFilename = authPropertiesFilename;
Expand All @@ -198,7 +198,7 @@ public HashiCorpVaultPropertiesBuilder setAuthPropertiesFilename(String authProp
/**
* Sets an optional comma-separated list of enabled TLS cipher suites.
* @param enabledTlsCipherSuites Enabled TLS cipher suites (only these will be enabled)
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setEnabledTlsCipherSuites(String enabledTlsCipherSuites) {
this.enabledTlsCipherSuites = enabledTlsCipherSuites;
Expand All @@ -208,7 +208,7 @@ public HashiCorpVaultPropertiesBuilder setEnabledTlsCipherSuites(String enabledT
/**
* Sets an optional comma-separated list of enabled TLS protocols.
* @param enabledTlsProtocols Enabled TLS protocols (only these will be enabled)
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setEnabledTlsProtocols(String enabledTlsProtocols) {
this.enabledTlsProtocols = enabledTlsProtocols;
Expand All @@ -218,7 +218,7 @@ public HashiCorpVaultPropertiesBuilder setEnabledTlsProtocols(String enabledTlsP
/**
* Sets the connection timeout for the HTTP client, using the standard NiFi duration format (e.g., 5 secs)
* @param connectionTimeout Connection timeout (default is 5 secs)
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setConnectionTimeout(String connectionTimeout) {
this.connectionTimeout = connectionTimeout;
Expand All @@ -228,7 +228,7 @@ public HashiCorpVaultPropertiesBuilder setConnectionTimeout(String connectionTim
/**
* Sets the read timeout for the HTTP client, using the standard NiFi duration format (e.g., 15 secs).
* @param readTimeout Read timeout (default is 15 secs)
* @return
* @return Builder
*/
public HashiCorpVaultPropertiesBuilder setReadTimeout(String readTimeout) {
this.readTimeout = readTimeout;
Expand All @@ -237,7 +237,7 @@ public HashiCorpVaultPropertiesBuilder setReadTimeout(String readTimeout) {

/**
* Build the VaultProperties.
* @return
* @return Builder
*/
public HashiCorpVaultProperties build() {
return new HashiCorpVaultProperties(uri, keyStore, keyStoreType, keyStorePassword, trustStore, trustStoreType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Object getProperty(final String key) {
/**
* Converts key names from format test-value to testValue
* @param springPropertyKey A Spring Vault property key
* @return
* @return Property Key
*/
private String getPropertyKey(String springPropertyKey) {
final Matcher m = DASH_LETTER_PATTERN.matcher(springPropertyKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static TestRunner newTestRunner(final Processor processor) {
* Returns a {@code TestRunner} for the given {@code Processor} which uses the given {@code KerberosContext}.
* @param processor the {@code Processor} under test
* @param kerberosContext the {@code KerberosContext} used during the test
* @return
* @return a {@code TestRunner}
*/
public static TestRunner newTestRunner(final Processor processor, KerberosContext kerberosContext) {
return newTestRunner(processor,processor.getClass().getName(), kerberosContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public void onTrigger(ProcessContext processContext, ProcessSession processSessi
* @param columnQualifier column qualifier from which to extract the visibility or to execute an expression against
* @param flowFile flow file being written
* @param context process context
* @return
* @return Visibility
*/
public static String produceVisibility(String columnFamily, String columnQualifier, FlowFile flowFile, ProcessContext context) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(columnFamily)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public EasyRulesEngine(String rulesFileFormat, boolean ignoreConditionErrors, bo
* Return the list of actions what should be executed for a given set of facts
*
* @param facts a Map of key and facts values, as objects, that should be evaluated by the rules engine
* @return
* @return List of Actions
*/
@Override
public List<Action> fireRules(Map<String, Object> facts) {
Expand All @@ -81,7 +81,7 @@ public List<Action> fireRules(Map<String, Object> facts) {
* Return a Map with Rule as a key and Boolean as a value indicating that the rule's conditions were met
*
* @param facts Map of keys and values contains facts to evaluate against rules
* @return
* @return Map of Rules
*/
@Override
public Map<Rule, Boolean> checkRules(Map<String, Object> facts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EasyRulesEngineProvider extends AbstractEasyRulesEngineController i

/**
* Returns a rules engine instance
* @return
* @return Rules Engine
*/
@Override
public RulesEngine getRulesEngine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void onEnabled(final ConfigurationContext context) throws InitializationE
/**
* Return the list of actions what should be executed for a given set of facts
* @param facts a Map of key and facts values, as objects, that should be evaluated by the rules engine
* @return
* @return List of Actions
*/
@Override
public List<Action> fireRules(Map<String, Object> facts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ private int createFlowFilesForEntities(final ProcessContext context, final Proce
* If TARGET_SYSTEM_TIMESTAMP_PRECISION is supported as a valid Processor property,
* then PRECISION_AUTO_DETECT will be the default value when not specified by a user.
*
* @return
* @return Default Time Precision
*/
protected String getDefaultTimePrecision() {
return TARGET_SYSTEM_TIMESTAMP_PRECISION.getDefaultValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public StatusAnalyticsModelMapFactory(ExtensionManager extensionManager, NiFiPro

/**
* Return mapping of models and extraction functions for connection status analytics prediction instances
* @return
* @return Connection Status Model Map
*/
public Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> getConnectionStatusModelMap(){
Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> modelMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static List<String> extractIPsFromNetworkInterfaces(NiFiProperties niFiPropertie
*
* @param networkInterfaces the map of properties to bindings
* ({@code ["nifi.web.http.network.interface.first":"eth0"]})
* @return
* @return Not Defined status
*/
static boolean isNotDefined(Map<String, String> networkInterfaces) {
return networkInterfaces == null || networkInterfaces.isEmpty() || networkInterfaces.values().stream().filter(value -> !Strings.isNullOrEmpty(value)).collect(Collectors.toList()).isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ protected String getGroup(final ProcessContext context, final FlowFile flowFile)
* Returns an optional with the first throwable in the causal chain that is assignable to the provided cause type,
* and satisfies the provided cause predicate, {@link Optional#empty()} otherwise.
* @param t The throwable to inspect for the cause.
* @return
* @return Throwable Cause
*/
private <T extends Throwable> Optional<T> findCause(Throwable t, Class<T> expectedCauseType, Predicate<T> causePredicate) {
Stream<Throwable> causalChain = Throwables.getCausalChain(t).stream();
Expand Down
12 changes: 0 additions & 12 deletions nifi-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,18 +328,6 @@
<additionalJOption>-J-Xmx512m</additionalJOption>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.31</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.29</version>
<version>9.2.1</version>
</dependency>
</dependencies>
</plugin>
Expand Down

0 comments on commit e224350

Please sign in to comment.