diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 44e897e61f..9083deebcd 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -23,7 +23,6 @@ env: DEFAULT_MAVEN_OPTS: >- -Xmx4g -XX:ReservedCodeCacheSize=1g - -XX:+UseG1GC -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Daether.connector.http.retryHandler.count=5 -Daether.connector.http.connectionMaxTtl=30 @@ -37,25 +36,6 @@ env: --no-snapshot-updates --no-transfer-progress --fail-fast - -pl -:minifi-integration-tests - -pl -:minifi-assembly - -pl -:nifi-assembly - -pl -:nifi-toolkit-assembly - -pl -:nifi-registry-assembly - -pl -:nifi-registry-toolkit-assembly - -pl -:nifi-runtime-manifest - -pl -:nifi-runtime-manifest-test - -pl -:nifi-stateless-assembly - -pl -:nifi-stateless-system-test-suite - -pl -:nifi-system-test-suite - -pl -:nifi-nar-provider-assembly - -pl -:nifi-py4j-integration-tests - -pl -:nifi-server-nar - -pl -:nifi-ui - -pl -:nifi-jolt-nar - -pl -:nifi-jolt-transform-json-ui - -pl -:nifi-standard-content-viewer-nar - -pl -:nifi-standard-content-viewer MAVEN_VERIFY_COMMAND: >- verify --show-version @@ -63,15 +43,6 @@ env: --no-transfer-progress --fail-fast -D dir-only - MAVEN_BUILD_PROFILES: >- - -P skip-nifi-bin-assembly - MAVEN_PROJECTS: >- - -pl -minifi/minifi-assembly - -pl -minifi/minifi-toolkit/minifi-toolkit-assembly - -pl -nifi-registry/nifi-registry-assembly - -pl -nifi-registry/nifi-registry-toolkit/nifi-registry-toolkit-assembly - -pl -nifi-stateless/nifi-stateless-assembly - -pl -nifi-toolkit/nifi-toolkit-assembly concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -124,8 +95,10 @@ jobs: env: MAVEN_OPTS: >- ${{ env.COMPILE_MAVEN_OPTS }} + # Run PMD Check with compile phase to resolve modules run: > ${{ env.MAVEN_COMMAND }} + pmd:check ${{ env.MAVEN_COMPILE_COMMAND }} - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 @@ -188,10 +161,8 @@ jobs: -Dfrontend.skipTests=${{ steps.changes.outputs.frontend == 'true' && 'false' || 'true' }} run: > ${{ env.MAVEN_COMMAND }} - ${{ env.MAVEN_VERIFY_COMMAND }} - ${{ env.MAVEN_BUILD_PROFILES }} + ${{ env.MAVEN_VERIFY_COMMAND }} -P python-unit-tests - ${{ env.MAVEN_PROJECTS }} - name: Upload Test Reports uses: actions/upload-artifact@v4 with: @@ -266,9 +237,7 @@ jobs: run: >- ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_VERIFY_COMMAND }} - ${{ env.MAVEN_BUILD_PROFILES }} -P python-unit-tests - ${{ env.MAVEN_PROJECTS }} - name: Upload Test Reports uses: actions/upload-artifact@v4 with: @@ -341,8 +310,6 @@ jobs: run: >- ${{ env.MAVEN_COMMAND_WINDOWS }} ${{ env.MAVEN_VERIFY_COMMAND }} - ${{ env.MAVEN_BUILD_PROFILES }} - ${{ env.MAVEN_PROJECTS }} - name: Upload Test Reports uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml index 17c39816a0..044d548e89 100644 --- a/.github/workflows/docker-tests.yml +++ b/.github/workflows/docker-tests.yml @@ -61,6 +61,7 @@ env: install MAVEN_BUILD_PROJECTS: >- -pl nifi-assembly + -pl nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly -pl nifi-registry/nifi-registry-assembly -pl nifi-toolkit/nifi-toolkit-assembly -pl minifi/minifi-assembly @@ -70,6 +71,7 @@ env: clean MAVEN_CLEAN_PROJECTS: >- -pl -nifi-assembly + -pl -nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly -pl -nifi-registry/nifi-registry-assembly -pl -nifi-toolkit/nifi-toolkit-assembly -pl -nifi-toolkit/nifi-toolkit-cli diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java index c0fe2ce527..6947663135 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/PropertyDescriptor.java @@ -34,6 +34,7 @@ public class PropertyDescriptor implements Serializable { private boolean required; private boolean sensitive; private ExpressionLanguageScope expressionLanguageScope = ExpressionLanguageScope.NONE; + @SuppressWarnings("PMD.UnusedPrivateField") private String expressionLanguageScopeDescription = ExpressionLanguageScope.NONE.getDescription(); private DefinedType typeProvidedByValue; private String validRegex; diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/SensitiveProperty.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/SensitiveProperty.java index 84c7fbf473..adb3ed672a 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/SensitiveProperty.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/SensitiveProperty.java @@ -32,7 +32,7 @@ public enum SensitiveProperty { NIFI_MINIFI_SECURITY_TRUSTSTORE_PASSWORD("nifi.minifi.security.truststorePasswd"), NIFI_MINIFI_SENSITIVE_PROPS_KEY("nifi.minifi.sensitive.props.key"); - public static final Set SENSITIVE_PROPERTIES = Arrays.stream(SensitiveProperty.values()).map(SensitiveProperty::getKey) + public static final Set SENSITIVE_PROPERTIES = Arrays.stream(values()).map(SensitiveProperty::getKey) .collect(collectingAndThen(toSet(), Collections::unmodifiableSet)); private final String key; diff --git a/minifi/minifi-commons/minifi-commons-api/src/main/java/org/apache/nifi/minifi/commons/api/MiNiFiProperties.java b/minifi/minifi-commons/minifi-commons-api/src/main/java/org/apache/nifi/minifi/commons/api/MiNiFiProperties.java index 34a58bcec3..94c43d58a9 100644 --- a/minifi/minifi-commons/minifi-commons-api/src/main/java/org/apache/nifi/minifi/commons/api/MiNiFiProperties.java +++ b/minifi/minifi-commons/minifi-commons-api/src/main/java/org/apache/nifi/minifi/commons/api/MiNiFiProperties.java @@ -139,7 +139,7 @@ public enum MiNiFiProperties { } public static LinkedHashMap sortedPropertiesByKey() { - return Arrays.stream(MiNiFiProperties.values()) + return Arrays.stream(values()) .sorted() .collect(Collectors.toMap(MiNiFiProperties::getKey, Function.identity(), (x, y) -> y, LinkedHashMap::new)); } diff --git a/minifi/minifi-docs/pom.xml b/minifi/minifi-docs/pom.xml index ee09c65f2f..ed4653c282 100644 --- a/minifi/minifi-docs/pom.xml +++ b/minifi/minifi-docs/pom.xml @@ -30,7 +30,7 @@ copy-markdown - generate-resources + process-resources copy-resources @@ -57,7 +57,7 @@ single - package + process-resources src/main/assembly/dependencies.xml diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/syncresource/FileResourceRepository.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/syncresource/FileResourceRepository.java index 1874728782..5b5ca5b622 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/syncresource/FileResourceRepository.java +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/syncresource/FileResourceRepository.java @@ -31,7 +31,6 @@ import static java.nio.file.StandardOpenOption.SYNC; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static java.nio.file.StandardOpenOption.WRITE; import static java.util.Optional.empty; -import static java.util.Optional.of; import static java.util.Optional.ofNullable; import static java.util.function.Predicate.not; import static java.util.stream.Collectors.toList; @@ -115,7 +114,7 @@ public class FileResourceRepository implements ResourceRepository { newItems.add(resourceItem); ResourceRepositoryDescriptor newRepositoryDescriptor = new ResourceRepositoryDescriptor(resourceRepositoryDescriptor.resourcesGlobalHash(), newItems); persist(newRepositoryDescriptor); - return of(resourceItem); + return Optional.of(resourceItem); } catch (IOException e) { LOG.error("Unable to persist repository metadata", e); return empty(); diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/pom.xml b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/pom.xml index 14fa43104e..f5bf958811 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/pom.xml +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/pom.xml @@ -38,7 +38,7 @@ limitations under the License. single - package + process-resources src/main/assembly/dependencies.xml diff --git a/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/common/BaseSchemaWithId.java b/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/common/BaseSchemaWithId.java index aa59190d68..62b68aa83e 100644 --- a/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/common/BaseSchemaWithId.java +++ b/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/common/BaseSchemaWithId.java @@ -61,9 +61,9 @@ public class BaseSchemaWithId extends BaseSchema implements WritableSchema { public List getValidationIssues() { List validationIssues = super.getValidationIssues(); if (StringUtil.isNullOrEmpty(id)) { - validationIssues.add(getIssueText(CommonPropertyKeys.ID_KEY, getWrapperName(), IT_WAS_NOT_FOUND_AND_IT_IS_REQUIRED)); + validationIssues.add(getIssueText(ID_KEY, getWrapperName(), IT_WAS_NOT_FOUND_AND_IT_IS_REQUIRED)); } else if (!isValidId(id)) { - validationIssues.add(getIssueText(CommonPropertyKeys.ID_KEY, getWrapperName(), "Id value of " + id + " is not a valid UUID")); + validationIssues.add(getIssueText(ID_KEY, getWrapperName(), "Id value of " + id + " is not a valid UUID")); } return validationIssues; } diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml index 579b3f14b2..4b38226c97 100644 --- a/nifi-assembly/pom.xml +++ b/nifi-assembly/pom.xml @@ -29,7 +29,7 @@ language governing permissions and limitations under the License. --> unpack-dependencies - generate-resources + prepare-package nar **/docs/** @@ -1133,27 +1133,6 @@ language governing permissions and limitations under the License. --> - - skip-nifi-bin-assembly - - - skip-nifi-bin-assembly - - - - - - maven-assembly-plugin - - - make shared resource - none - - - - - - include-all diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java index dd8020416a..8e6c59acc2 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java @@ -66,7 +66,7 @@ public class Query { } public static ResultType getResultType(final String value) throws AttributeExpressionLanguageParsingException { - return Query.compile(value).getResultType(); + return compile(value).getResultType(); } public static List extractResultTypes(final String value) throws AttributeExpressionLanguageParsingException { @@ -183,7 +183,7 @@ public class Query { final Range range = ranges.get(0); final String expression = value.substring(range.getStart(), range.getEnd() + 1); - Query.compile(expression); + compile(expression); if (range.getStart() > 0 || range.getEnd() < value.length() - 1) { throw new AttributeExpressionLanguageParsingException("Found characters outside of Expression"); @@ -191,7 +191,7 @@ public class Query { } else { for (final Range range : extractExpressionRanges(value)) { final String expression = value.substring(range.getStart(), range.getEnd() + 1); - Query.compile(expression); + compile(expression); } } } @@ -231,7 +231,7 @@ public class Query { static String evaluateExpressions(final String rawValue, Map expressionMap, final AttributeValueDecorator decorator, final Map stateVariables, final ParameterLookup parameterLookup) throws ProcessException { - return Query.prepare(rawValue).evaluateExpressions(new StandardEvaluationContext(expressionMap, stateVariables, parameterLookup), decorator); + return prepare(rawValue).evaluateExpressions(new StandardEvaluationContext(expressionMap, stateVariables, parameterLookup), decorator); } static String evaluateExpressions(final String rawValue, final Map valueLookup, final ParameterLookup parameterLookup) throws ProcessException { @@ -240,7 +240,7 @@ public class Query { static String evaluateExpressions(final String rawValue, final Map valueLookup, final AttributeValueDecorator decorator, final ParameterLookup parameterLookup) throws ProcessException { - return Query.prepare(rawValue).evaluateExpressions(new StandardEvaluationContext(valueLookup, Collections.emptyMap(), parameterLookup), decorator); + return prepare(rawValue).evaluateExpressions(new StandardEvaluationContext(valueLookup, Collections.emptyMap(), parameterLookup), decorator); } diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/ValueLookup.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/ValueLookup.java index a4c1f76cd1..48340ffe54 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/ValueLookup.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/ValueLookup.java @@ -59,12 +59,12 @@ final class ValueLookup implements Map { } if (flowFile != null) { - maps.add(ValueLookup.extractFlowFileProperties(flowFile)); + maps.add(extractFlowFileProperties(flowFile)); maps.add(flowFile.getAttributes()); } } - static final Map extractFlowFileProperties(final FlowFile flowFile) { + static Map extractFlowFileProperties(final FlowFile flowFile) { final Map flowFileProps = new HashMap<>(); flowFileProps.put("flowFileId", String.valueOf(flowFile.getId())); flowFileProps.put("fileSize", String.valueOf(flowFile.getSize())); diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathDeleteEvaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathDeleteEvaluator.java index 960a11273a..3c40fd060e 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathDeleteEvaluator.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathDeleteEvaluator.java @@ -42,7 +42,7 @@ public class JsonPathDeleteEvaluator extends JsonPathBaseEvaluator { public QueryResult evaluate(EvaluationContext context) { DocumentContext documentContext = getDocumentContext(context); - final JsonPath compiledJsonPath = getJsonPath(context);; + final JsonPath compiledJsonPath = getJsonPath(context); String result = null; try { diff --git a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java index 0027dd8f67..a42ce38c4d 100644 --- a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java +++ b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java @@ -30,6 +30,7 @@ public class FlowFilePackagerV1 implements FlowFilePackager { public static final String FILENAME_ATTRIBUTES = "flowfile.attributes"; public static final String FILENAME_CONTENT = "flowfile.content"; + @SuppressWarnings("PMD.AvoidUsingOctalValues") public static final int DEFAULT_TAR_PERMISSIONS = 0644; private final int tarPermissions; diff --git a/nifi-commons/nifi-hashicorp-vault/src/main/java/org/apache/nifi/vault/hashicorp/config/HashiCorpVaultProperties.java b/nifi-commons/nifi-hashicorp-vault/src/main/java/org/apache/nifi/vault/hashicorp/config/HashiCorpVaultProperties.java index 8c8e919fa1..c6cd4d801a 100644 --- a/nifi-commons/nifi-hashicorp-vault/src/main/java/org/apache/nifi/vault/hashicorp/config/HashiCorpVaultProperties.java +++ b/nifi-commons/nifi-hashicorp-vault/src/main/java/org/apache/nifi/vault/hashicorp/config/HashiCorpVaultProperties.java @@ -41,7 +41,7 @@ public class HashiCorpVaultProperties { private final int kvVersion; private HashiCorpVaultProperties(final HashiCorpVaultPropertiesBuilder builder) { - this.uri = Objects.requireNonNull(builder.uri, "Vault URI is required");; + this.uri = Objects.requireNonNull(builder.uri, "Vault URI is required"); this.authPropertiesFilename = Objects.requireNonNull(builder.authPropertiesFilename, "Vault auth properties filename is required"); this.ssl = new HashiCorpVaultSslProperties(builder.keyStore, builder.keyStoreType, builder.keyStorePassword, builder.trustStore, builder.trustStoreType, builder.trustStorePassword, builder.enabledTlsCipherSuites, builder.enabledTlsProtocols); diff --git a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java index f430b505e8..cc02315756 100644 --- a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java +++ b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java @@ -24,7 +24,7 @@ import org.apache.nifi.hl7.query.evaluator.Evaluator; public class MessageEvaluator implements Evaluator { public HL7Message evaluate(final Map objectMap) { - return (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); + return (HL7Message) objectMap.get(MESSAGE_KEY); } public Class getType() { diff --git a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java index 9840461c8b..ec1ee540d0 100644 --- a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java +++ b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java @@ -40,7 +40,7 @@ public class SegmentEvaluator implements Evaluator { return Collections.emptyList(); } - final HL7Message message = (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); + final HL7Message message = (HL7Message) objectMap.get(MESSAGE_KEY); final List segments = message.getSegments(segmentType); return (segments == null) ? Collections.emptyList() : segments; } diff --git a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index 5b4753b00d..329830f7df 100644 --- a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -564,13 +564,13 @@ public class NiFiProperties extends ApplicationProperties { final String propertyKey; if (isSiteToSiteSecure()) { - if (StringUtils.isBlank(getProperty(NiFiProperties.WEB_HTTPS_PORT_FORWARDING))) { + if (StringUtils.isBlank(getProperty(WEB_HTTPS_PORT_FORWARDING))) { propertyKey = WEB_HTTPS_PORT; } else { propertyKey = WEB_HTTPS_PORT_FORWARDING; } } else { - if (StringUtils.isBlank(getProperty(NiFiProperties.WEB_HTTP_PORT_FORWARDING))) { + if (StringUtils.isBlank(getProperty(WEB_HTTP_PORT_FORWARDING))) { propertyKey = WEB_HTTP_PORT; } else { propertyKey = WEB_HTTP_PORT_FORWARDING; @@ -968,7 +968,7 @@ public class NiFiProperties extends ApplicationProperties { * @return true if the login identity provider has been configured */ public boolean isLoginIdentityProviderEnabled() { - return !StringUtils.isBlank(getProperty(NiFiProperties.SECURITY_USER_LOGIN_IDENTITY_PROVIDER)); + return !StringUtils.isBlank(getProperty(SECURITY_USER_LOGIN_IDENTITY_PROVIDER)); } /** @@ -1547,7 +1547,7 @@ public class NiFiProperties extends ApplicationProperties { final String clientSecure = getProperty(ZOOKEEPER_CLIENT_SECURE, defaultValue).trim(); if (!"true".equalsIgnoreCase(clientSecure) && !"false".equalsIgnoreCase(clientSecure)) { - throw new RuntimeException(String.format("%s was '%s', expected true or false", NiFiProperties.ZOOKEEPER_CLIENT_SECURE, clientSecure)); + throw new RuntimeException(String.format("%s was '%s', expected true or false", ZOOKEEPER_CLIENT_SECURE, clientSecure)); } return Boolean.parseBoolean(clientSecure); @@ -1558,18 +1558,18 @@ public class NiFiProperties extends ApplicationProperties { final String withEnsembleTracker = getProperty(ZOOKEEPER_CLIENT_ENSEMBLE_TRACKER, defaultValue).trim(); if (!"true".equalsIgnoreCase(withEnsembleTracker) && !"false".equalsIgnoreCase(withEnsembleTracker)) { - throw new RuntimeException(String.format("%s was '%s', expected true or false", NiFiProperties.ZOOKEEPER_CLIENT_ENSEMBLE_TRACKER, withEnsembleTracker)); + throw new RuntimeException(String.format("%s was '%s', expected true or false", ZOOKEEPER_CLIENT_ENSEMBLE_TRACKER, withEnsembleTracker)); } return Boolean.parseBoolean(withEnsembleTracker); } public boolean isZooKeeperTlsConfigurationPresent() { - return StringUtils.isNotBlank(getProperty(NiFiProperties.ZOOKEEPER_CLIENT_SECURE)) - && StringUtils.isNotBlank(getProperty(NiFiProperties.ZOOKEEPER_SECURITY_KEYSTORE)) - && getProperty(NiFiProperties.ZOOKEEPER_SECURITY_KEYSTORE_PASSWD) != null - && StringUtils.isNotBlank(getProperty(NiFiProperties.ZOOKEEPER_SECURITY_TRUSTSTORE)) - && getProperty(NiFiProperties.ZOOKEEPER_SECURITY_TRUSTSTORE_PASSWD) != null; + return StringUtils.isNotBlank(getProperty(ZOOKEEPER_CLIENT_SECURE)) + && StringUtils.isNotBlank(getProperty(ZOOKEEPER_SECURITY_KEYSTORE)) + && getProperty(ZOOKEEPER_SECURITY_KEYSTORE_PASSWD) != null + && StringUtils.isNotBlank(getProperty(ZOOKEEPER_SECURITY_TRUSTSTORE)) + && getProperty(ZOOKEEPER_SECURITY_TRUSTSTORE_PASSWD) != null; } public boolean isTlsConfigurationPresent() { @@ -1835,7 +1835,7 @@ public class NiFiProperties extends ApplicationProperties { private static void readFromPropertiesFile(String propertiesFilePath, Properties properties) { final String nfPropertiesFilePath = (propertiesFilePath == null) - ? System.getProperty(NiFiProperties.PROPERTIES_FILE_PATH) + ? System.getProperty(PROPERTIES_FILE_PATH) : propertiesFilePath; if (nfPropertiesFilePath != null) { final File propertiesFile = new File(nfPropertiesFilePath.trim()); diff --git a/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/util/StringUtils.java b/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/util/StringUtils.java index b389fd8b84..d6c1745790 100644 --- a/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/util/StringUtils.java +++ b/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/util/StringUtils.java @@ -506,7 +506,7 @@ public class StringUtils { } List elements = Arrays.asList(input.trim().toLowerCase().split("\\s")); return elements.stream() - .filter(word -> !StringUtils.isBlank(word)) + .filter(word -> !isBlank(word)) .map(word -> Character.toTitleCase(word.charAt(0)) + word.substring(1)) .collect(Collectors.joining(" ")); } diff --git a/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java b/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java index 9cc9d16145..191990f4f1 100644 --- a/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java +++ b/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java @@ -107,7 +107,7 @@ public class RecordPathCompiler { RecordPathSegment parent = root; for (int i = 0; i < pathTree.getChildCount(); i++) { final Tree child = pathTree.getChild(i); - parent = RecordPathCompiler.buildPath(child, parent, absolute); + parent = buildPath(child, parent, absolute); } // If the given path tree is an operator, create a Filter Function that will be responsible for returning true/false based on the provided operation diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java index d04ac71d95..37d787cf56 100644 --- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java +++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java @@ -648,7 +648,7 @@ public class MapRecord implements Record { Object mapObject = values.get(recordField.getFieldName()); if (mapObject == null) { - mapObject = new LinkedHashMap(); + mapObject = new LinkedHashMap<>(); } if (!(mapObject instanceof Map)) { return; diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/AbstractTransaction.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/AbstractTransaction.java index 9b8920cf8d..aa6208252e 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/AbstractTransaction.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/AbstractTransaction.java @@ -21,7 +21,6 @@ import org.apache.nifi.remote.codec.FlowFileCodec; import org.apache.nifi.remote.exception.ProtocolException; import org.apache.nifi.remote.io.CompressionInputStream; import org.apache.nifi.remote.io.CompressionOutputStream; -import org.apache.nifi.remote.protocol.CommunicationsSession; import org.apache.nifi.remote.protocol.DataPacket; import org.apache.nifi.remote.protocol.Response; import org.apache.nifi.remote.protocol.ResponseCode; @@ -193,7 +192,6 @@ public abstract class AbstractTransaction implements Transaction { + "; Transaction can only be confirmed when state is " + TransactionState.DATA_EXCHANGED); } - final CommunicationsSession commsSession = peer.getCommunicationsSession(); if (direction == TransferDirection.RECEIVE) { if (dataAvailable) { throw new IllegalStateException("Cannot complete transaction because the sender has already sent more data than client has consumed."); diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java index 710fd27460..bf13464db8 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java @@ -143,6 +143,7 @@ public class PeerSelector { * @param peerCount the number of peers in the remote instance * @return the normalized weight of this peer */ + @SuppressWarnings("PMD.AvoidDecimalLiteralsInBigDecimalConstructor") private static double calculateNormalizedWeight(TransferDirection direction, long totalFlowFileCount, int flowFileCount, int peerCount) { // If there is only a single remote, send/receive all data to/from it if (peerCount == 1) { diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java index 0ddd429c06..aac2073f9d 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java @@ -528,7 +528,7 @@ public class EndpointConnectionPool implements PeerStatusProvider { @Override public String toString() { - return "EndpointConnectionPool[Cluster URL=" + siteInfoProvider.getClusterUrls() + "]"; + return "EndpointConnectionPool[Cluster URL=" + siteInfoProvider.getClusterUrls() + " LocalAddress=" + localAddress + "]"; } private class IdEnrichedRemoteDestination implements RemoteDestination { diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/ResponseCode.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/ResponseCode.java index 1f2670f675..13bb830841 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/ResponseCode.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/ResponseCode.java @@ -58,7 +58,7 @@ public enum ResponseCode { private static final ResponseCode[] codeArray = new ResponseCode[256]; static { - for (final ResponseCode responseCode : ResponseCode.values()) { + for (final ResponseCode responseCode : values()) { codeArray[responseCode.getCode()] = responseCode; } } diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java index 63b697b41f..217bc2457b 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java @@ -126,7 +126,6 @@ import org.apache.nifi.web.api.entity.TransactionResultEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.nifi.remote.protocol.http.HttpHeaders.HANDSHAKE_PROPERTY_BATCH_COUNT; import static org.apache.nifi.remote.protocol.http.HttpHeaders.HANDSHAKE_PROPERTY_BATCH_DURATION; import static org.apache.nifi.remote.protocol.http.HttpHeaders.HANDSHAKE_PROPERTY_BATCH_SIZE; @@ -258,7 +257,7 @@ public class SiteToSiteRestApiClient implements Closeable { private void setupCredentialsProvider() { credentialsProvider = new BasicCredentialsProvider(); if (proxy != null) { - if (!isEmpty(proxy.getUsername()) && !isEmpty(proxy.getPassword())) { + if (StringUtils.isNotEmpty(proxy.getUsername()) && StringUtils.isNotEmpty(proxy.getPassword())) { credentialsProvider.setCredentials( new AuthScope(proxy.getHttpHost()), new UsernamePasswordCredentials(proxy.getUsername(), proxy.getPassword())); @@ -477,7 +476,7 @@ public class SiteToSiteRestApiClient implements Closeable { EntityUtils.consume(response.getEntity()); transactionUrl = readTransactionUrl(response); - if (isEmpty(transactionUrl)) { + if (StringUtils.isEmpty(transactionUrl)) { throw new ProtocolException("Server returned RESPONSE_CODE_CREATED without Location header"); } final Header transportProtocolVersionHeader = response.getFirstHeader(HttpHeaders.PROTOCOL_VERSION); @@ -680,7 +679,7 @@ public class SiteToSiteRestApiClient implements Closeable { } private boolean shouldCheckProxyAuth() { - return proxy != null && !isEmpty(proxy.getUsername()); + return proxy != null && StringUtils.isNotEmpty(proxy.getUsername()); } public boolean openConnectionForReceive(final String transactionUrl, final Peer peer) throws IOException { @@ -1199,7 +1198,7 @@ public class SiteToSiteRestApiClient implements Closeable { } public String getDescription() { - return !isEmpty(explanation) ? explanation : responseMessage; + return StringUtils.isNotEmpty(explanation) ? explanation : responseMessage; } } diff --git a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java index d3cf56bbe6..91adfb118f 100644 --- a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java +++ b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java @@ -98,7 +98,7 @@ public class FileUtils { * @return true if given file no longer exists */ public static boolean deleteFile(final File file, final Logger logger) { - return FileUtils.deleteFile(file, logger, 1); + return deleteFile(file, logger, 1); } /** @@ -120,7 +120,7 @@ public class FileUtils { for (int i = 0; i < effectiveAttempts && !isGone; i++) { isGone = file.delete() || !file.exists(); if (!isGone && (effectiveAttempts - i) > 1) { - FileUtils.sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); + sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); } } if (!isGone && logger != null) { @@ -142,7 +142,7 @@ public class FileUtils { * @param logger can be null */ public static void deleteFile(final List files, final Logger logger) { - FileUtils.deleteFile(files, logger, 1); + deleteFile(files, logger, 1); } /** @@ -163,7 +163,7 @@ public class FileUtils { for (int i = 0; i < effectiveAttempts && !isGone; i++) { isGone = file.delete() || !file.exists(); if (!isGone && (effectiveAttempts - i) > 1) { - FileUtils.sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); + sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); } } if (!isGone && logger != null) { @@ -186,7 +186,7 @@ public class FileUtils { * @param logger the logger to use */ public static void deleteFilesInDir(final File directory, final FilenameFilter filter, final Logger logger) { - FileUtils.deleteFilesInDir(directory, filter, logger, false); + deleteFilesInDir(directory, filter, logger, false); } /** @@ -198,7 +198,7 @@ public class FileUtils { * @param recurse indicates whether to recurse subdirectories */ public static void deleteFilesInDir(final File directory, final FilenameFilter filter, final Logger logger, final boolean recurse) { - FileUtils.deleteFilesInDir(directory, filter, logger, recurse, false); + deleteFilesInDir(directory, filter, logger, recurse, false); } /** @@ -217,12 +217,12 @@ public class FileUtils { for (File ingestFile : ingestFiles) { boolean process = (filter == null) ? true : filter.accept(directory, ingestFile.getName()); if (ingestFile.isFile() && process) { - FileUtils.deleteFile(ingestFile, logger, 3); + deleteFile(ingestFile, logger, 3); } if (ingestFile.isDirectory() && recurse) { - FileUtils.deleteFilesInDir(ingestFile, filter, logger, recurse, deleteEmptyDirectories); + deleteFilesInDir(ingestFile, filter, logger, recurse, deleteEmptyDirectories); if (deleteEmptyDirectories && ingestFile.list().length == 0) { - FileUtils.deleteFile(ingestFile, logger, 3); + deleteFile(ingestFile, logger, 3); } } } @@ -238,16 +238,16 @@ public class FileUtils { */ public static void deleteFiles(final Collection files, final boolean recurse) throws IOException { for (final File file : files) { - FileUtils.deleteFile(file, recurse); + deleteFile(file, recurse); } } public static void deleteFile(final File file, final boolean recurse) throws IOException { if (file.isDirectory() && recurse) { - FileUtils.deleteFiles(Arrays.asList(file.listFiles()), recurse); + deleteFiles(Arrays.asList(file.listFiles()), recurse); } //now delete the file itself regardless of whether it is plain file or a directory - if (!FileUtils.deleteFile(file, null, 5)) { + if (!deleteFile(file, null, 5)) { Files.delete(file.toPath()); } } @@ -286,12 +286,12 @@ public class FileUtils { fos.flush(); fos.close(); // Try to delete the file a few times - if (!FileUtils.deleteFile(file, null, 5)) { + if (!deleteFile(file, null, 5)) { throw new IOException("Failed to delete file after shredding"); } } finally { - FileUtils.closeQuietly(fos); + closeQuietly(fos); } } @@ -324,8 +324,8 @@ public class FileUtils { fos.flush(); fileSize = bytes.length; } finally { - FileUtils.releaseQuietly(outLock); - FileUtils.closeQuietly(fos); + releaseQuietly(outLock); + closeQuietly(fos); } return fileSize; } @@ -383,23 +383,23 @@ public class FileUtils { fileSize = in.size(); } while (bytesWritten < fileSize); out.force(false); - FileUtils.closeQuietly(fos); - FileUtils.closeQuietly(fis); + closeQuietly(fos); + closeQuietly(fis); fos = null; fis = null; - if (move && !FileUtils.deleteFile(source, null, 5)) { + if (move && !deleteFile(source, null, 5)) { if (logger == null) { - FileUtils.deleteFile(destination, null, 5); + deleteFile(destination, null, 5); throw new IOException("Could not remove file " + source.getAbsolutePath()); } else { logger.warn("Configured to delete source file when renaming/move not successful. However, unable to delete file at: {}", source.getAbsolutePath()); } } } finally { - FileUtils.releaseQuietly(inLock); - FileUtils.releaseQuietly(outLock); - FileUtils.closeQuietly(fos); - FileUtils.closeQuietly(fis); + releaseQuietly(inLock); + releaseQuietly(outLock); + closeQuietly(fos); + closeQuietly(fis); } } return fileSize; @@ -419,7 +419,7 @@ public class FileUtils { * @throws SecurityException if a security manager denies the needed file operations */ public static long copyFile(final File source, final File destination, final boolean lockInputFile, final boolean lockOutputFile, final Logger logger) throws FileNotFoundException, IOException { - return FileUtils.copyFile(source, destination, lockInputFile, lockOutputFile, false, logger); + return copyFile(source, destination, lockInputFile, lockOutputFile, false, logger); } public static long copyFile(final File source, final OutputStream stream, final boolean closeOutputStream, final boolean lockInputFile) throws FileNotFoundException, IOException { @@ -446,10 +446,10 @@ public class FileUtils { stream.flush(); fileSize = in.size(); } finally { - FileUtils.releaseQuietly(inLock); - FileUtils.closeQuietly(fis); + releaseQuietly(inLock); + closeQuietly(fis); if (closeOutputStream) { - FileUtils.closeQuietly(stream); + closeQuietly(stream); } } return fileSize; @@ -474,7 +474,7 @@ public class FileUtils { * @throws IOException if rename isn't successful */ public static void renameFile(final File source, final File destination, final int maxAttempts) throws IOException { - FileUtils.renameFile(source, destination, maxAttempts, false); + renameFile(source, destination, maxAttempts, false); } /** @@ -494,7 +494,7 @@ public class FileUtils { for (int i = 0; i < attempts; i++) { renamed = source.renameTo(destination); if (!renamed) { - FileUtils.deleteFile(destination, null, 5); + deleteFile(destination, null, 5); } else { break; //rename has succeeded } diff --git a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/ahocorasick/AhoCorasick.java b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/ahocorasick/AhoCorasick.java index 0709731285..aa6c858383 100644 --- a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/ahocorasick/AhoCorasick.java +++ b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/ahocorasick/AhoCorasick.java @@ -111,7 +111,7 @@ public class AhoCorasick implements Search { if (root == null) { throw new IllegalStateException(); } - final SearchState currentState = (state == null) ? new SearchState(root) : state; + final SearchState currentState = (state == null) ? new SearchState<>(root) : state; if (!findAll && currentState.foundMatch()) { throw new IllegalStateException("A match has already been found yet we're being asked to keep searching"); } diff --git a/nifi-docs/pom.xml b/nifi-docs/pom.xml index 724d918ecd..585435582b 100644 --- a/nifi-docs/pom.xml +++ b/nifi-docs/pom.xml @@ -52,7 +52,7 @@ output-html - prepare-package + process-resources process-asciidoc @@ -83,7 +83,7 @@ 1.5.3 - package + compile replace @@ -139,7 +139,7 @@ single - package + compile src/main/assembly/dependencies.xml diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java index 0363da2ded..b9837e1738 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java @@ -235,19 +235,19 @@ public class ConsumeAMQP extends AbstractAMQPProcessor { private Map buildAttributes(final BasicProperties properties, final Envelope envelope, String headersFormat, String headerAttributePrefix, boolean removeCurlyBraces, String valueSeparatorForHeaders) { final Map attributes = new HashMap<>(); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_APPID_ATTRIBUTE, properties.getAppId()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_CONTENT_ENCODING_ATTRIBUTE, properties.getContentEncoding()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_CONTENT_TYPE_ATTRIBUTE, properties.getContentType()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_DELIVERY_MODE_ATTRIBUTE, properties.getDeliveryMode()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_PRIORITY_ATTRIBUTE, properties.getPriority()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_CORRELATION_ID_ATTRIBUTE, properties.getCorrelationId()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_REPLY_TO_ATTRIBUTE, properties.getReplyTo()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_EXPIRATION_ATTRIBUTE, properties.getExpiration()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_MESSAGE_ID_ATTRIBUTE, properties.getMessageId()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_TIMESTAMP_ATTRIBUTE, properties.getTimestamp() == null ? null : properties.getTimestamp().getTime()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_CONTENT_TYPE_ATTRIBUTE, properties.getType()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_USER_ID_ATTRIBUTE, properties.getUserId()); - addAttribute(attributes, AbstractAMQPProcessor.AMQP_CLUSTER_ID_ATTRIBUTE, properties.getClusterId()); + addAttribute(attributes, AMQP_APPID_ATTRIBUTE, properties.getAppId()); + addAttribute(attributes, AMQP_CONTENT_ENCODING_ATTRIBUTE, properties.getContentEncoding()); + addAttribute(attributes, AMQP_CONTENT_TYPE_ATTRIBUTE, properties.getContentType()); + addAttribute(attributes, AMQP_DELIVERY_MODE_ATTRIBUTE, properties.getDeliveryMode()); + addAttribute(attributes, AMQP_PRIORITY_ATTRIBUTE, properties.getPriority()); + addAttribute(attributes, AMQP_CORRELATION_ID_ATTRIBUTE, properties.getCorrelationId()); + addAttribute(attributes, AMQP_REPLY_TO_ATTRIBUTE, properties.getReplyTo()); + addAttribute(attributes, AMQP_EXPIRATION_ATTRIBUTE, properties.getExpiration()); + addAttribute(attributes, AMQP_MESSAGE_ID_ATTRIBUTE, properties.getMessageId()); + addAttribute(attributes, AMQP_TIMESTAMP_ATTRIBUTE, properties.getTimestamp() == null ? null : properties.getTimestamp().getTime()); + addAttribute(attributes, AMQP_CONTENT_TYPE_ATTRIBUTE, properties.getType()); + addAttribute(attributes, AMQP_USER_ID_ATTRIBUTE, properties.getUserId()); + addAttribute(attributes, AMQP_CLUSTER_ID_ATTRIBUTE, properties.getClusterId()); addAttribute(attributes, AMQP_ROUTING_KEY_ATTRIBUTE, envelope.getRoutingKey()); addAttribute(attributes, AMQP_EXCHANGE_ATTRIBUTE, envelope.getExchange()); Map headers = properties.getHeaders(); @@ -255,7 +255,7 @@ public class ConsumeAMQP extends AbstractAMQPProcessor { if (OutputHeaderFormat.ATTRIBUTES.getValue().equals(headersFormat)) { headers.forEach((key, value) -> addAttribute(attributes, String.format("%s.%s", headerAttributePrefix, key), value)); } else { - addAttribute(attributes, AbstractAMQPProcessor.AMQP_HEADERS_ATTRIBUTE, + addAttribute(attributes, AMQP_HEADERS_ATTRIBUTE, buildHeaders(properties.getHeaders(), headersFormat, removeCurlyBraces, valueSeparatorForHeaders)); } @@ -281,7 +281,7 @@ public class ConsumeAMQP extends AbstractAMQPProcessor { return null; } String headerString = null; - if ( OutputHeaderFormat.COMMA_SEPARATED_STRING.getValue().equals(headerFormat)) { + if (OutputHeaderFormat.COMMA_SEPARATED_STRING.getValue().equals(headerFormat)) { headerString = convertMapToString(headers, valueSeparatorForHeaders); if (!removeCurlyBraces) { diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java index 0973a31c23..dc791d3018 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java @@ -255,19 +255,19 @@ public class PublishAMQP extends AbstractAMQPProcessor { private BasicProperties extractAmqpPropertiesFromFlowFile(final FlowFile flowFile, final InputHeaderSource selectedHeaderSource, final Character separator, final Pattern pattern) { final AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder(); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_CONTENT_TYPE_ATTRIBUTE, builder::contentType); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_CONTENT_ENCODING_ATTRIBUTE, builder::contentEncoding); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_DELIVERY_MODE_ATTRIBUTE, mode -> builder.deliveryMode(Integer.parseInt(mode))); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_PRIORITY_ATTRIBUTE, pri -> builder.priority(Integer.parseInt(pri))); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_CORRELATION_ID_ATTRIBUTE, builder::correlationId); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_REPLY_TO_ATTRIBUTE, builder::replyTo); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_EXPIRATION_ATTRIBUTE, builder::expiration); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_MESSAGE_ID_ATTRIBUTE, builder::messageId); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_TIMESTAMP_ATTRIBUTE, ts -> builder.timestamp(new Date(Long.parseLong(ts)))); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_TYPE_ATTRIBUTE, builder::type); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_USER_ID_ATTRIBUTE, builder::userId); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_APPID_ATTRIBUTE, builder::appId); - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_CLUSTER_ID_ATTRIBUTE, builder::clusterId); + readAmqpAttribute(flowFile, AMQP_CONTENT_TYPE_ATTRIBUTE, builder::contentType); + readAmqpAttribute(flowFile, AMQP_CONTENT_ENCODING_ATTRIBUTE, builder::contentEncoding); + readAmqpAttribute(flowFile, AMQP_DELIVERY_MODE_ATTRIBUTE, mode -> builder.deliveryMode(Integer.parseInt(mode))); + readAmqpAttribute(flowFile, AMQP_PRIORITY_ATTRIBUTE, pri -> builder.priority(Integer.parseInt(pri))); + readAmqpAttribute(flowFile, AMQP_CORRELATION_ID_ATTRIBUTE, builder::correlationId); + readAmqpAttribute(flowFile, AMQP_REPLY_TO_ATTRIBUTE, builder::replyTo); + readAmqpAttribute(flowFile, AMQP_EXPIRATION_ATTRIBUTE, builder::expiration); + readAmqpAttribute(flowFile, AMQP_MESSAGE_ID_ATTRIBUTE, builder::messageId); + readAmqpAttribute(flowFile, AMQP_TIMESTAMP_ATTRIBUTE, ts -> builder.timestamp(new Date(Long.parseLong(ts)))); + readAmqpAttribute(flowFile, AMQP_TYPE_ATTRIBUTE, builder::type); + readAmqpAttribute(flowFile, AMQP_USER_ID_ATTRIBUTE, builder::userId); + readAmqpAttribute(flowFile, AMQP_APPID_ATTRIBUTE, builder::appId); + readAmqpAttribute(flowFile, AMQP_CLUSTER_ID_ATTRIBUTE, builder::clusterId); Map headers = prepareAMQPHeaders(flowFile, selectedHeaderSource, separator, pattern); builder.headers(headers); @@ -286,7 +286,7 @@ public class PublishAMQP extends AbstractAMQPProcessor { if (InputHeaderSource.FLOWFILE_ATTRIBUTES.equals(selectedHeaderSource)) { headers.putAll(getMatchedAttributes(flowFile.getAttributes(), pattern)); } else if (InputHeaderSource.AMQP_HEADERS_ATTRIBUTE.equals(selectedHeaderSource)) { - readAmqpAttribute(flowFile, AbstractAMQPProcessor.AMQP_HEADERS_ATTRIBUTE, value -> headers.putAll(validateAMQPHeaderProperty(value, headerSeparator))); + readAmqpAttribute(flowFile, AMQP_HEADERS_ATTRIBUTE, value -> headers.putAll(validateAMQPHeaderProperty(value, headerSeparator))); } return headers; } diff --git a/nifi-extension-bundles/nifi-apicurio-bundle/nifi-apicurio-schema-registry-service/src/main/java/org/apache/nifi/apicurio/schemaregistry/util/SchemaUtils.java b/nifi-extension-bundles/nifi-apicurio-bundle/nifi-apicurio-schema-registry-service/src/main/java/org/apache/nifi/apicurio/schemaregistry/util/SchemaUtils.java index 4f77104e63..15667bcc20 100644 --- a/nifi-extension-bundles/nifi-apicurio-bundle/nifi-apicurio-schema-registry-service/src/main/java/org/apache/nifi/apicurio/schemaregistry/util/SchemaUtils.java +++ b/nifi-extension-bundles/nifi-apicurio-bundle/nifi-apicurio-schema-registry-service/src/main/java/org/apache/nifi/apicurio/schemaregistry/util/SchemaUtils.java @@ -24,8 +24,6 @@ import org.apache.nifi.avro.AvroTypeUtil; import org.apache.nifi.schema.access.SchemaNotFoundException; import org.apache.nifi.serialization.record.RecordSchema; import org.apache.nifi.serialization.record.SchemaIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; @@ -33,7 +31,6 @@ import java.util.OptionalInt; public class SchemaUtils { - private static final Logger logger = LoggerFactory.getLogger(SchemaUtils.class); private static final ObjectMapper OBJECT_MAPPER = setObjectMapper(); private SchemaUtils() { diff --git a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/RecordSchemaProvider.java b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/RecordSchemaProvider.java index 7a31e502e0..c0b3ad91b9 100644 --- a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/RecordSchemaProvider.java +++ b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/RecordSchemaProvider.java @@ -25,8 +25,6 @@ import org.apache.nifi.serialization.record.RecordField; import org.apache.nifi.serialization.record.RecordSchema; import org.apache.nifi.serialization.record.SchemaIdentifier; import org.apache.nifi.serialization.record.StandardSchemaIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.lang.reflect.Field; import java.util.ArrayList; @@ -37,8 +35,6 @@ import java.util.stream.Collectors; public class RecordSchemaProvider { - private static final Logger LOG = LoggerFactory.getLogger(RecordSchemaProvider.class); - private final LoadingCache schemaCache = Caffeine.newBuilder() .maximumSize(100) .build(this::generateRecordSchema); diff --git a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/convert/converters/BerArrayConverter.java b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/convert/converters/BerArrayConverter.java index 59a7baab38..b1b2ede3f9 100644 --- a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/convert/converters/BerArrayConverter.java +++ b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/convert/converters/BerArrayConverter.java @@ -27,7 +27,6 @@ import org.apache.nifi.serialization.record.type.ArrayDataType; import java.lang.reflect.Field; import java.util.List; -import static org.apache.nifi.jasn1.JASN1Utils.getSeqOfElementType; import static org.apache.nifi.jasn1.JASN1Utils.invokeGetter; import static org.apache.nifi.jasn1.JASN1Utils.toGetterMethod; @@ -59,7 +58,7 @@ public class BerArrayConverter implements JASN1TypeAndValueConverter { // Use the generic type of seqOf field to determine the getter method name. final Field seqOfField = value.getClass().getDeclaredField("seqOf"); - final Class seqOf = getSeqOfElementType(seqOfField); + final Class seqOf = JASN1Utils.getSeqOfElementType(seqOfField); final String getterMethod = toGetterMethod(seqOf.getSimpleName()); final DataType elementType = ((ArrayDataType) dataType).getElementType(); diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/signer/AwsSignerType.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/signer/AwsSignerType.java index cbb655d52e..395f6cdba8 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/signer/AwsSignerType.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/signer/AwsSignerType.java @@ -34,7 +34,7 @@ public enum AwsSignerType implements DescribedValue { private static final Map LOOKUP_MAP = new HashMap<>(); static { - for (AwsSignerType signerType : AwsSignerType.values()) { + for (AwsSignerType signerType : values()) { LOOKUP_MAP.put(signerType.getValue(), signerType); } } diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/PutKinesisStream.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/PutKinesisStream.java index 2993763336..da63e1632c 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/PutKinesisStream.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/PutKinesisStream.java @@ -158,7 +158,7 @@ public class PutKinesisStream extends AbstractAwsSyncProcessor TEXTRACT_TYPES = Arrays.stream(TextractType.values()).map(TextractType::getType) + public static final Set TEXTRACT_TYPES = Arrays.stream(values()).map(TextractType::getType) .collect(collectingAndThen(toSet(), Collections::unmodifiableSet)); public final String type; diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java index 8e69e13fe9..3429887b2f 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java @@ -1066,7 +1066,7 @@ public class PutS3Object extends AbstractS3Processor { } else { first = false; } - buf.append(java.lang.String.format("%d/%s", tag.getPartNumber(), tag.getETag())); + buf.append(String.format("%d/%s", tag.getPartNumber(), tag.getETag())); } } buf.append(SEPARATOR) diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/encryption/ServerSideCEncryptionStrategy.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/encryption/ServerSideCEncryptionStrategy.java index 1939e19c93..d11734bd71 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/encryption/ServerSideCEncryptionStrategy.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/encryption/ServerSideCEncryptionStrategy.java @@ -70,7 +70,7 @@ public class ServerSideCEncryptionStrategy implements S3EncryptionStrategy { byte[] keyMaterial; try { - if (!org.apache.commons.codec.binary.Base64.isBase64(keyValue)) { + if (!Base64.isBase64(keyValue)) { throw new Exception(); } keyMaterial = Base64.decodeBase64(keyValue); diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/utils/AzureEventHubUtils.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/utils/AzureEventHubUtils.java index fa445ca6d1..ef923f0877 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/utils/AzureEventHubUtils.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/utils/AzureEventHubUtils.java @@ -65,9 +65,8 @@ public final class AzureEventHubUtils { .description("To support namespaces not in the default windows.net domain.") .addValidator(StandardValidators.NON_BLANK_VALIDATOR) .expressionLanguageSupported(ExpressionLanguageScope.NONE) - .allowableValues(AzureEventHubUtils.AZURE_ENDPOINT, AzureEventHubUtils.AZURE_CHINA_ENDPOINT, - AzureEventHubUtils.AZURE_GERMANY_ENDPOINT, AzureEventHubUtils.AZURE_US_GOV_ENDPOINT) - .defaultValue(AzureEventHubUtils.AZURE_ENDPOINT) + .allowableValues(AZURE_ENDPOINT, AZURE_CHINA_ENDPOINT, AZURE_GERMANY_ENDPOINT, AZURE_US_GOV_ENDPOINT) + .defaultValue(AZURE_ENDPOINT) .required(true) .build(); diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/CopyAzureBlobStorage_v12.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/CopyAzureBlobStorage_v12.java index 91ad7005b9..82c7689c36 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/CopyAzureBlobStorage_v12.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/CopyAzureBlobStorage_v12.java @@ -342,7 +342,7 @@ public class CopyAzureBlobStorage_v12 extends AbstractAzureBlobProcessor_v12 { private static String generateSas(final BlobContainerClient sourceContainerClient) { final BlobContainerSasPermission permissions = new BlobContainerSasPermission().setCreatePermission(true).setWritePermission(true).setAddPermission(true).setReadPermission(true); final OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); - final OffsetDateTime expiryTime = now.plusHours(CopyAzureBlobStorage_v12.GENERATE_SAS_EXPIRY_HOURS); + final OffsetDateTime expiryTime = now.plusHours(GENERATE_SAS_EXPIRY_HOURS); final BlobServiceSasSignatureValues signatureValues = new BlobServiceSasSignatureValues(expiryTime, permissions); return sourceContainerClient.generateSas(signatureValues); } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-services-api/src/main/java/org/apache/nifi/services/azure/data/explorer/KustoIngestionResult.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-services-api/src/main/java/org/apache/nifi/services/azure/data/explorer/KustoIngestionResult.java index e8133395a4..f8556cb49d 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-services-api/src/main/java/org/apache/nifi/services/azure/data/explorer/KustoIngestionResult.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-services-api/src/main/java/org/apache/nifi/services/azure/data/explorer/KustoIngestionResult.java @@ -32,7 +32,7 @@ public enum KustoIngestionResult { } public static KustoIngestionResult fromString(String status) { - for (KustoIngestionResult result : KustoIngestionResult.values()) { + for (KustoIngestionResult result : values()) { if (result.status.equalsIgnoreCase(status)) { return result; } diff --git a/nifi-extension-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/PutDropbox.java b/nifi-extension-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/PutDropbox.java index 2970d11b6a..f9fe78da35 100644 --- a/nifi-extension-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/PutDropbox.java +++ b/nifi-extension-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/PutDropbox.java @@ -237,7 +237,7 @@ public class PutDropbox extends AbstractProcessor implements DropboxTrait { } catch (UploadErrorException e) { handleUploadError(conflictResolution, uploadPath, e); } catch (UploadSessionFinishErrorException e) { - handleUploadError(conflictResolution, uploadPath, e); + handleUploadSessionError(conflictResolution, uploadPath, e); } catch (RateLimitException e) { context.yield(); throw new ProcessException("Dropbox API rate limit exceeded while uploading file", e); @@ -268,7 +268,7 @@ public class PutDropbox extends AbstractProcessor implements DropboxTrait { } } - private void handleUploadError(final ConflictResolutionStrategy conflictResolution, final String uploadPath, final UploadSessionFinishErrorException e) { + private void handleUploadSessionError(final ConflictResolutionStrategy conflictResolution, final String uploadPath, final UploadSessionFinishErrorException e) { if (e.errorValue.isPath() && e.errorValue.getPathValue().isConflict()) { handleConflict(conflictResolution, uploadPath, e); } else { diff --git a/nifi-extension-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/AbstractEmailProcessor.java b/nifi-extension-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/AbstractEmailProcessor.java index 1b94031a7b..96bf4e3750 100644 --- a/nifi-extension-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/AbstractEmailProcessor.java +++ b/nifi-extension-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/AbstractEmailProcessor.java @@ -196,8 +196,6 @@ abstract class AbstractEmailProcessor extends Ab private volatile ProcessSession processSession; - private volatile boolean shouldSetDeleteFlag; - protected volatile Optional oauth2AccessTokenProviderOptional; protected volatile AccessToken oauth2AccessDetails; @@ -313,7 +311,6 @@ abstract class AbstractEmailProcessor extends Ab this.processSession = processSession; this.messageReceiver = this.buildMessageReceiver(context); - this.shouldSetDeleteFlag = context.getProperty(SHOULD_DELETE_MESSAGES).asBoolean(); int fetchSize = context.getProperty(FETCH_SIZE).evaluateAttributeExpressions().asInteger(); this.messageReceiver.setMaxFetchSize(fetchSize); diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java index 19a1241c12..da2809783c 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java @@ -49,12 +49,10 @@ public class ChunkHeader extends Block { private final Map nameStrings; private final Map templateNodes; private final int chunkNumber; - private final ComponentLog log; private UnsignedLong recordNumber; public ChunkHeader(BinaryReader binaryReader, ComponentLog log, long headerOffset, int chunkNumber) throws IOException { super(binaryReader, headerOffset); - this.log = log; this.chunkNumber = chunkNumber; CRC32 crc32 = new CRC32(); crc32.update(binaryReader.peekBytes(120)); diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/MalformedChunkException.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/MalformedChunkException.java index ab6720888f..2be9bc5485 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/MalformedChunkException.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/MalformedChunkException.java @@ -22,6 +22,7 @@ package org.apache.nifi.processors.evtx.parser; * Chunks are independent within the file so we should be able to safely continue processing the remaining chunks. */ public class MalformedChunkException extends Exception { + @SuppressWarnings("PMD.UnusedPrivateField") private final long offset; private final int chunkNum; private byte[] badChunk; diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNode.java index e9c7358006..8d0885df78 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNode.java @@ -30,6 +30,7 @@ import java.util.List; */ public class ConditionalSubstitutionNode extends BxmlNodeWithToken { private final int index; + @SuppressWarnings("PMD.UnusedPrivateField") private final int type; public ConditionalSubstitutionNode(BinaryReader binaryReader, ChunkHeader chunkHeader, BxmlNode parent) throws IOException { diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNode.java index b8e0631de7..d0efb3d98c 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNode.java @@ -30,6 +30,7 @@ import java.util.List; */ public class NormalSubstitutionNode extends BxmlNodeWithToken { private final int index; + @SuppressWarnings("PMD.UnusedPrivateField") private final int type; public NormalSubstitutionNode(BinaryReader binaryReader, ChunkHeader chunkHeader, BxmlNode parent) throws IOException { diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNode.java index 55e54ebb1d..34dc62b0b3 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNode.java @@ -29,7 +29,9 @@ import java.io.IOException; * Open tag in the template xml */ public class OpenStartElementNode extends BxmlNodeWithToken { + @SuppressWarnings("PMD.UnusedPrivateField") private final int unknown; + @SuppressWarnings("PMD.UnusedPrivateField") private final UnsignedInteger size; private final int stringOffset; private final String tagName; diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNode.java index 1583ad0290..150723337c 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNode.java @@ -27,6 +27,7 @@ import java.util.List; public class ProcessingInstructionDataNode extends BxmlNodeWithToken { private final int stringLength; + @SuppressWarnings("PMD.UnusedPrivateField") private final int tagLength; private final String data; diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNode.java index cda5669f18..f880d5ad11 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNode.java @@ -30,7 +30,9 @@ import java.util.List; * Node denoting the beginning of a stream (generally present before the TemplateInstanceNode) */ public class StreamStartNode extends BxmlNodeWithToken { + @SuppressWarnings("PMD.UnusedPrivateField") private final int unknown; + @SuppressWarnings("PMD.UnusedPrivateField") private final int unknown2; public StreamStartNode(BinaryReader binaryReader, ChunkHeader chunkHeader, BxmlNode parent) throws IOException { diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNode.java index 0bfa417a7c..c11fd9e77f 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNode.java @@ -31,10 +31,11 @@ import java.util.List; * Instance of a Template */ public class TemplateInstanceNode extends BxmlNodeWithToken { - + @SuppressWarnings("PMD.UnusedPrivateField") private final int unknown; private final UnsignedInteger templateId; private final int templateOffset; + @SuppressWarnings("PMD.UnusedPrivateField") private final boolean isResident; private final TemplateNode templateNode; private final int templateLength; diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/VariantTypeNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/VariantTypeNode.java index dc8236af50..83749221f4 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/VariantTypeNode.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/VariantTypeNode.java @@ -30,6 +30,7 @@ import java.util.List; * Parent class for variant nodes (they all have no children) */ public abstract class VariantTypeNode extends BxmlNode { + @SuppressWarnings("PMD.UnusedPrivateField") private final int length; public VariantTypeNode(BinaryReader binaryReader, ChunkHeader chunkHeader, BxmlNode parent, int length) throws IOException { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-conflict-resolution/src/main/java/org/apache/nifi/processors/conflict/resolution/ConflictResolutionStrategy.java b/nifi-extension-bundles/nifi-extension-utils/nifi-conflict-resolution/src/main/java/org/apache/nifi/processors/conflict/resolution/ConflictResolutionStrategy.java index ae9a992e5b..55842ca957 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-conflict-resolution/src/main/java/org/apache/nifi/processors/conflict/resolution/ConflictResolutionStrategy.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-conflict-resolution/src/main/java/org/apache/nifi/processors/conflict/resolution/ConflictResolutionStrategy.java @@ -28,7 +28,7 @@ public enum ConflictResolutionStrategy implements DescribedValue { private static final Map ENUM_MAP = new HashMap<>(); static { - for (ConflictResolutionStrategy strategy : ConflictResolutionStrategy.values()) { + for (ConflictResolutionStrategy strategy : values()) { ENUM_MAP.put(strategy.getValue(), strategy); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/StandardEventFactory.java b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/StandardEventFactory.java index 9ae6161515..dce31f12e5 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/StandardEventFactory.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/event/StandardEventFactory.java @@ -23,7 +23,8 @@ import java.util.Map; /** * EventFactory to create StandardEvent instances. */ -public class StandardEventFactory implements EventFactory { +@SuppressWarnings("PMD.UseDiamondOperator") +public class StandardEventFactory> implements EventFactory { @Override public StandardEvent create(final byte[] data, final Map metadata, final ChannelResponder responder) { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java index f0427b9d97..2d9f380ff2 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java @@ -156,10 +156,8 @@ public class SecurityUtil { if (ugi == null) { try { result = action.run(); - } catch (IOException ioe) { - throw ioe; - } catch (RuntimeException re) { - throw re; + } catch (IOException | RuntimeException e) { + throw e; } catch (Exception e) { throw new RuntimeException(e); } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/ListedEntityTracker.java b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/ListedEntityTracker.java index 5363ad879b..a3d97b74d8 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/ListedEntityTracker.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/ListedEntityTracker.java @@ -142,7 +142,7 @@ public class ListedEntityTracker { return null; } try (final GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(v))) { - return objectMapper.readValue(in, new TypeReference>() { }); + return objectMapper.readValue(in, new TypeReference<>() { }); } }; @@ -174,8 +174,8 @@ public class ListedEntityTracker { } static void validateProperties(ValidationContext context, Collection results, Scope scope) { - validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_STATE_CACHE); - validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_TIME_WINDOW); + validateRequiredProperty(context, results, TRACKING_STATE_CACHE); + validateRequiredProperty(context, results, TRACKING_TIME_WINDOW); if (Scope.LOCAL.equals(scope) && StringUtils.isEmpty(context.getProperty(NODE_IDENTIFIER).evaluateAttributeExpressions().getValue())) { @@ -238,7 +238,7 @@ public class ListedEntityTracker { mapCacheClient = context.getProperty(TRACKING_STATE_CACHE).asControllerService(DistributedMapCacheClient.class); this.scope = scope; if (Scope.LOCAL.equals(scope)) { - nodeId = context.getProperty(ListedEntityTracker.NODE_IDENTIFIER).evaluateAttributeExpressions().getValue(); + nodeId = context.getProperty(NODE_IDENTIFIER).evaluateAttributeExpressions().getValue(); } else { nodeId = null; } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java index a7db224fe7..73ccb7d026 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java @@ -23,6 +23,7 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.sql.Blob; +import java.sql.Time; import java.sql.Timestamp; import java.time.Duration; import java.time.Instant; @@ -505,7 +506,7 @@ public class AvroTypeUtil { for (final Field field : avroSchema.getFields()) { final String fieldName = field.name(); final Schema fieldSchema = field.schema(); - final DataType dataType = AvroTypeUtil.determineDataType(fieldSchema, knownRecords); + final DataType dataType = determineDataType(fieldSchema, knownRecords); final boolean nullable = isNullable(fieldSchema); addFieldToList(recordFields, field, fieldName, fieldSchema, dataType, nullable); } @@ -694,7 +695,7 @@ public class AvroTypeUtil { } private static Long getLongFromTimestamp(final Object rawValue, final Schema fieldSchema, final String fieldName) { - final String format = AvroTypeUtil.determineDataType(fieldSchema).getFormat(); + final String format = determineDataType(fieldSchema).getFormat(); final FieldConverter converter = StandardFieldConverterRegistry.getRegistry().getFieldConverter(Timestamp.class); final Timestamp timestamp = converter.convertField(rawValue, Optional.ofNullable(format), fieldName); return timestamp.getTime(); @@ -715,12 +716,12 @@ public class AvroTypeUtil { if (LOGICAL_TYPE_DATE.equals(logicalType.getName())) { - final String format = AvroTypeUtil.determineDataType(fieldSchema).getFormat(); + final String format = determineDataType(fieldSchema).getFormat(); final FieldConverter fieldConverter = StandardFieldConverterRegistry.getRegistry().getFieldConverter(LocalDate.class); final LocalDate localDate = fieldConverter.convertField(rawValue, Optional.ofNullable(format), fieldName); return (int) localDate.toEpochDay(); } else if (LOGICAL_TYPE_TIME_MILLIS.equals(logicalType.getName())) { - final String format = AvroTypeUtil.determineDataType(fieldSchema).getFormat(); + final String format = determineDataType(fieldSchema).getFormat(); return getLogicalTimeMillis(rawValue, format, fieldName); } @@ -794,7 +795,7 @@ public class AvroTypeUtil { return new GenericData.Fixed(fieldSchema, rawBytes); } else { - return AvroTypeUtil.convertByteArray((Object[]) rawValue); + return convertByteArray((Object[]) rawValue); } } try { @@ -997,7 +998,7 @@ public class AvroTypeUtil { } foundNonNull = true; - final DataType desiredDataType = AvroTypeUtil.determineDataType(subSchema); + final DataType desiredDataType = determineDataType(subSchema); try { final Object convertedValue = conversion.apply(subSchema); @@ -1078,7 +1079,7 @@ public class AvroTypeUtil { return java.sql.Date.valueOf(LocalDate.ofEpochDay((int) value)); } else if (LOGICAL_TYPE_TIME_MILLIS.equals(logicalName)) { // time-millis logical name means that the value is number of milliseconds since midnight. - return new java.sql.Time((int) value); + return new Time((int) value); } break; @@ -1091,11 +1092,11 @@ public class AvroTypeUtil { final String logicalName = logicalType.getName(); if (LOGICAL_TYPE_TIME_MICROS.equals(logicalName)) { - return new java.sql.Time(TimeUnit.MICROSECONDS.toMillis((long) value)); + return new Time(TimeUnit.MICROSECONDS.toMillis((long) value)); } else if (LOGICAL_TYPE_TIMESTAMP_MILLIS.equals(logicalName)) { - return new java.sql.Timestamp((long) value); + return new Timestamp((long) value); } else if (LOGICAL_TYPE_TIMESTAMP_MICROS.equals(logicalName)) { - return new java.sql.Timestamp(TimeUnit.MICROSECONDS.toMillis((long) value)); + return new Timestamp(TimeUnit.MICROSECONDS.toMillis((long) value)); } break; } @@ -1115,7 +1116,7 @@ public class AvroTypeUtil { final Object fieldValue = normalizeValue(avroFieldValue, field.schema(), fieldName + "/" + field.name()); values.put(field.name(), fieldValue); } - final RecordSchema childSchema = AvroTypeUtil.createSchema(recordSchema, false); + final RecordSchema childSchema = createSchema(recordSchema, false); return new MapRecord(childSchema, values); case BYTES: final ByteBuffer bb = (ByteBuffer) value; @@ -1123,7 +1124,7 @@ public class AvroTypeUtil { if (logicalType != null && LOGICAL_TYPE_DECIMAL.equals(logicalType.getName())) { return new Conversions.DecimalConversion().fromBytes(bb, avroSchema, logicalType); } - return AvroTypeUtil.convertByteArray(bb.array()); + return convertByteArray(bb.array()); case FIXED: final GenericFixed fixed = (GenericFixed) value; final LogicalType fixedLogicalType = avroSchema.getLogicalType(); @@ -1131,7 +1132,7 @@ public class AvroTypeUtil { final ByteBuffer fixedByteBuffer = ByteBuffer.wrap(fixed.bytes()); return new Conversions.DecimalConversion().fromBytes(fixedByteBuffer, avroSchema, fixedLogicalType); } - return AvroTypeUtil.convertByteArray(fixed.bytes()); + return convertByteArray(fixed.bytes()); case ENUM: return value.toString(); case NULL: diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java index 0fa83f2772..4524caafbb 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractFetchHDFSRecord.java @@ -154,7 +154,7 @@ public abstract class AbstractFetchHDFSRecord extends AbstractHadoopProcessor { public abstract HDFSRecordReader createHDFSRecordReader(final ProcessContext context, final FlowFile flowFile, final Configuration conf, final Path path) throws IOException; - + @SuppressWarnings("PMD.IdenticalCatchBranches") @Override public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException { // do this before getting a flow file so that we always get a chance to attempt Kerberos relogin diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-mock-record-utils/src/main/java/org/apache/nifi/serialization/record/MockSchemaRegistry.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-mock-record-utils/src/main/java/org/apache/nifi/serialization/record/MockSchemaRegistry.java index eac76b8ffa..0290f50a91 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-mock-record-utils/src/main/java/org/apache/nifi/serialization/record/MockSchemaRegistry.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-mock-record-utils/src/main/java/org/apache/nifi/serialization/record/MockSchemaRegistry.java @@ -55,7 +55,7 @@ public class MockSchemaRegistry extends AbstractControllerService implements Sch RecordSchema retrieveSchemaByName(final SchemaIdentifier schemaIdentifier) throws SchemaNotFoundException { final Optional schemaName = schemaIdentifier.getName(); if (schemaName.isEmpty()) { - throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Name is not present"); + throw new SchemaNotFoundException("Cannot retrieve schema because Schema Name is not present"); } final String schemaBranch = schemaIdentifier.getBranch().orElse(null); @@ -66,12 +66,12 @@ public class MockSchemaRegistry extends AbstractControllerService implements Sch private RecordSchema retrieveSchemaByIdAndVersion(final SchemaIdentifier schemaIdentifier) throws SchemaNotFoundException { final OptionalLong schemaId = schemaIdentifier.getIdentifier(); if (schemaId.isEmpty()) { - throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Id is not present"); + throw new SchemaNotFoundException("Cannot retrieve schema because Schema Id is not present"); } final OptionalInt version = schemaIdentifier.getVersion(); if (version.isEmpty()) { - throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Version is not present"); + throw new SchemaNotFoundException("Cannot retrieve schema because Schema Version is not present"); } final Tuple tuple = new Tuple<>(schemaId.getAsLong(), version.getAsInt()); diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java index 510f155139..c4c958f3fb 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java @@ -286,7 +286,7 @@ public class CSVUtils { final Character quoteChar = getCharUnescaped(context, QUOTE_CHAR, variables); builder = builder.setQuote(quoteChar); - final Character escapeChar = context.getProperty(CSVUtils.ESCAPE_CHAR).evaluateAttributeExpressions(variables).getValue().isEmpty() ? null : getCharUnescaped(context, ESCAPE_CHAR, variables); + final Character escapeChar = context.getProperty(ESCAPE_CHAR).evaluateAttributeExpressions(variables).getValue().isEmpty() ? null : getCharUnescaped(context, ESCAPE_CHAR, variables); builder = builder.setEscape(escapeChar); builder = builder.setTrim(context.getProperty(TRIM_FIELDS).asBoolean()); diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java index c5d589d2d1..9e509073c6 100644 --- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java +++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java @@ -87,7 +87,7 @@ abstract public class AbstractGetGcpVisionAnnotateOperationStatus extends Abstra return; } try { - String operationKey = context.getProperty(OPERATION_KEY).evaluateAttributeExpressions(flowFile).getValue();; + String operationKey = context.getProperty(OPERATION_KEY).evaluateAttributeExpressions(flowFile).getValue(); Operation operation = getVisionClient().getOperationsClient().getOperation(operationKey); getLogger().info("{}", operation); if (operation.getDone() && !operation.hasError()) { diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java index 18ca00e359..da557d1097 100644 --- a/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java +++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java @@ -488,7 +488,7 @@ public class TinkerpopClientService extends AbstractControllerService implements Map.Entry tempResult = (Map.Entry) resultSet.next(); Map tempRetObject = new HashMap<>(); tempRetObject.put(tempResult.getKey(), tempResult.getValue()); - SimpleEntry returnObject = new SimpleEntry(tempResult.getKey(), tempRetObject); + SimpleEntry returnObject = new SimpleEntry<>(tempResult.getKey(), tempRetObject); Map resultReturnMap = new HashMap<>(); resultReturnMap.put(innerResultSet.getKey(), returnObject); if (getLogger().isDebugEnabled()) { diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/Utils.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/Utils.java index f725d4071e..3055b4cd2a 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/Utils.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/Utils.java @@ -20,16 +20,9 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * - */ public final class Utils { - private static final Logger logger = LoggerFactory.getLogger(Utils.class); - /** * Creates new instance of the class specified by 'className' by first * loading it using thread context class loader and then executing default diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java index 1f45da973e..70c502cad4 100644 --- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java +++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java @@ -89,7 +89,7 @@ public class JoltTransformJSON extends AbstractJoltTransform { .build(); private static final List PROPERTIES; - private static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE);; + private static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE); private volatile ClassLoader customClassLoader; private volatile JsonUtil jsonUtil; diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/pom.xml b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/pom.xml index 7613312691..007355bd21 100644 --- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/pom.xml +++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/pom.xml @@ -97,7 +97,7 @@ language governing permissions and limitations under the License. --> unpack-nifi-jolt-transform-json-ui - generate-resources + prepare-package unpack-dependencies diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java index 3cbd70f95d..30e8a2cb7e 100644 --- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java +++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java @@ -278,8 +278,8 @@ public class PutMongoRecord extends AbstractMongoProcessor { return retVal; } - private List convertArrays(Object[] input) { - List retVal = new ArrayList(); + private List convertArrays(Object[] input) { + List retVal = new ArrayList<>(); for (Object o : input) { if (o != null && o.getClass().isArray()) { retVal.add(convertArrays((Object[]) o)); diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/RunMongoAggregation.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/RunMongoAggregation.java index ec037b6b6b..8469f13b0c 100644 --- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/RunMongoAggregation.java +++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/RunMongoAggregation.java @@ -174,7 +174,7 @@ public class RunMongoAggregation extends AbstractMongoProcessor { try { MongoCollection collection = getCollection(context, flowFile); List aggQuery = buildAggregationQuery(query); - AggregateIterable it = collection.aggregate(aggQuery).allowDiskUse(allowDiskUse);; + AggregateIterable it = collection.aggregate(aggQuery).allowDiskUse(allowDiskUse); it.batchSize(batchSize != null ? batchSize : 1); iter = it.iterator(); diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/gridfs/PutGridFS.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/gridfs/PutGridFS.java index 83138cf9f1..ee8041bd4d 100644 --- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/gridfs/PutGridFS.java +++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/gridfs/PutGridFS.java @@ -122,19 +122,17 @@ public class PutGridFS extends AbstractGridFSProcessor { static final Set RELATIONSHIP_SET; static { - List _temp = new ArrayList<>(); - _temp.addAll(PARENT_PROPERTIES); - _temp.add(FILE_NAME); - _temp.add(PROPERTIES_PREFIX); - _temp.add(ENFORCE_UNIQUENESS); - _temp.add(HASH_ATTRIBUTE); - _temp.add(CHUNK_SIZE); - DESCRIPTORS = Collections.unmodifiableList(_temp); + List propertyDescriptors = new ArrayList<>(PARENT_PROPERTIES); + propertyDescriptors.add(FILE_NAME); + propertyDescriptors.add(PROPERTIES_PREFIX); + propertyDescriptors.add(ENFORCE_UNIQUENESS); + propertyDescriptors.add(HASH_ATTRIBUTE); + propertyDescriptors.add(CHUNK_SIZE); + DESCRIPTORS = Collections.unmodifiableList(propertyDescriptors); - Set _rels = new HashSet(); - _rels.addAll(PARENT_RELATIONSHIPS); - _rels.add(REL_DUPLICATE); - RELATIONSHIP_SET = Collections.unmodifiableSet(_rels); + Set relationships = new HashSet<>(PARENT_RELATIONSHIPS); + relationships.add(REL_DUPLICATE); + RELATIONSHIP_SET = Collections.unmodifiableSet(relationships); } private String uniqueness; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/WriteParquetResult.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/WriteParquetResult.java index bf4b11d49f..d4d16bd94a 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/WriteParquetResult.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/WriteParquetResult.java @@ -42,7 +42,6 @@ public class WriteParquetResult extends AbstractRecordSetWriter { private final Schema schema; private final ParquetWriter parquetWriter; - private final ComponentLog componentLogger; private SchemaAccessWriter accessWriter; private RecordSchema recordSchema; @@ -50,7 +49,6 @@ public class WriteParquetResult extends AbstractRecordSetWriter { final ParquetConfig parquetConfig, final ComponentLog componentLogger) throws IOException { super(out); this.schema = avroSchema; - this.componentLogger = componentLogger; this.accessWriter = accessWriter; this.recordSchema = recordSchema; diff --git a/nifi-extension-bundles/nifi-py4j-extension-bundle/nifi-py4j-integration-tests/pom.xml b/nifi-extension-bundles/nifi-py4j-extension-bundle/nifi-py4j-integration-tests/pom.xml index 3d1b7dc4f9..2a286bd1c7 100644 --- a/nifi-extension-bundles/nifi-py4j-extension-bundle/nifi-py4j-integration-tests/pom.xml +++ b/nifi-extension-bundles/nifi-py4j-extension-bundle/nifi-py4j-integration-tests/pom.xml @@ -104,7 +104,7 @@ unpack-dependencies - generate-test-resources + prepare-package nifi-python-framework true @@ -119,7 +119,7 @@ unpack-dependencies - generate-test-resources + prepare-package nifi-python-extension-api true @@ -134,7 +134,7 @@ unpack-dependencies - generate-test-resources + prepare-package nifi-python-test-extensions true diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java index 135f8a92a1..e4550dc2d7 100644 --- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java +++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java @@ -264,10 +264,8 @@ public abstract class AbstractSiteToSiteReportingTask extends AbstractReportingT try { return convertJsonNodeToRecord(nextNode, getSchema(), null, coerceTypes, dropUnknownFields); - } catch (final MalformedRecordException mre) { - throw mre; - } catch (final IOException ioe) { - throw ioe; + } catch (final MalformedRecordException | IOException e) { + throw e; } catch (final Exception e) { throw new MalformedRecordException("Failed to convert data into a Record object with the given schema", e); } diff --git a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V1V2cSNMPFactory.java b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V1V2cSNMPFactory.java index 636ca4a7ca..f6335c28d9 100644 --- a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V1V2cSNMPFactory.java +++ b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V1V2cSNMPFactory.java @@ -26,8 +26,8 @@ import java.util.Optional; public class V1V2cSNMPFactory extends SNMPManagerFactory implements SNMPContext { @Override - public Target createTargetInstance(final SNMPConfiguration configuration) { - final Target communityTarget = new CommunityTarget(); + public Target createTargetInstance(final SNMPConfiguration configuration) { + final Target communityTarget = new CommunityTarget<>(); setupTargetBasicProperties(communityTarget, configuration); final String community = configuration.getCommunityString(); diff --git a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V3SNMPFactory.java b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V3SNMPFactory.java index 4bc089730e..5310fae498 100644 --- a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V3SNMPFactory.java +++ b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/core/V3SNMPFactory.java @@ -62,8 +62,8 @@ public class V3SNMPFactory extends SNMPManagerFactory implements SNMPContext { } @Override - public Target createTargetInstance(final SNMPConfiguration configuration) { - final UserTarget userTarget = new UserTarget(); + public Target createTargetInstance(final SNMPConfiguration configuration) { + final UserTarget userTarget = new UserTarget<>(); setupTargetBasicProperties(userTarget, configuration); final int securityLevel = SecurityLevel.valueOf(configuration.getSecurityLevel()).getSnmpValue(); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-content-viewer/pom.xml b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-content-viewer/pom.xml index a832c6d0b1..dd86a11f38 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-content-viewer/pom.xml +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-content-viewer/pom.xml @@ -95,7 +95,7 @@ unpack-standard-content-viewer-ui - generate-resources + prepare-package unpack-dependencies diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java index cd3e7dc0da..de6e76aab4 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java @@ -59,7 +59,6 @@ import org.apache.nifi.serialization.record.type.MapDataType; import org.apache.nifi.serialization.record.type.RecordDataType; import org.apache.nifi.util.StringUtils; -import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.ZoneId; @@ -315,8 +314,7 @@ public class GenerateRecord extends AbstractProcessor { return faker.number().randomDouble(6, Long.MIN_VALUE, Long.MAX_VALUE); case FLOAT: final double randomDouble = faker.number().randomDouble(6, Long.MIN_VALUE, Long.MAX_VALUE); - final BigDecimal asBigDecimal = new BigDecimal(randomDouble); - return asBigDecimal.floatValue(); + return (float) randomDouble; case DECIMAL: return faker.number().randomDouble(((DecimalDataType) recordField.getDataType()).getScale(), Long.MIN_VALUE, Long.MAX_VALUE); case INT: diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDP.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDP.java index 8b1ba1165d..64023707bd 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDP.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDP.java @@ -41,7 +41,6 @@ import org.apache.nifi.processor.util.listen.event.EventFactory; import org.apache.nifi.processor.util.listen.event.StandardEvent; import org.apache.nifi.processor.util.listen.event.StandardEventFactory; -import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -121,13 +120,12 @@ public class ListenUDP extends AbstractListenEventBatchingProcessor events) - throws IOException { + protected ChannelDispatcher createDispatcher(final ProcessContext context, final BlockingQueue events) { final String sendingHost = context.getProperty(SENDING_HOST).evaluateAttributeExpressions().getValue(); final Integer sendingHostPort = context.getProperty(SENDING_HOST_PORT).evaluateAttributeExpressions().asInteger(); final Integer bufferSize = context.getProperty(RECV_BUFFER_SIZE).asDataSize(DataUnit.B).intValue(); final ByteBufferSource byteBufferSource = new ByteBufferPool(context.getMaxConcurrentTasks(), bufferSize); - final EventFactory eventFactory = new StandardEventFactory(); + final EventFactory eventFactory = new StandardEventFactory<>(); return new DatagramChannelDispatcher<>(eventFactory, byteBufferSource, events, getLogger(), sendingHost, sendingHostPort); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java index 9528d1540a..dc263dcc47 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java @@ -219,7 +219,7 @@ public class ListenUDPRecord extends AbstractListenEventProcessor final Integer sendingHostPort = context.getProperty(SENDING_HOST_PORT).evaluateAttributeExpressions().asInteger(); final Integer bufferSize = context.getProperty(RECV_BUFFER_SIZE).asDataSize(DataUnit.B).intValue(); final ByteBufferSource byteBufferSource = new ByteBufferPool(context.getMaxConcurrentTasks(), bufferSize); - final EventFactory eventFactory = new StandardEventFactory(); + final EventFactory eventFactory = new StandardEventFactory<>(); return new DatagramChannelDispatcher<>(eventFactory, byteBufferSource, events, getLogger(), sendingHost, sendingHostPort); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ModifyBytes.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ModifyBytes.java index 2ea191cca0..16045d5d93 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ModifyBytes.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ModifyBytes.java @@ -127,7 +127,7 @@ public class ModifyBytes extends AbstractProcessor { ff = session.write(ff, new StreamCallback() { @Override public void process(final InputStream in, final OutputStream out) throws IOException { - in.skip(startOffset); + in.skipNBytes(startOffset); StreamUtils.copy(in, out, newFileSize); } }); diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-proxy-configuration-api/src/main/java/org/apache/nifi/proxy/ProxyConfiguration.java b/nifi-extension-bundles/nifi-standard-services/nifi-proxy-configuration-api/src/main/java/org/apache/nifi/proxy/ProxyConfiguration.java index 58a717f427..266092487e 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-proxy-configuration-api/src/main/java/org/apache/nifi/proxy/ProxyConfiguration.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-proxy-configuration-api/src/main/java/org/apache/nifi/proxy/ProxyConfiguration.java @@ -51,7 +51,7 @@ public class ProxyConfiguration { } return new PropertyDescriptor.Builder() - .fromPropertyDescriptor(ProxyConfigurationService.PROXY_CONFIGURATION_SERVICE) + .fromPropertyDescriptor(PROXY_CONFIGURATION_SERVICE) .description(description.toString()) .build(); } diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java index 6d62e10acd..2fe916f8c3 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java @@ -42,9 +42,7 @@ public abstract class AvroRecordReader implements RecordReader { final RecordSchema schema = getSchema(); final Map values = AvroTypeUtil.convertAvroRecordToMap(record, schema); return new MapRecord(schema, values); - } catch (IOException e) { - throw e; - } catch (MalformedRecordException e) { + } catch (IOException | MalformedRecordException e) { throw e; } catch (Exception e) { throw new MalformedRecordException("Error while getting next record", e); diff --git a/nifi-extension-bundles/nifi-websocket-bundle/nifi-websocket-services-api/src/main/java/org/apache/nifi/websocket/WebSocketMessageRouter.java b/nifi-extension-bundles/nifi-websocket-bundle/nifi-websocket-services-api/src/main/java/org/apache/nifi/websocket/WebSocketMessageRouter.java index bcce446cd1..2f67c7601b 100644 --- a/nifi-extension-bundles/nifi-websocket-bundle/nifi-websocket-services-api/src/main/java/org/apache/nifi/websocket/WebSocketMessageRouter.java +++ b/nifi-extension-bundles/nifi-websocket-bundle/nifi-websocket-services-api/src/main/java/org/apache/nifi/websocket/WebSocketMessageRouter.java @@ -48,11 +48,9 @@ public class WebSocketMessageRouter { public synchronized void deregisterProcessor(final Processor processor) { if (!isProcessorRegistered(processor)) { if (this.processor == null) { - logger.info("Deregister processor {}, do nothing because this router doesn't have registered processor", - new Object[]{processor}); + logger.info("Deregister processor {}, do nothing because this router doesn't have registered processor", processor); } else { - logger.info("Deregister processor {}, do nothing because this router is assigned to different processor {}", - new Object[]{processor, this.processor}); + logger.info("Deregister processor {}, do nothing because this router is assigned to different processor {}", processor, this.processor); } return; } @@ -62,7 +60,7 @@ public class WebSocketMessageRouter { try { disconnect(sessionId, "Processing has stopped."); } catch (IOException e) { - logger.warn("Failed to disconnect session {} due to {}", sessionId, e, e); + logger.warn("Failed to disconnect session {} endpoint [{}] due to {}", sessionId, endpointId, e, e); } }); } diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authorization/RequestAction.java b/nifi-framework-api/src/main/java/org/apache/nifi/authorization/RequestAction.java index 3e28a67715..c28d8c03c6 100644 --- a/nifi-framework-api/src/main/java/org/apache/nifi/authorization/RequestAction.java +++ b/nifi-framework-api/src/main/java/org/apache/nifi/authorization/RequestAction.java @@ -23,7 +23,7 @@ public enum RequestAction { READ("read"), WRITE("write"); - private String value; + private final String value; RequestAction(String value) { this.value = value; @@ -35,12 +35,12 @@ public enum RequestAction { } public static RequestAction valueOfValue(final String action) { - if (RequestAction.READ.toString().equals(action)) { - return RequestAction.READ; - } else if (RequestAction.WRITE.toString().equals(action)) { - return RequestAction.WRITE; + if (READ.toString().equals(action)) { + return READ; + } else if (WRITE.toString().equals(action)) { + return WRITE; } else { - throw new IllegalArgumentException("Action must be one of [" + READ.toString() + ", " + WRITE.toString() + "]"); + throw new IllegalArgumentException("Action must be one of [" + READ + ", " + WRITE + "]"); } } } diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java b/nifi-framework-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java index 38ab72b880..543df5be8c 100644 --- a/nifi-framework-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java +++ b/nifi-framework-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java @@ -36,7 +36,7 @@ public interface MetricDescriptor { DURATION, DATA_SIZE, FRACTION - }; + } int getMetricIdentifier(); diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarManifest.java b/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarManifest.java index 3e2d31d113..54a259e33b 100644 --- a/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarManifest.java +++ b/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarManifest.java @@ -172,7 +172,7 @@ public class NarManifest { final Attributes attributes = manifest.getMainAttributes(); - return NarManifest.builder() + return builder() .group(attributes.getValue(NarManifestEntry.NAR_GROUP.getEntryName())) .id(attributes.getValue(NarManifestEntry.NAR_ID.getEntryName())) .version(attributes.getValue(NarManifestEntry.NAR_VERSION.getEntryName())) diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarProperties.java b/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarProperties.java index d26a0b5562..c00cf14b34 100644 --- a/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarProperties.java +++ b/nifi-framework-api/src/main/java/org/apache/nifi/nar/NarProperties.java @@ -149,7 +149,7 @@ public class NarProperties { final String installedValue = properties.getProperty(NarProperty.INSTALLED.getKey()); final Instant installed = Instant.parse(installedValue); - return NarProperties.builder() + return builder() .sourceType(properties.getProperty(NarProperty.SOURCE_TYPE.getKey())) .sourceId(properties.getProperty(NarProperty.SOURCE_ID.getKey())) .narGroup(properties.getProperty(NarProperty.NAR_GROUP.getKey())) diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/StandardStateMap.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/StandardStateMap.java index fd93db8072..dae5ccb334 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/StandardStateMap.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/StandardStateMap.java @@ -25,8 +25,6 @@ import org.apache.nifi.components.state.StateMap; * Standard implementation of StateMap */ class StandardStateMap implements StateMap { - private static final int EMPTY_VERSION = -1; - private final Map data; private final Optional version; diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java index 51179369b4..6a4212d433 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java @@ -39,9 +39,6 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Matcher; import java.util.regex.Pattern; -/** - * - */ public class IndexConfiguration { private final RepositoryConfiguration repoConfig; diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java index 63a5401ac0..e4dccef4e1 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java @@ -280,7 +280,7 @@ public class LuceneEventIndex implements EventIndex { @Override public long getMinimumEventIdToReindex(final String partitionName) { - return Math.max(0, getMaxEventId(partitionName) - EventIndexTask.MAX_DOCUMENTS_PER_THREAD * LuceneEventIndex.MAX_INDEX_THREADS); + return Math.max(0, getMaxEventId(partitionName) - EventIndexTask.MAX_DOCUMENTS_PER_THREAD * MAX_INDEX_THREADS); } protected IndexDirectoryManager getDirectoryManager() { diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java index 099a9f7ea3..8cfbf987f4 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java @@ -47,9 +47,6 @@ import java.util.Map; public class LuceneUtil { - private static final long[] MIN_LONG_ARRAY = new long[] {Long.MIN_VALUE}; - private static final long[] MAX_LONG_ARRAY = new long[] {Long.MAX_VALUE}; - public static String substringBefore(final String value, final String searchValue) { final int index = value.indexOf(searchValue); return (index < 0) ? value : value.substring(0, index); diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecordFields.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecordFields.java index 057763656d..4a6e704d6c 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecordFields.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecordFields.java @@ -25,7 +25,6 @@ import org.apache.nifi.repository.schema.ComplexRecordField; import org.apache.nifi.repository.schema.FieldType; import org.apache.nifi.repository.schema.MapRecordField; import org.apache.nifi.repository.schema.RecordField; -import org.apache.nifi.repository.schema.Repetition; import org.apache.nifi.repository.schema.SimpleRecordField; import org.apache.nifi.repository.schema.UnionRecordField; @@ -41,14 +40,14 @@ public class LookupTableEventRecordFields { public static final RecordField EVENT_DETAILS = new SimpleRecordField(EventFieldNames.EVENT_DETAILS, FieldType.STRING, ZERO_OR_ONE); // Make lookup id or a string, depending on whether or not available in header. - public static final RecordField NO_VALUE = new SimpleRecordField(EventFieldNames.NO_VALUE, FieldType.STRING, Repetition.EXACTLY_ONE); - public static final RecordField EXPLICIT_STRING = new SimpleRecordField(EventFieldNames.EXPLICIT_VALUE, FieldType.STRING, Repetition.EXACTLY_ONE); - public static final RecordField LOOKUP_VALUE = new SimpleRecordField(EventFieldNames.LOOKUP_VALUE, FieldType.INT, Repetition.EXACTLY_ONE); - public static final RecordField UNCHANGED_VALUE = new SimpleRecordField(EventFieldNames.UNCHANGED_VALUE, FieldType.STRING, Repetition.EXACTLY_ONE); + public static final RecordField NO_VALUE = new SimpleRecordField(EventFieldNames.NO_VALUE, FieldType.STRING, EXACTLY_ONE); + public static final RecordField EXPLICIT_STRING = new SimpleRecordField(EventFieldNames.EXPLICIT_VALUE, FieldType.STRING, EXACTLY_ONE); + public static final RecordField LOOKUP_VALUE = new SimpleRecordField(EventFieldNames.LOOKUP_VALUE, FieldType.INT, EXACTLY_ONE); + public static final RecordField UNCHANGED_VALUE = new SimpleRecordField(EventFieldNames.UNCHANGED_VALUE, FieldType.STRING, EXACTLY_ONE); - public static final RecordField COMPONENT_ID = new UnionRecordField(EventFieldNames.COMPONENT_ID, Repetition.EXACTLY_ONE, NO_VALUE, EXPLICIT_STRING, LOOKUP_VALUE); - public static final RecordField SOURCE_QUEUE_ID = new UnionRecordField(EventFieldNames.SOURCE_QUEUE_IDENTIFIER, Repetition.EXACTLY_ONE, NO_VALUE, EXPLICIT_STRING, LOOKUP_VALUE); - public static final RecordField COMPONENT_TYPE = new UnionRecordField(EventFieldNames.COMPONENT_TYPE, Repetition.EXACTLY_ONE, EXPLICIT_STRING, LOOKUP_VALUE); + public static final RecordField COMPONENT_ID = new UnionRecordField(EventFieldNames.COMPONENT_ID, EXACTLY_ONE, NO_VALUE, EXPLICIT_STRING, LOOKUP_VALUE); + public static final RecordField SOURCE_QUEUE_ID = new UnionRecordField(EventFieldNames.SOURCE_QUEUE_IDENTIFIER, EXACTLY_ONE, NO_VALUE, EXPLICIT_STRING, LOOKUP_VALUE); + public static final RecordField COMPONENT_TYPE = new UnionRecordField(EventFieldNames.COMPONENT_TYPE, EXACTLY_ONE, EXPLICIT_STRING, LOOKUP_VALUE); // Attributes public static final RecordField ATTRIBUTE_NAME = new SimpleRecordField(EventFieldNames.ATTRIBUTE_NAME, FieldType.LONG_STRING, EXACTLY_ONE); @@ -71,7 +70,7 @@ public class LookupTableEventRecordFields { public static final RecordField CURRENT_CONTENT_CLAIM_EXPLICIT = new ComplexRecordField(EventFieldNames.EXPLICIT_VALUE, EXACTLY_ONE, CONTENT_CLAIM_CONTAINER, CONTENT_CLAIM_SECTION, CONTENT_CLAIM_IDENTIFIER, CONTENT_CLAIM_OFFSET, CONTENT_CLAIM_SIZE); public static final RecordField CURRENT_CONTENT_CLAIM = new UnionRecordField(EventFieldNames.CONTENT_CLAIM, - Repetition.EXACTLY_ONE, NO_VALUE, UNCHANGED_VALUE, CURRENT_CONTENT_CLAIM_EXPLICIT); + EXACTLY_ONE, NO_VALUE, UNCHANGED_VALUE, CURRENT_CONTENT_CLAIM_EXPLICIT); // EventType-Specific fields diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StatusHistoryStorage.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StatusHistoryStorage.java index 615bc19b0d..c04d025ae5 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StatusHistoryStorage.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StatusHistoryStorage.java @@ -30,8 +30,8 @@ import java.util.List; interface StatusHistoryStorage { - default void init() { }; - default void close() { }; + default void init() { } + default void close() { } List getConnectionSnapshots(final String componentId, final Date start, final Date end); List getProcessGroupSnapshots(final String componentId, final Date start, final Date end); diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StorageStatusType.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StorageStatusType.java index cf0fbbb91e..d4ddd25289 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StorageStatusType.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb-status-history/src/main/java/org/apache/nifi/controller/status/history/questdb/StorageStatusType.java @@ -34,7 +34,7 @@ enum StorageStatusType { } static StorageStatusType getById(final int id) { - final Optional result = Arrays.stream(StorageStatusType.values()).filter(storageStatusType -> storageStatusType.getId() == id).findFirst(); + final Optional result = Arrays.stream(values()).filter(storageStatusType -> storageStatusType.getId() == id).findFirst(); if (result.isEmpty()) { throw new IllegalArgumentException("Unknown storage type id " + id); diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/EmbeddedDatabaseManager.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/EmbeddedDatabaseManager.java index f4bc4824d6..6d6f0cbe31 100644 --- a/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/EmbeddedDatabaseManager.java +++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/EmbeddedDatabaseManager.java @@ -50,7 +50,7 @@ final class EmbeddedDatabaseManager implements DatabaseManager { private static final Logger LOGGER = LoggerFactory.getLogger(EmbeddedDatabaseManager.class); private final String id = UUID.randomUUID().toString(); - private final AtomicReference state = new AtomicReference(EmbeddedDatabaseManagerStatus.UNINITIALIZED); + private final AtomicReference state = new AtomicReference<>(EmbeddedDatabaseManagerStatus.UNINITIALIZED); private final ReadWriteLock databaseStructureLock = new ReentrantReadWriteLock(); private final EmbeddedDatabaseManagerContext context; private final AtomicReference engine = new AtomicReference<>(); diff --git a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java index 745e8ac017..75158d2cbb 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java +++ b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java @@ -35,8 +35,8 @@ public class LineageRequestDTO { public enum LineageRequestType { PARENTS, CHILDREN, - FLOWFILE; - }; + FLOWFILE + } private Long eventId; private LineageRequestType lineageRequestType; diff --git a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java index b6e3e4feb4..6b9743dd0c 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java +++ b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java @@ -31,7 +31,7 @@ public class StatusDescriptorDTO { COUNT, DURATION, DATA_SIZE - }; + } private String field; private String label; diff --git a/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizationsHolder.java b/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizationsHolder.java index 3b7822df91..0c603986f6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizationsHolder.java +++ b/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizationsHolder.java @@ -67,7 +67,7 @@ public class AuthorizationsHolder { * @param policies the JAXB Policies element * @return a set of AccessPolicies corresponding to the provided Resources */ - private Set createAccessPolicies(org.apache.nifi.authorization.file.generated.Policies policies) { + private Set createAccessPolicies(final Policies policies) { Set allPolicies = new HashSet<>(); if (policies == null || policies.getPolicy() == null) { return allPolicies; diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java index 93bf53d3e9..565ed12e56 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java @@ -54,7 +54,7 @@ public final class NiFiUserUtils { public static String getNiFiUserIdentity() { // get the nifi user to extract the username - NiFiUser user = NiFiUserUtils.getNiFiUser(); + NiFiUser user = getNiFiUser(); if (user == null) { return "unknown"; } else { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowRegistryClientEndpointMerger.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowRegistryClientEndpointMerger.java index 806fd2b755..50a12c2c28 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowRegistryClientEndpointMerger.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowRegistryClientEndpointMerger.java @@ -55,6 +55,6 @@ public class FlowRegistryClientEndpointMerger extends AbstractSingleEntityEndpoi protected void mergeResponses( final FlowRegistryClientEntity clientEntity, final Map entityMap, final Set successfulResponses, final Set problematicResponses) { - flowRegistryClientEntityMerger.merge(clientEntity, entityMap);; + flowRegistryClientEntityMerger.merge(clientEntity, entityMap); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java index 1b971292fa..f326caf0b3 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java @@ -70,6 +70,7 @@ public final class StandardConnection implements Connection { private final AtomicInteger labelIndex = new AtomicInteger(1); private final AtomicLong zIndex = new AtomicLong(DEFAULT_Z_INDEX); private final AtomicReference versionedComponentId = new AtomicReference<>(); + @SuppressWarnings("PMD.UnusedPrivateField") private final ProcessScheduler scheduler; private final int hashCode; @@ -383,6 +384,7 @@ public final class StandardConnection implements Connection { private Connectable destination; private Collection relationships; private FlowFileQueueFactory flowFileQueueFactory; + @SuppressWarnings("PMD.UnusedPrivateField") private boolean clustered = false; public Builder(final ProcessScheduler scheduler) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java index 2fad536b4a..3de9b11ea8 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java @@ -122,8 +122,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import static java.util.Objects.requireNonNull; - /** * ProcessorNode provides thread-safe access to a FlowFileProcessor as it exists * within a controlled flow. This node keeps track of the processor, its @@ -530,7 +528,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable if (isRunning()) { throw new IllegalStateException("Cannot modify configuration of " + this + " while the Processor is running"); } - final long yieldNanos = FormatUtils.getTimeDuration(requireNonNull(yieldPeriod), TimeUnit.NANOSECONDS); + final long yieldNanos = FormatUtils.getTimeDuration(Objects.requireNonNull(yieldPeriod), TimeUnit.NANOSECONDS); if (yieldNanos < 0) { throw new IllegalArgumentException("Yield duration of " + this + " cannot be set to a negative value: " + yieldNanos + " nanos"); } @@ -587,7 +585,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable throw new IllegalStateException("Cannot modify configuration of " + this + " while the Processor is running"); } - final long penalizationMillis = FormatUtils.getTimeDuration(requireNonNull(penalizationPeriod), TimeUnit.MILLISECONDS); + final long penalizationMillis = FormatUtils.getTimeDuration(Objects.requireNonNull(penalizationPeriod), TimeUnit.MILLISECONDS); if (penalizationMillis < 0) { throw new IllegalArgumentException("Penalization duration of " + this + " cannot be set to a negative value: " + penalizationMillis + " millis"); } @@ -725,7 +723,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable @Override public void updateConnection(final Connection connection) throws IllegalStateException { try { - if (requireNonNull(connection).getSource().equals(this)) { + if (Objects.requireNonNull(connection).getSource().equals(this)) { // update any relationships // // first check if any relations were removed. @@ -794,7 +792,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable public void removeConnection(final Connection connection) { boolean connectionRemoved = false; - if (requireNonNull(connection).getSource().equals(this)) { + if (Objects.requireNonNull(connection).getSource().equals(this)) { for (final Relationship relationship : connection.getRelationships()) { final Set connectionsForRelationship = getConnections(relationship); if ((connectionsForRelationship == null || connectionsForRelationship.size() <= 1) && isRunning()) { @@ -1167,7 +1165,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable break; case TIMER_DRIVEN: { try { - final long schedulingNanos = FormatUtils.getTimeDuration(requireNonNull(evaluatedSchedulingPeriod), + final long schedulingNanos = FormatUtils.getTimeDuration(Objects.requireNonNull(evaluatedSchedulingPeriod), TimeUnit.NANOSECONDS); if (schedulingNanos < 0) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java index e7c8113dc7..abb48dae26 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java @@ -1756,7 +1756,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn private void formatNanos(final long nanos, final StringBuilder sb) { final long seconds = nanos > 1000000000L ? nanos / 1000000000L : 0L; long millis = nanos > 1000000L ? nanos / 1000000L : 0L; - ; + final long nanosLeft = nanos % 1000000L; if (seconds > 0) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceReference.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceReference.java index e18e383514..cb92b2ba84 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceReference.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceReference.java @@ -84,11 +84,7 @@ public class StandardControllerServiceReference implements ControllerServiceRefe @Override public List findRecursiveReferences(final Class componentType) { - return findRecursiveReferences(referenced, componentType); - } - - private List findRecursiveReferences(final ControllerServiceNode referencedNode, final Class componentType) { - return findRecursiveReferences(referencedNode, componentType, new HashSet<>()); + return findRecursiveReferences(referenced, componentType, new HashSet<>()); } private List findRecursiveReferences(final ControllerServiceNode referencedNode, final Class componentType, final Set servicesVisited) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceResolver.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceResolver.java index 907e210e28..1f0da6f146 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceResolver.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceResolver.java @@ -186,7 +186,7 @@ public class StandardControllerServiceResolver implements ControllerServiceResol } final VersionedControllerService matchingService = matchingControllerServices.get(0); - final String resolvedId = matchingService.getIdentifier();; + final String resolvedId = matchingService.getIdentifier(); componentProperties.put(propertyName, resolvedId); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java index 7630955351..3825c5de38 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java @@ -47,7 +47,7 @@ public class VolatileBulletinRepository implements BulletinRepository { private static final String PARAMETER_PROVIDER_BULLETIN_STORE_KEY = "PARAMETER_PROVIDER"; private final ConcurrentMap>> bulletinStoreMap = new ConcurrentHashMap<>(); - private volatile BulletinProcessingStrategy processingStrategy = new DefaultBulletinProcessingStrategy(); + private final BulletinProcessingStrategy processingStrategy = new DefaultBulletinProcessingStrategy(); private final AtomicLong maxId = new AtomicLong(-1L); @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java index bee353d545..2a08ea8468 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java @@ -3781,14 +3781,14 @@ public class StandardVersionedComponentSynchronizer implements VersionedComponen reportingTask.disable(); break; case ENABLED: - if (reportingTask.getScheduledState() == org.apache.nifi.controller.ScheduledState.DISABLED) { + if (reportingTask.getScheduledState() == ScheduledState.DISABLED) { reportingTask.enable(); } else if (reportingTask.isRunning()) { reportingTask.stop(); } break; case RUNNING: - if (reportingTask.getScheduledState() == org.apache.nifi.controller.ScheduledState.DISABLED) { + if (reportingTask.getScheduledState() == ScheduledState.DISABLED) { reportingTask.enable(); } if (!reportingTask.isRunning()) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java index 950b9cd694..2c2ad21744 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java @@ -149,9 +149,6 @@ import java.util.function.Predicate; import java.util.regex.Pattern; import java.util.stream.Collectors; -import static java.util.Objects.requireNonNull; - - public final class StandardProcessGroup implements ProcessGroup { public static final List AGGREGATE_DROP_FLOW_FILE_STATE_PRECEDENCES = Arrays.asList( DropFlowFileState.FAILURE, @@ -704,7 +701,7 @@ public final class StandardProcessGroup implements ProcessGroup { final Map portIdMap, final Function getPortByName) { - if (portIdMap.containsKey(requireNonNull(port).getIdentifier())) { + if (portIdMap.containsKey(Objects.requireNonNull(port).getIdentifier())) { throw new IllegalStateException("A port with the same id already exists."); } @@ -728,7 +725,7 @@ public final class StandardProcessGroup implements ProcessGroup { ensureUniqueVersionControlId(port, ProcessGroup::getInputPorts); port.setProcessGroup(this); - inputPorts.put(requireNonNull(port).getIdentifier(), port); + inputPorts.put(Objects.requireNonNull(port).getIdentifier(), port); flowManager.onInputPortAdded(port); onComponentModified(); @@ -742,7 +739,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void removeInputPort(final Port port) { writeLock.lock(); try { - final Port toRemove = inputPorts.get(requireNonNull(port).getIdentifier()); + final Port toRemove = inputPorts.get(Objects.requireNonNull(port).getIdentifier()); if (toRemove == null) { throw new IllegalStateException(port.getIdentifier() + " is not an Input Port of this Process Group"); } @@ -826,7 +823,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void removeOutputPort(final Port port) { writeLock.lock(); try { - final Port toRemove = outputPorts.get(requireNonNull(port).getIdentifier()); + final Port toRemove = outputPorts.get(Objects.requireNonNull(port).getIdentifier()); toRemove.verifyCanDelete(); if (port.isRunning()) { @@ -925,7 +922,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public void removeProcessGroup(final ProcessGroup group) { - requireNonNull(group).verifyCanDelete(); + Objects.requireNonNull(group).verifyCanDelete(); writeLock.lock(); try { @@ -990,7 +987,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addRemoteProcessGroup(final RemoteProcessGroup remoteGroup) { writeLock.lock(); try { - if (remoteGroups.containsKey(requireNonNull(remoteGroup).getIdentifier())) { + if (remoteGroups.containsKey(Objects.requireNonNull(remoteGroup).getIdentifier())) { throw new IllegalStateException("RemoteProcessGroup already exists with ID " + remoteGroup.getIdentifier()); } @@ -1017,7 +1014,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public void removeRemoteProcessGroup(final RemoteProcessGroup remoteProcessGroup) { - final String remoteGroupId = requireNonNull(remoteProcessGroup).getIdentifier(); + final String remoteGroupId = Objects.requireNonNull(remoteProcessGroup).getIdentifier(); writeLock.lock(); try { @@ -1070,7 +1067,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addProcessor(final ProcessorNode processor) { writeLock.lock(); try { - final String processorId = requireNonNull(processor).getIdentifier(); + final String processorId = Objects.requireNonNull(processor).getIdentifier(); final ProcessorNode existingProcessor = processors.get(processorId); if (existingProcessor != null) { throw new IllegalStateException("A processor is already registered to this ProcessGroup with ID " + processorId); @@ -1223,7 +1220,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public void removeProcessor(final ProcessorNode processor) { boolean removed = false; - final String id = requireNonNull(processor).getIdentifier(); + final String id = Objects.requireNonNull(processor).getIdentifier(); writeLock.lock(); try { if (!processors.containsKey(id)) { @@ -1346,7 +1343,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addConnection(final Connection connection) { writeLock.lock(); try { - final String id = requireNonNull(connection).getIdentifier(); + final String id = Objects.requireNonNull(connection).getIdentifier(); final Connection existingConnection = connections.get(id); if (existingConnection != null) { throw new IllegalStateException("Connection already exists with ID " + id); @@ -1482,7 +1479,7 @@ public final class StandardProcessGroup implements ProcessGroup { writeLock.lock(); try { // verify that Connection belongs to this group - final Connection connection = connections.get(requireNonNull(connectionToRemove).getIdentifier()); + final Connection connection = connections.get(Objects.requireNonNull(connectionToRemove).getIdentifier()); if (connection == null) { throw new IllegalStateException("Connection " + connectionToRemove.getIdentifier() + " is not a member of this Process Group"); } @@ -1653,7 +1650,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addLabel(final Label label) { writeLock.lock(); try { - final Label existing = labels.get(requireNonNull(label).getIdentifier()); + final Label existing = labels.get(Objects.requireNonNull(label).getIdentifier()); if (existing != null) { throw new IllegalStateException("A label already exists in this ProcessGroup with ID " + label.getIdentifier()); } @@ -1671,7 +1668,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void removeLabel(final Label label) { writeLock.lock(); try { - final Label removed = labels.remove(requireNonNull(label).getIdentifier()); + final Label removed = labels.remove(Objects.requireNonNull(label).getIdentifier()); if (removed == null) { throw new IllegalStateException(label + " is not a member of this Process Group."); } @@ -2090,7 +2087,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public ProcessGroup findProcessGroup(final String id) { - if (requireNonNull(id).equals(getIdentifier())) { + if (Objects.requireNonNull(id).equals(getIdentifier())) { return this; } @@ -2150,7 +2147,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public RemoteProcessGroup findRemoteProcessGroup(final String id) { - return findRemoteProcessGroup(requireNonNull(id), this); + return findRemoteProcessGroup(Objects.requireNonNull(id), this); } private RemoteProcessGroup findRemoteProcessGroup(final String id, final ProcessGroup start) { @@ -2399,7 +2396,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addFunnel(final Funnel funnel, final boolean autoStart) { writeLock.lock(); try { - final Funnel existing = funnels.get(requireNonNull(funnel).getIdentifier()); + final Funnel existing = funnels.get(Objects.requireNonNull(funnel).getIdentifier()); if (existing != null) { throw new IllegalStateException("A funnel already exists in this ProcessGroup with ID " + funnel.getIdentifier()); } @@ -2509,7 +2506,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void removeFunnel(final Funnel funnel) { writeLock.lock(); try { - final Funnel existing = funnels.get(requireNonNull(funnel).getIdentifier()); + final Funnel existing = funnels.get(Objects.requireNonNull(funnel).getIdentifier()); if (existing == null) { throw new IllegalStateException("Funnel " + funnel.getIdentifier() + " is not a member of this ProcessGroup"); } @@ -2551,7 +2548,7 @@ public final class StandardProcessGroup implements ProcessGroup { public void addControllerService(final ControllerServiceNode service) { writeLock.lock(); try { - final String id = requireNonNull(service).getIdentifier(); + final String id = Objects.requireNonNull(service).getIdentifier(); final ControllerServiceNode existingService = controllerServices.get(id); if (existingService != null) { throw new IllegalStateException("A Controller Service is already registered to this ProcessGroup with ID " + id); @@ -2569,7 +2566,7 @@ public final class StandardProcessGroup implements ProcessGroup { @Override public ControllerServiceNode getControllerService(final String id) { - return controllerServices.get(requireNonNull(id)); + return controllerServices.get(Objects.requireNonNull(id)); } @Override @@ -2591,7 +2588,7 @@ public final class StandardProcessGroup implements ProcessGroup { boolean removed = false; writeLock.lock(); try { - final ControllerServiceNode existing = controllerServices.get(requireNonNull(service).getIdentifier()); + final ControllerServiceNode existing = controllerServices.get(Objects.requireNonNull(service).getIdentifier()); if (existing == null) { throw new IllegalStateException("ControllerService " + service.getIdentifier() + " is not a member of this Process Group"); } @@ -2885,7 +2882,7 @@ public final class StandardProcessGroup implements ProcessGroup { * references a component that is not part of this ProcessGroup */ private void verifyContents(final Snippet snippet) throws NullPointerException, IllegalStateException { - requireNonNull(snippet); + Objects.requireNonNull(snippet); verifyAllKeysExist(snippet.getInputPorts().keySet(), inputPorts, "Input Port"); verifyAllKeysExist(snippet.getOutputPorts().keySet(), outputPorts, "Output Port"); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/RemoteNiFiUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/RemoteNiFiUtils.java index 8cb921e769..57e00cac48 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/RemoteNiFiUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/RemoteNiFiUtils.java @@ -63,7 +63,7 @@ public class RemoteNiFiUtils { final URI uri = URI.create(String.format("%s/controller/users", baseApiUri)); // set up the query params - MultivaluedHashMap entity = new MultivaluedHashMap(); + MultivaluedHashMap entity = new MultivaluedHashMap<>(); entity.add("justification", "A Remote instance of NiFi has attempted to create a reference to this NiFi. This action must be approved first."); // get the resource diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/BundleUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/BundleUtils.java index 80708b2a64..444ff8ed46 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/BundleUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/BundleUtils.java @@ -242,7 +242,7 @@ public final class BundleUtils { public static void discoverCompatibleBundle(final ExtensionManager extensionManager, final VersionedConfigurableExtension extension) { final BundleDTO dto = createBundleDto(extension.getBundle()); - final BundleCoordinate coordinate = BundleUtils.getOptionalCompatibleBundle(extensionManager, extension.getType(), dto).orElse( + final BundleCoordinate coordinate = getOptionalCompatibleBundle(extensionManager, extension.getType(), dto).orElse( new BundleCoordinate(dto.getGroup(), dto.getArtifact(), dto.getVersion())); extension.setBundle(createBundle(coordinate)); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/events/BulletinFactory.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/events/BulletinFactory.java index ebe1ef6364..e9a0db1e08 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/events/BulletinFactory.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/events/BulletinFactory.java @@ -37,7 +37,7 @@ public final class BulletinFactory { final String groupId = connectable.getProcessGroupIdentifier(); final String groupName = group == null ? null : group.getName(); final String groupPath = buildGroupPath(group); - return BulletinFactory.createBulletin(groupId, groupName, connectable.getIdentifier(), type, connectable.getName(), category, severity, message, groupPath, null); + return createBulletin(groupId, groupName, connectable.getIdentifier(), type, connectable.getName(), category, severity, message, groupPath, null); } public static Bulletin createBulletin(final Connectable connectable, final String category, final String severity, final String message, final String flowFileUUID) { @@ -47,7 +47,7 @@ public final class BulletinFactory { final String groupId = connectable.getProcessGroupIdentifier(); final String groupName = group == null ? null : group.getName(); final String groupPath = buildGroupPath(group); - return BulletinFactory.createBulletin(groupId, groupName, connectable.getIdentifier(), type, connectable.getName(), category, severity, message, groupPath, flowFileUUID); + return createBulletin(groupId, groupName, connectable.getIdentifier(), type, connectable.getName(), category, severity, message, groupPath, flowFileUUID); } private static String buildGroupPath(ProcessGroup group) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/RingBufferGarbageCollectionLog.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/RingBufferGarbageCollectionLog.java index 37a6103482..2ced0f983a 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/RingBufferGarbageCollectionLog.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/RingBufferGarbageCollectionLog.java @@ -20,8 +20,6 @@ import com.sun.management.GarbageCollectionNotificationInfo; import com.sun.management.GcInfo; import org.apache.nifi.util.RingBuffer; import org.apache.nifi.util.Tuple; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.management.Notification; import javax.management.NotificationListener; @@ -35,7 +33,6 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicLong; public class RingBufferGarbageCollectionLog implements GarbageCollectionLog, NotificationListener { - private static final Logger logger = LoggerFactory.getLogger(RingBufferGarbageCollectionLog.class); private final RingBuffer events; private final long minDurationThreshold; private final long jvmStartTime; diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/inheritance/BundleCompatibilityCheck.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/inheritance/BundleCompatibilityCheck.java index 077bb95d1b..6673129da2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/inheritance/BundleCompatibilityCheck.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/inheritance/BundleCompatibilityCheck.java @@ -29,14 +29,11 @@ import org.apache.nifi.flow.VersionedProcessGroup; import org.apache.nifi.flow.VersionedProcessor; import org.apache.nifi.flow.VersionedReportingTask; import org.apache.nifi.nar.ExtensionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import java.util.Set; public class BundleCompatibilityCheck implements FlowInheritabilityCheck { - private static final Logger logger = LoggerFactory.getLogger(BundleCompatibilityCheck.class); @Override public FlowInheritability checkInheritability(final DataFlow existingFlow, final DataFlow proposedFlow, final FlowController flowController) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/RemoteQueuePartition.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/RemoteQueuePartition.java index 4a17356561..385e4d1d52 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/RemoteQueuePartition.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/RemoteQueuePartition.java @@ -73,6 +73,7 @@ public class RemoteQueuePartition implements QueuePartition { private final FlowFileRepository flowFileRepo; private final ProvenanceEventRepository provRepo; + @SuppressWarnings("PMD.UnusedPrivateField") private final ContentRepository contentRepo; private final AsyncLoadBalanceClientRegistry clientRegistry; diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/StatusHistoryUtil.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/StatusHistoryUtil.java index ba203982e3..f15733e344 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/StatusHistoryUtil.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/StatusHistoryUtil.java @@ -43,7 +43,7 @@ public class StatusHistoryUtil { final Set metricNames = new HashSet<>(); for (final StatusSnapshot snapshot : statusHistory.getStatusSnapshots()) { - final StatusSnapshotDTO snapshotDto = StatusHistoryUtil.createStatusSnapshotDto(snapshot); + final StatusSnapshotDTO snapshotDto = createStatusSnapshotDto(snapshot); snapshotDtos.add(snapshotDto); metricNames.addAll(snapshotDto.getStatusMetrics().keySet()); metricDescriptors.addAll(snapshot.getMetricDescriptors()); @@ -63,7 +63,7 @@ public class StatusHistoryUtil { final StatusHistoryDTO dto = new StatusHistoryDTO(); dto.setGenerated(new Date()); dto.setComponentDetails(componentDetails); - dto.setFieldDescriptors(StatusHistoryUtil.createFieldDescriptorDtos(metricDescriptors)); + dto.setFieldDescriptors(createFieldDescriptorDtos(metricDescriptors)); dto.setAggregateSnapshots(snapshotDtos); return dto; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/flowanalysis/GhostFlowAnalysisRule.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/flowanalysis/GhostFlowAnalysisRule.java index 5a204c3850..335b4eab55 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/flowanalysis/GhostFlowAnalysisRule.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/flowanalysis/GhostFlowAnalysisRule.java @@ -20,7 +20,6 @@ package org.apache.nifi.flowanalysis; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; -import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.reporting.InitializationException; import java.util.Collection; import java.util.Collections; @@ -30,7 +29,6 @@ public class GhostFlowAnalysisRule implements FlowAnalysisRule { private String id; private String canonicalClassName; - private ComponentLog logger; public void setIdentifier(final String id) { this.id = id; @@ -85,6 +83,6 @@ public class GhostFlowAnalysisRule implements FlowAnalysisRule { @Override public void initialize(FlowAnalysisRuleInitializationContext context) throws InitializationException { - this.logger = context.getLogger(); + } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/manifest/StandardRuntimeManifestService.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/manifest/StandardRuntimeManifestService.java index bf7075db8d..1a7f3ef214 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/manifest/StandardRuntimeManifestService.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/manifest/StandardRuntimeManifestService.java @@ -248,7 +248,7 @@ public class StandardRuntimeManifestService implements RuntimeManifestService { return property; } - private static List getDependencies(org.apache.nifi.python.processor.documentation.PropertyDescription propertyDescription) { + private static List getDependencies(final PropertyDescription propertyDescription) { return Optional.ofNullable(propertyDescription.getDependencies()).orElse(List.of()) .stream() .map(value -> { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/GhostParameterProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/GhostParameterProvider.java index 775cf76a19..364870dca6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/GhostParameterProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/GhostParameterProvider.java @@ -21,7 +21,6 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; import org.apache.nifi.controller.ConfigurationContext; -import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.reporting.InitializationException; @@ -33,7 +32,6 @@ public class GhostParameterProvider implements ParameterProvider { private String id; private String canonicalClassName; - private ComponentLog logger; public void setIdentifier(final String id) { this.id = id; @@ -88,7 +86,7 @@ public class GhostParameterProvider implements ParameterProvider { @Override public void initialize(final ParameterProviderInitializationContext config) throws InitializationException { - this.logger = config.getLogger(); + } @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/reporting/GhostReportingTask.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/reporting/GhostReportingTask.java index 71a8236909..d06fe6b96f 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/reporting/GhostReportingTask.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/reporting/GhostReportingTask.java @@ -24,14 +24,12 @@ import java.util.List; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; -import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.exception.ProcessException; public class GhostReportingTask implements ReportingTask { private String id; private String canonicalClassName; - private ComponentLog logger; public void setIdentifier(final String id) { this.id = id; @@ -86,7 +84,7 @@ public class GhostReportingTask implements ReportingTask { @Override public void initialize(ReportingInitializationContext config) throws InitializationException { - this.logger = config.getLogger(); + } @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java index a38b399b62..d56e64eac6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java @@ -63,7 +63,7 @@ import org.apache.nifi.util.NiFiProperties; */ public class NarThreadContextClassLoader extends URLClassLoader { - private final ClassLoader forward = ClassLoader.getSystemClassLoader(); + private final ClassLoader forward = getSystemClassLoader(); private static final List> narSpecificClasses = new ArrayList<>(); static { diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java index 83cff73022..2bb20bf5af 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java @@ -52,6 +52,7 @@ public final class NarClassLoaders { private volatile InitContext initContext; private static final Logger logger = LoggerFactory.getLogger(NarClassLoaders.class); + @SuppressWarnings("PMD.UnusedPrivateField") private final static class InitContext { private final File frameworkWorkingDir; @@ -101,13 +102,13 @@ public final class NarClassLoaders { } public void init(File frameworkWorkingDir, File extensionsWorkingDir) throws IOException, ClassNotFoundException { - init(frameworkWorkingDir, extensionsWorkingDir, NarClassLoaders.FRAMEWORK_NAR_ID); + init(frameworkWorkingDir, extensionsWorkingDir, FRAMEWORK_NAR_ID); } // Default to NiFi's framework NAR ID public void init(final ClassLoader rootClassloader, final File frameworkWorkingDir, final File extensionsWorkingDir, final boolean logDetails) throws IOException, ClassNotFoundException { - init(rootClassloader, frameworkWorkingDir, extensionsWorkingDir, NarClassLoaders.FRAMEWORK_NAR_ID, logDetails); + init(rootClassloader, frameworkWorkingDir, extensionsWorkingDir, FRAMEWORK_NAR_ID, logDetails); } /** diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java index ad06041c57..33fc26894d 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java @@ -69,7 +69,7 @@ public class FileUtils { * @return true if deleted */ public static boolean deleteFile(final File file, final Logger logger) { - return FileUtils.deleteFile(file, logger, 1); + return deleteFile(file, logger, 1); } /** @@ -93,7 +93,7 @@ public class FileUtils { for (int i = 0; i < effectiveAttempts && !isGone; i++) { isGone = file.delete() || !file.exists(); if (!isGone && (effectiveAttempts - i) > 1) { - FileUtils.sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); + sleepQuietly(MILLIS_BETWEEN_ATTEMPTS); } } if (!isGone && logger != null) { @@ -120,7 +120,7 @@ public class FileUtils { * if an I/O error occurs */ public static void deleteFilesInDirectory(final File directory, final FilenameFilter filter, final Logger logger) throws IOException { - FileUtils.deleteFilesInDirectory(directory, filter, logger, false); + deleteFilesInDirectory(directory, filter, logger, false); } /** @@ -136,7 +136,7 @@ public class FileUtils { * if an I/O error occurs */ public static void deleteFilesInDirectory(final File directory, final FilenameFilter filter, final Logger logger, final boolean recurse) throws IOException { - FileUtils.deleteFilesInDirectory(directory, filter, logger, recurse, false); + deleteFilesInDirectory(directory, filter, logger, recurse, false); } /** @@ -164,12 +164,12 @@ public class FileUtils { for (File ingestFile : ingestFiles) { boolean process = (filter == null) || filter.accept(directory, ingestFile.getName()); if (ingestFile.isFile() && process) { - FileUtils.deleteFile(ingestFile, logger, 3); + deleteFile(ingestFile, logger, 3); } if (ingestFile.isDirectory() && recurse) { - FileUtils.deleteFilesInDirectory(ingestFile, filter, logger, recurse, deleteEmptyDirectories); + deleteFilesInDirectory(ingestFile, filter, logger, recurse, deleteEmptyDirectories); if (deleteEmptyDirectories && ingestFile.list().length == 0) { - FileUtils.deleteFile(ingestFile, logger, 3); + deleteFile(ingestFile, logger, 3); } } } @@ -185,17 +185,17 @@ public class FileUtils { */ public static void deleteFiles(final Collection files, final boolean recurse) throws IOException { for (final File file : files) { - FileUtils.deleteFile(file, recurse); + deleteFile(file, recurse); } } public static void deleteFile(final File file, final boolean recurse) throws IOException { final File[] list = file.listFiles(); if (file.isDirectory() && recurse && list != null) { - FileUtils.deleteFiles(Arrays.asList(list), recurse); + deleteFiles(Arrays.asList(list), recurse); } //now delete the file itself regardless of whether it is plain file or a directory - if (!FileUtils.deleteFile(file, null, 5)) { + if (!deleteFile(file, null, 5)) { throw new IOException("Unable to delete " + file.getAbsolutePath()); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml b/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml index 40d115880c..0ace326653 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml +++ b/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml @@ -282,7 +282,7 @@ single - package + compile src/main/assembly/dependencies.xml diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/HttpRemoteSiteListener.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/HttpRemoteSiteListener.java index 23edca61ff..8a0ef86874 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/HttpRemoteSiteListener.java +++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/HttpRemoteSiteListener.java @@ -41,7 +41,7 @@ public class HttpRemoteSiteListener implements RemoteSiteListener { private static final Logger logger = LoggerFactory.getLogger(HttpRemoteSiteListener.class); private final int transactionTtlSec; - private static HttpRemoteSiteListener instance; + private static volatile HttpRemoteSiteListener instance; private final Map transactions = new ConcurrentHashMap<>(); private final ScheduledExecutorService taskExecutor; diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardPublicPort.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardPublicPort.java index d70905b08a..b0d96c6e23 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardPublicPort.java +++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardPublicPort.java @@ -88,6 +88,7 @@ public class StandardPublicPort extends AbstractPort implements PublicPort { @SuppressWarnings("unused") private final BulletinRepository bulletinRepository; private final EventReporter eventReporter; + @SuppressWarnings("PMD.UnusedPrivateField") private final ProcessScheduler scheduler; private final Set relationships; @@ -126,7 +127,7 @@ public class StandardPublicPort extends AbstractPort implements PublicPort { } }; - relationships = direction == TransferDirection.RECEIVE ? Collections.singleton(AbstractPort.PORT_RELATIONSHIP) : Collections.emptySet(); + relationships = direction == TransferDirection.RECEIVE ? Collections.singleton(PORT_RELATIONSHIP) : Collections.emptySet(); } @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui/pom.xml b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui/pom.xml index 638f98b728..face96c435 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui/pom.xml +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui/pom.xml @@ -50,7 +50,7 @@ unpack-nifi-ui - generate-resources + prepare-package unpack-dependencies diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java index b342cbc7c6..e4d0b472fe 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java @@ -66,7 +66,7 @@ public class RemoteProcessGroupAuditor extends NiFiAuditor { private static final Function IS_TRANSPORT_PROTOCOL_SET = dto -> dto.getTransportProtocol() != null; private static final List> CONFIG_RECORDERS = Arrays.asList( - new ConfigurationRecorder("Communications Timeout", + new ConfigurationRecorder<>("Communications Timeout", dto -> dto.getCommunicationsTimeout() != null, RemoteProcessGroup::getCommunicationsTimeout), new ConfigurationRecorder<>("Yield Duration", dto -> dto.getYieldDuration() != null, RemoteProcessGroup::getYieldDuration), diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/StandardAuthorizableLookup.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/StandardAuthorizableLookup.java index 1352fc1db6..a616e0d909 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/StandardAuthorizableLookup.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/StandardAuthorizableLookup.java @@ -324,7 +324,7 @@ public class StandardAuthorizableLookup implements AuthorizableLookup { } @Override - public Set getControllerServices(final String groupId, final Predicate filter) { + public Set getControllerServices(final String groupId, final Predicate filter) { return controllerServiceDAO.getControllerServices(groupId, true, false).stream() .filter(cs -> filter.test(new VersionedComponentAuthorizable() { @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java index 83b8250736..0d4a82e7d3 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java @@ -75,7 +75,7 @@ public class StandardNiFiContentAccess implements ContentAccess { } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); parameters.add(CLIENT_ID_PARAM, request.getClientId()); // set the headers diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java index a172bdb089..475e7acf9d 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java @@ -89,6 +89,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration private ClusterCoordinator clusterCoordinator; private RequestReplicator requestReplicator; private ControllerServiceProvider controllerServiceProvider; + @SuppressWarnings("PMD.UnusedPrivateField") private ReportingTaskProvider reportingTaskProvider; private AuditService auditService; private Authorizer authorizer; @@ -365,7 +366,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); // replicate request NodeResponse nodeResponse; @@ -548,7 +549,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); // replicate request NodeResponse nodeResponse; @@ -693,7 +694,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); // replicate request NodeResponse nodeResponse; @@ -839,7 +840,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); // replicate request NodeResponse nodeResponse; @@ -984,7 +985,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } // set the request parameters - final MultivaluedMap parameters = new MultivaluedHashMap(); + final MultivaluedMap parameters = new MultivaluedHashMap<>(); // replicate request NodeResponse nodeResponse; diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/search/attributematchers/SearchableMatcher.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/search/attributematchers/SearchableMatcher.java index c12e8a50d4..bfe6b6f1a4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/search/attributematchers/SearchableMatcher.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/search/attributematchers/SearchableMatcher.java @@ -45,10 +45,9 @@ public class SearchableMatcher implements AttributeMatcher { // search the processor using the appropriate thread context classloader try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), component.getClass(), component.getIdentifier())) { - searchable.search(context).stream().forEach(searchResult -> matches.add(searchResult.getLabel() + AttributeMatcher.SEPARATOR + searchResult.getMatch())); + searchable.search(context).stream().forEach(searchResult -> matches.add(searchResult.getLabel() + SEPARATOR + searchResult.getMatch())); } catch (final Throwable t) { LOGGER.error("Error happened during searchable matching: {}", t.getMessage()); - t.printStackTrace(); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509CertificateValidator.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509CertificateValidator.java index cb56a11ebe..511c5e5e63 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509CertificateValidator.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509CertificateValidator.java @@ -21,16 +21,12 @@ import java.security.cert.CertificateNotYetValidException; import java.security.cert.X509Certificate; import org.apache.nifi.web.security.x509.ocsp.CertificateStatusException; import org.apache.nifi.web.security.x509.ocsp.OcspCertificateValidator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Extracts client certificates from Http requests. */ public class X509CertificateValidator { - private final Logger logger = LoggerFactory.getLogger(getClass()); - private OcspCertificateValidator ocspValidator; /** diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspStatus.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspStatus.java index 7d04bfb016..563259e72d 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspStatus.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspStatus.java @@ -33,18 +33,16 @@ public class OcspStatus { } public enum VerificationStatus { - Unknown, Verified, Unverified - }; + } public enum ValidationStatus { - Unknown, Good, Revoked - }; + } private ResponseStatus responseStatus; private VerificationStatus verificationStatus; diff --git a/nifi-manifest/nifi-runtime-manifest-test/pom.xml b/nifi-manifest/nifi-runtime-manifest-test/pom.xml index a300ee140e..8f77f20e1d 100644 --- a/nifi-manifest/nifi-runtime-manifest-test/pom.xml +++ b/nifi-manifest/nifi-runtime-manifest-test/pom.xml @@ -44,29 +44,30 @@ org.apache.nifi nifi-runtime-manifest 2.1.0-SNAPSHOT + test maven-dependency-plugin - - - org.apache.nifi:nifi-runtime-manifest - - extract-runtime-manifest - unpack-dependencies + unpack - generate-resources + pre-integration-test - nifi-runtime-manifest ${project.build.directory}/nifi-runtime-manifest - true false + + + org.apache.nifi + nifi-runtime-manifest + ${project.version} + + diff --git a/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java b/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/RuntimeManifestIT.java similarity index 99% rename from nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java rename to nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/RuntimeManifestIT.java index bfa1fca670..7e3ee7d0ea 100644 --- a/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java +++ b/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/RuntimeManifestIT.java @@ -47,9 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -class TestRuntimeManifest { - - private static final String REPORTING_TASK_DEFAULT_SCHEDULE_TIME = "60 sec"; +class RuntimeManifestIT { @Test void testRuntimeManifest() throws IOException { diff --git a/nifi-manifest/nifi-runtime-manifest/pom.xml b/nifi-manifest/nifi-runtime-manifest/pom.xml index 6708b7c4f4..fe401ad545 100644 --- a/nifi-manifest/nifi-runtime-manifest/pom.xml +++ b/nifi-manifest/nifi-runtime-manifest/pom.xml @@ -30,20 +30,6 @@ apache-nifi - - - - org.apache.nifi - nifi-assembly - 2.1.0-SNAPSHOT - manifests - zip - true - - - - @@ -86,15 +72,21 @@ extract-extension-manifests - unpack-dependencies + unpack - generate-resources + prepare-package - nifi-assembly - manifests - true ${extension.manifest.unpack.dir} true + + + org.apache.nifi + nifi-assembly + ${project.version} + manifests + zip + + diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockFlowFile.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockFlowFile.java index 31e4720a91..48f933e493 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockFlowFile.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockFlowFile.java @@ -45,7 +45,6 @@ public class MockFlowFile implements FlowFile { private final long id; private final long entryDate; - private final long creationTime; private boolean penalized = false; private byte[] data = new byte[0]; @@ -54,7 +53,6 @@ public class MockFlowFile implements FlowFile { private long enqueuedIndex = 0; public MockFlowFile(final long id) { - this.creationTime = System.nanoTime(); this.id = id; entryDate = System.currentTimeMillis(); lastEnqueuedDate = entryDate; @@ -66,7 +64,6 @@ public class MockFlowFile implements FlowFile { } public MockFlowFile(final long id, final FlowFile toCopy) { - this.creationTime = System.nanoTime(); this.id = id; entryDate = toCopy.getEntryDate(); diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java index 4dfd21447d..93e3c550f4 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java @@ -47,8 +47,6 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import static java.util.Objects.requireNonNull; - public class MockProcessContext extends MockControllerServiceLookup implements ProcessContext, ControllerServiceLookup, NodeTypeProvider { private final ConfigurableComponent component; @@ -195,8 +193,8 @@ public class MockProcessContext extends MockControllerServiceLookup implements P * @return result */ public ValidationResult setProperty(final PropertyDescriptor descriptor, final String value) { - requireNonNull(descriptor, "Cannot set property for null descriptor"); - requireNonNull(value, "Cannot set property " + descriptor.getName() + " to null value; if the intent is to remove the property, call removeProperty instead"); + Objects.requireNonNull(descriptor, "Cannot set property for null descriptor"); + Objects.requireNonNull(value, "Cannot set property " + descriptor.getName() + " to null value; if the intent is to remove the property, call removeProperty instead"); final PropertyDescriptor fullyPopulatedDescriptor = component.getPropertyDescriptor(descriptor.getName()); final ValidationResult result = fullyPopulatedDescriptor.validate(value, new MockValidationContext(this, stateManager)); @@ -249,7 +247,7 @@ public class MockProcessContext extends MockControllerServiceLookup implements P } public void addControllerService(final ControllerService controllerService, final Map properties, final String annotationData) { - requireNonNull(controllerService); + Objects.requireNonNull(controllerService); final ControllerServiceConfiguration config = addControllerService(controllerService); config.setProperties(properties); config.setAnnotationData(annotationData); diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java b/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java index db75da152a..7f1d848075 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java @@ -73,9 +73,10 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Predicate; import java.util.stream.Collectors; -import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.toSet; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class StandardProcessorTestRunner implements TestRunner { @@ -387,17 +388,17 @@ public class StandardProcessorTestRunner implements TestRunner { @Override public void assertTransferCount(final Relationship relationship, final int count) { - Assertions.assertEquals(count, getFlowFilesForRelationship(relationship).size()); + assertEquals(count, getFlowFilesForRelationship(relationship).size()); } @Override public void assertTransferCount(final String relationship, final int count) { - Assertions.assertEquals(count, getFlowFilesForRelationship(relationship).size()); + assertEquals(count, getFlowFilesForRelationship(relationship).size()); } @Override public void assertPenalizeCount(final int count) { - Assertions.assertEquals(count, getPenalizedFlowFiles().size()); + assertEquals(count, getPenalizedFlowFiles().size()); } @Override @@ -412,7 +413,7 @@ public class StandardProcessorTestRunner implements TestRunner { @Override public void assertNotValid() { - Assertions.assertFalse(context.isValid(), "Processor appears to be valid but expected it to be invalid"); + assertFalse(context.isValid(), "Processor appears to be valid but expected it to be invalid"); } @Override @@ -422,12 +423,12 @@ public class StandardProcessorTestRunner implements TestRunner { @Override public void assertQueueEmpty() { - Assertions.assertTrue(flowFileQueue.isEmpty()); + assertTrue(flowFileQueue.isEmpty()); } @Override public void assertQueueNotEmpty() { - Assertions.assertFalse(flowFileQueue.isEmpty()); + assertFalse(flowFileQueue.isEmpty()); } @Override @@ -654,7 +655,7 @@ public class StandardProcessorTestRunner implements TestRunner { controllerServiceLoggers.put(identifier, mockComponentLog); final MockStateManager serviceStateManager = new MockStateManager(service); final MockControllerServiceInitializationContext initContext = new MockControllerServiceInitializationContext( - requireNonNull(service), requireNonNull(identifier), mockComponentLog, serviceStateManager, kerberosContext); + Objects.requireNonNull(service), Objects.requireNonNull(identifier), mockComponentLog, serviceStateManager, kerberosContext); controllerServiceStateManagers.put(identifier, serviceStateManager); initContext.addControllerServices(context); service.initialize(initContext); diff --git a/nifi-registry/nifi-registry-assembly/pom.xml b/nifi-registry/nifi-registry-assembly/pom.xml index 259819b616..01ce590b73 100644 --- a/nifi-registry/nifi-registry-assembly/pom.xml +++ b/nifi-registry/nifi-registry-assembly/pom.xml @@ -232,16 +232,6 @@ ./ext/aws/lib - - - org.apache.nifi.registry - nifi-registry-aws-assembly - 2.1.0-SNAPSHOT - bin - runtime - ${nifi.registry.extension.archive.type} - - @@ -250,14 +240,20 @@ unpack-aws-extensions - unpack-dependencies + unpack - generate-resources + prepare-package ${project.build.directory}/ext/aws - org.apache.nifi.registry - nifi-registry-aws-assembly - false + + + org.apache.nifi.registry + nifi-registry-aws-assembly + ${project.version} + bin + ${nifi.registry.extension.archive.type} + + diff --git a/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml index ce334f6ded..84ae3495b9 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml @@ -40,7 +40,7 @@ copy-asciidoc - generate-resources + process-resources copy-resources @@ -62,7 +62,7 @@ output-html - prepare-package + process-resources process-asciidoc @@ -171,7 +171,7 @@ single - package + process-resources src/main/assembly/dependencies.xml diff --git a/nifi-registry/nifi-registry-core/nifi-registry-flow-diff/src/main/java/org/apache/nifi/registry/flow/diff/StandardFlowComparator.java b/nifi-registry/nifi-registry-core/nifi-registry-flow-diff/src/main/java/org/apache/nifi/registry/flow/diff/StandardFlowComparator.java index 1b87ce1fab..b2e4adb337 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-flow-diff/src/main/java/org/apache/nifi/registry/flow/diff/StandardFlowComparator.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-flow-diff/src/main/java/org/apache/nifi/registry/flow/diff/StandardFlowComparator.java @@ -623,7 +623,6 @@ public class StandardFlowComparator implements FlowComparator { final String storageLocationB = coordinatesB.getStorageLocation(); if (storageLocationA != null && storageLocationB != null && !storageLocationA.equals(storageLocationB)) { differences.add(difference(DifferenceType.VERSIONED_FLOW_COORDINATES_CHANGED, groupA, groupB, coordinatesA, coordinatesB)); - return; } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/Flow.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/Flow.java index 488a619e0f..da0e938aca 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/Flow.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/Flow.java @@ -24,6 +24,7 @@ class Flow { /** * The ID of a Flow. It never changes. */ + @SuppressWarnings("PMD.UnusedPrivateField") private final String flowId; /** diff --git a/nifi-registry/nifi-registry-core/nifi-registry-resources/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-resources/pom.xml index 538223f875..0734e958b4 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-resources/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-resources/pom.xml @@ -36,7 +36,7 @@ single - package + process-resources src/main/assembly/dependencies.xml diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java index 9e34164c9b..04f435e649 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java @@ -24,15 +24,13 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import jakarta.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; -import java.sql.SQLException; @Configuration @Profile("postgres-10") public class Postgres10DataSourceFactory extends TestDataSourceFactory { - private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:10"); + private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:10"); static { POSTGRESQL_CONTAINER.start(); @@ -48,7 +46,7 @@ public class Postgres10DataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java index 03069ede80..fe64089049 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java @@ -23,15 +23,13 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import jakarta.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; -import java.sql.SQLException; @Configuration @Profile("postgres-11") public class Postgres11DataSourceFactory extends TestDataSourceFactory { - private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:11"); + private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:11"); static { POSTGRESQL_CONTAINER.start(); @@ -47,7 +45,7 @@ public class Postgres11DataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java index 5a4e41e45e..57e5d259b0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java @@ -23,15 +23,13 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import jakarta.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; -import java.sql.SQLException; @Configuration @Profile("postgres-12") public class Postgres12DataSourceFactory extends TestDataSourceFactory { - private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:12"); + private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:12"); static { POSTGRESQL_CONTAINER.start(); @@ -47,7 +45,7 @@ public class Postgres12DataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java index 99f0b1f722..493b7c7cda 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java @@ -23,15 +23,13 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import jakarta.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; -import java.sql.SQLException; @Configuration @Profile("postgres-13") public class Postgres13DataSourceFactory extends TestDataSourceFactory { - private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:13"); + private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:13"); static { POSTGRESQL_CONTAINER.start(); @@ -47,7 +45,7 @@ public class Postgres13DataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java index 8664f400eb..3b5932750d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java @@ -24,15 +24,13 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import jakarta.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; -import java.sql.SQLException; @Configuration @Profile("postgres-14") public class Postgres14DataSourceFactory extends TestDataSourceFactory { - private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:14"); + private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:14"); static { POSTGRESQL_CONTAINER.start(); @@ -48,7 +46,7 @@ public class Postgres14DataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); } diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessProvenanceRepository.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessProvenanceRepository.java index cb084d76d7..b7ddeabc2a 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessProvenanceRepository.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessProvenanceRepository.java @@ -91,7 +91,7 @@ public class StatelessProvenanceRepository implements ProvenanceRepository { @Override public List getEvents(final long firstRecordId, final int maxRecords, final NiFiUser user) throws IOException { - return ringBuffer.getSelectedElements(new RingBuffer.Filter() { + return ringBuffer.getSelectedElements(new RingBuffer.Filter<>() { @Override public boolean select(final ProvenanceEventRecord value) { return value.getEventId() >= firstRecordId; @@ -106,7 +106,7 @@ public class StatelessProvenanceRepository implements ProvenanceRepository { } public ProvenanceEventRecord getEvent(final String identifier) throws IOException { - final List records = ringBuffer.getSelectedElements(new RingBuffer.Filter() { + final List records = ringBuffer.getSelectedElements(new RingBuffer.Filter<>() { @Override public boolean select(final ProvenanceEventRecord event) { return identifier.equals(event.getFlowFileUuid()); @@ -117,7 +117,7 @@ public class StatelessProvenanceRepository implements ProvenanceRepository { @Override public ProvenanceEventRecord getEvent(final long id) { - final List records = ringBuffer.getSelectedElements(new RingBuffer.Filter() { + final List records = ringBuffer.getSelectedElements(new RingBuffer.Filter<>() { @Override public boolean select(final ProvenanceEventRecord event) { return event.getEventId() == id; diff --git a/nifi-stateless/nifi-stateless-resources/pom.xml b/nifi-stateless/nifi-stateless-resources/pom.xml index 552170c66d..7b62b9e1c3 100644 --- a/nifi-stateless/nifi-stateless-resources/pom.xml +++ b/nifi-stateless/nifi-stateless-resources/pom.xml @@ -36,7 +36,7 @@ single - package + process-resources src/main/assembly/dependencies.xml diff --git a/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml b/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml index 61fb896edd..353857fe8d 100644 --- a/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml +++ b/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml @@ -168,7 +168,7 @@ single - generate-test-resources + pre-integration-test 0775 diff --git a/nifi-system-tests/nifi-system-test-nar-provider-bundles/nifi-nar-provider-assembly/pom.xml b/nifi-system-tests/nifi-system-test-nar-provider-bundles/nifi-nar-provider-assembly/pom.xml index 865112f80c..b6b1c40c37 100644 --- a/nifi-system-tests/nifi-system-test-nar-provider-bundles/nifi-nar-provider-assembly/pom.xml +++ b/nifi-system-tests/nifi-system-test-nar-provider-bundles/nifi-nar-provider-assembly/pom.xml @@ -60,7 +60,7 @@ single - generate-resources + pre-integration-test 0775 diff --git a/nifi-system-tests/nifi-system-test-suite/pom.xml b/nifi-system-tests/nifi-system-test-suite/pom.xml index 68f45569c7..6921e953a3 100644 --- a/nifi-system-tests/nifi-system-test-suite/pom.xml +++ b/nifi-system-tests/nifi-system-test-suite/pom.xml @@ -70,7 +70,7 @@ single - generate-test-resources + pre-integration-test 0775 @@ -94,14 +94,21 @@ extract-nar-provider-nars - unpack-dependencies + unpack - generate-test-resources + pre-integration-test - nifi-nar-provider-assembly - true ${project.build.directory} true + + + org.apache.nifi + nifi-nar-provider-assembly + ${project.version} + assembly + zip + + @@ -223,6 +230,12 @@ 2.1.0-SNAPSHOT compile + + org.apache.nifi + nifi-security-cert-builder + 2.1.0-SNAPSHOT + compile + org.apache.nifi nifi-per-process-group-logging @@ -277,6 +290,7 @@ org.apache.nifi nifi-bootstrap 2.1.0-SNAPSHOT + compile org.apache.nifi @@ -353,11 +367,8 @@ org.apache.nifi nifi-nar-provider-assembly 2.1.0-SNAPSHOT - assembly - zip - org.apache.nifi diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/AbstractUpdateParamContextCommand.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/AbstractUpdateParamContextCommand.java index 5ddf77c0c8..45718de490 100644 --- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/AbstractUpdateParamContextCommand.java +++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/AbstractUpdateParamContextCommand.java @@ -60,43 +60,41 @@ public abstract class AbstractUpdateParamContextCommand extend // the request will be deleted final String contextId = parameterContextEntity.getId(); final String updateRequestId = updateRequestEntity.getRequest().getRequestId(); - try { - boolean completed = false; - for (int i = 0; i < maxPollIterations; i++) { - final ParameterContextUpdateRequestEntity retrievedUpdateRequest = client.getParamContextUpdateRequest(contextId, updateRequestId); - if (retrievedUpdateRequest != null && retrievedUpdateRequest.getRequest().isComplete()) { - completed = true; - break; - } else { - try { - if (getContext().isInteractive()) { - println("Waiting for update request to complete..."); - } - Thread.sleep(POLL_INTERVAL_MILLIS); - } catch (InterruptedException e) { - e.printStackTrace(); + + boolean completed = false; + for (int i = 0; i < maxPollIterations; i++) { + final ParameterContextUpdateRequestEntity retrievedUpdateRequest = client.getParamContextUpdateRequest(contextId, updateRequestId); + if (retrievedUpdateRequest != null && retrievedUpdateRequest.getRequest().isComplete()) { + completed = true; + break; + } else { + try { + if (getContext().isInteractive()) { + println("Waiting for update request to complete..."); } + Thread.sleep(POLL_INTERVAL_MILLIS); + } catch (InterruptedException e) { + println("Update request polling interrupted"); } } - - if (!completed) { - cancelled.set(true); - } - - } finally { - final ParameterContextUpdateRequestEntity deleteUpdateRequest = client.deleteParamContextUpdateRequest(contextId, updateRequestId); - - final String failureReason = deleteUpdateRequest.getRequest().getFailureReason(); - if (!StringUtils.isBlank(failureReason)) { - throw new NiFiClientException(failureReason); - } - - if (cancelled.get()) { - throw new NiFiClientException("Unable to update parameter context in time, cancelling update request"); - } - - return deleteUpdateRequest; } + + if (!completed) { + cancelled.set(true); + } + + final ParameterContextUpdateRequestEntity deleteParamContextUpdateRequest = client.deleteParamContextUpdateRequest(contextId, updateRequestId); + + final String failureReason = deleteParamContextUpdateRequest.getRequest().getFailureReason(); + if (!StringUtils.isBlank(failureReason)) { + throw new NiFiClientException(failureReason); + } + + if (cancelled.get()) { + throw new NiFiClientException("Unable to update parameter context in time, cancelling update request"); + } + + return deleteParamContextUpdateRequest; } protected int getUpdateTimeout(final Properties properties) { diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml new file mode 100644 index 0000000000..bca69c945b --- /dev/null +++ b/pmd-ruleset.xml @@ -0,0 +1,69 @@ + + + + + Default PMD Rules for Apache NiFi + + .*/antlr/AttributeExpressionParser\.java + .*/antlr/AttributeExpressionLexer\.java + .*/antlr/HL7QueryParser\.java + .*/antlr/HL7QueryLexer\.java + .*/path/RecordPathParser\.java + .*/path/RecordPathLexer\.java + .*/generated/.+?\.java + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index b00558a123..a901fea5d1 100644 --- a/pom.xml +++ b/pom.xml @@ -128,6 +128,7 @@ 4.5.14 4.4.16 1.79 + 7.8.0 1.20.4 2.0.16 2.9.0 @@ -789,6 +790,23 @@ maven-jar-plugin 3.4.2 + + org.apache.maven.plugins + maven-pmd-plugin + 3.26.0 + + + net.sourceforge.pmd + pmd-core + ${pmd.version} + + + net.sourceforge.pmd + pmd-java + ${pmd.version} + + + @@ -976,6 +994,18 @@ + + org.apache.maven.plugins + maven-pmd-plugin + + true + false + ${maven.compiler.release} + + pmd-ruleset.xml + + + @@ -1107,6 +1137,19 @@ + + org.apache.maven.plugins + maven-pmd-plugin + + + check + compile + + check + + + +