You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2025/01/16 13:50:35 UTC
(nifi) branch main updated: NIFI-14140 Applied PMD UnusedLocalVariable Rule and Fixed Violations (#9630)
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new f4b2f04102 NIFI-14140 Applied PMD UnusedLocalVariable Rule and Fixed Violations (#9630)
f4b2f04102 is described below
commit f4b2f0410228cd36ef3cc730731a7a8ae58d15b3
Author: dan-s1 <ds...@gmail.com>
AuthorDate: Thu Jan 16 08:50:30 2025 -0500
NIFI-14140 Applied PMD UnusedLocalVariable Rule and Fixed Violations (#9630)
Signed-off-by: David Handermann <ex...@apache.org>
---
.../nifi/minifi/toolkit/schema/ConfigSchema.java | 1 -
.../org/apache/nifi/util/NiFiPropertiesTest.java | 2 +-
.../nifi/processors/aws/s3/TestDeleteS3Object.java | 1 -
.../evtx/parser/bxml/value/SystemtimeTypeNode.java | 2 +-
.../nifi/dbcp/AbstractDBCPConnectionPool.java | 2 +-
.../processors/gcp/storage/ListGCSBucketTest.java | 1 -
.../FlowFileStreamUnpackerSequenceFileWriter.java | 2 +-
.../cacheclient/HazelcastMapCacheClient.java | 2 +-
.../apache/nifi/kafka/processors/ConsumeKafka.java | 1 -
.../script/TestScriptedTransformRecord.java | 1 +
.../nifi/services/smb/SmbjClientServiceIT.java | 3 --
.../KubernetesSecretParameterProvider.java | 1 -
.../nifi/processors/standard/ReplaceText.java | 1 -
.../processors/standard/PutDatabaseRecordTest.java | 14 ---------
.../standard/QueryDatabaseTableTest.java | 1 -
.../processors/standard/TestExecuteSQLRecord.java | 1 -
.../standard/TestExtractTextNamedGroups.java | 1 -
.../nifi/processors/standard/TestGetFile.java | 5 +--
.../nifi/processors/standard/TestListFile.java | 2 +-
.../nifi/processors/standard/TestPutTCP.java | 2 +-
.../apache/nifi/dbcp/HikariCPConnectionPool.java | 2 +-
.../json/TestInferJsonSchemaAccessStrategy.java | 4 +--
.../org/apache/nifi/xml/TestInferXmlSchema.java | 1 -
.../org/apache/nifi/authorization/TestUser.java | 4 ---
.../nifi/provenance/toc/TestStandardTocWriter.java | 2 +-
.../AccessPolicyProviderInvocationHandler.java | 2 +-
.../authorization/AuthorizerInvocationHandler.java | 2 +-
.../UserGroupProviderInvocationHandler.java | 2 +-
.../jaxb/message/TestJaxbProtocolUtils.java | 1 -
.../endpoints/TestProcessorEndpointMerger.java | 1 -
.../impl/FileBasedClusterNodeFirewallTest.java | 3 +-
.../nifi/controller/StandardProcessorNode.java | 28 ++++++++---------
.../nifi/controller/flow/AbstractFlowManager.java | 6 ++--
.../flowanalysis/AbstractFlowAnalysisRuleNode.java | 6 ++--
.../parameter/StandardParameterProviderNode.java | 4 +--
.../reporting/AbstractReportingTaskNode.java | 6 ++--
...StandardControllerServiceInvocationHandler.java | 2 +-
.../service/StandardControllerServiceNode.java | 10 +++---
.../manager/StandardStateManagerProvider.java | 36 +++++++++++-----------
.../apache/nifi/groups/StandardProcessGroup.java | 6 ++--
.../flow/StandardFlowRegistryClientNode.java | 4 +--
.../parameter/TestStandardParameterContext.java | 1 -
.../nifi/controller/AbstractComponentNode.java | 16 +++++-----
.../components/ClassLoaderAwarePythonBridge.java | 24 +++++++--------
.../apache/nifi/controller/ExtensionBuilder.java | 2 +-
.../org/apache/nifi/controller/FlowController.java | 28 ++++++++---------
.../nifi/controller/StandardReloadComponent.java | 10 +++---
.../nifi/controller/flow/StandardFlowManager.java | 18 +++++------
.../scheduling/StandardProcessScheduler.java | 12 ++++----
.../local/WriteAheadLocalStateProvider.java | 1 -
.../nifi/controller/tasks/ConnectableTask.java | 2 +-
.../controller/tasks/ReportingTaskWrapper.java | 4 +--
.../nar/NarPersistenceProviderFactoryBean.java | 18 +++++------
.../nifi/controller/TestFileSystemSwapManager.java | 24 ++++++---------
.../repository/StandardProcessSessionIT.java | 8 ++---
.../repository/TestFileSystemRepository.java | 6 ++--
.../scheduling/TestStandardProcessScheduler.java | 1 +
.../CollisionAwareResourceProviderWorker.java | 2 +-
...ictResolvingExternalResourceProviderWorker.java | 2 +-
.../apache/nifi/FlowRegistryClientInitializer.java | 4 +--
.../nifi/init/ControllerServiceInitializer.java | 4 +--
.../nifi/init/FlowAnalysisRuleInitializer.java | 4 +--
.../nifi/init/ParameterProviderInitializer.java | 4 +--
.../org/apache/nifi/init/ProcessorInitializer.java | 4 +--
.../apache/nifi/init/ReportingTaskInitializer.java | 4 +--
.../nar/StandardExtensionDiscoveringManager.java | 6 ++--
.../apache/nifi/headless/HeadlessNiFiServer.java | 2 +-
.../socket/TestSocketFlowFileServerProtocol.java | 5 +--
.../apache/nifi/web/StandardNiFiServiceFacade.java | 6 ++--
.../nifi/web/api/RemoteProcessGroupResource.java | 12 +++-----
.../attributematchers/SearchableMatcher.java | 2 +-
.../org/apache/nifi/web/api/TestFlowResource.java | 2 --
.../spring/LoginIdentityProviderFactoryBean.java | 8 ++---
.../security/authorization/AuthorizerFactory.java | 14 ++++-----
.../nifi/registry/service/TestRegistryService.java | 3 --
.../scheduling/StatelessProcessScheduler.java | 6 ++--
.../stateless/engine/StandardStatelessEngine.java | 2 +-
.../stateless/engine/StatelessFlowManager.java | 10 +++---
.../stateless/engine/StatelessReloadComponent.java | 8 ++---
.../stateless/engine/StatelessSchedulingAgent.java | 2 +-
.../nifi/stateless/basics/StateStorageIT.java | 7 ++---
.../clustering/AutoResumeStateClusteredIT.java | 3 +-
.../system/pg/SingleFlowFileConcurrencyIT.java | 6 ++--
.../tests/system/repositories/ContentAccessIT.java | 2 +-
.../tests/system/stateless/StatelessBasicsIT.java | 2 +-
pmd-ruleset.xml | 1 +
86 files changed, 216 insertions(+), 274 deletions(-)
diff --git a/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/ConfigSchema.java b/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/ConfigSchema.java
index c2edad7459..f6a0632dba 100644
--- a/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/ConfigSchema.java
+++ b/minifi/minifi-toolkit/minifi-toolkit-schema/src/main/java/org/apache/nifi/minifi/toolkit/schema/ConfigSchema.java
@@ -115,7 +115,6 @@ public class ConfigSchema extends BaseSchema implements WritableSchema, Converta
List<String> allControllerServiceIds = allProcessGroups.stream().flatMap(p -> p.getControllerServices().stream()).map(ControllerServiceSchema::getId).collect(Collectors.toList());
List<String> allFunnelIds = allProcessGroups.stream().flatMap(p -> p.getFunnels().stream()).map(FunnelSchema::getId).collect(Collectors.toList());
List<String> allConnectionIds = allConnectionSchemas.stream().map(ConnectionSchema::getId).collect(Collectors.toList());
- List<String> allRemoteProcessGroupNames = allRemoteProcessGroups.stream().map(RemoteProcessGroupSchema::getName).collect(Collectors.toList());
List<String> allRemoteInputPortIds = allRemoteProcessGroups.stream().filter(r -> r.getInputPorts() != null)
.flatMap(r -> r.getInputPorts().stream()).map(RemotePortSchema::getId).collect(Collectors.toList());
List<String> allRemoteOutputPortIds = allRemoteProcessGroups.stream().filter(r -> r.getOutputPorts() != null)
diff --git a/nifi-commons/nifi-properties/src/test/java/org/apache/nifi/util/NiFiPropertiesTest.java b/nifi-commons/nifi-properties/src/test/java/org/apache/nifi/util/NiFiPropertiesTest.java
index ef1898c19c..36524ed0f2 100644
--- a/nifi-commons/nifi-properties/src/test/java/org/apache/nifi/util/NiFiPropertiesTest.java
+++ b/nifi-commons/nifi-properties/src/test/java/org/apache/nifi/util/NiFiPropertiesTest.java
@@ -188,7 +188,7 @@ public class NiFiPropertiesTest {
NiFiProperties properties = loadNiFiProperties("/NiFiProperties/conf/nifi.blank.properties", additionalProperties);
// Act
- Integer clusterProtocolPort = properties.getClusterNodeProtocolPort();
+ properties.getClusterNodeProtocolPort();
assertThrows(NumberFormatException.class, () -> Integer.parseInt(portValue));
}
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
index 58fb0c2d1b..802bf1b1d6 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
@@ -100,7 +100,6 @@ public class TestDeleteS3Object {
runner.run(1);
runner.assertAllFlowFilesTransferred(DeleteS3Object.REL_FAILURE, 1);
- ArgumentCaptor<DeleteObjectRequest> captureRequest = ArgumentCaptor.forClass(DeleteObjectRequest.class);
Mockito.verify(mockS3Client, Mockito.never()).deleteVersion(Mockito.any(DeleteVersionRequest.class));
}
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNode.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNode.java
index 68aa05ea8f..e6d0ca336d 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNode.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNode.java
@@ -38,7 +38,7 @@ public class SystemtimeTypeNode extends VariantTypeNode {
int year = binaryReader.readWord();
int month = binaryReader.readWord();
final int monthOfYear = month + 1;
- int dayOfWeek = binaryReader.readWord();
+ binaryReader.readWord(); // dayOfWeek
int day = binaryReader.readWord();
int hour = binaryReader.readWord();
int minute = binaryReader.readWord();
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-dbcp-base/src/main/java/org/apache/nifi/dbcp/AbstractDBCPConnectionPool.java b/nifi-extension-bundles/nifi-extension-utils/nifi-dbcp-base/src/main/java/org/apache/nifi/dbcp/AbstractDBCPConnectionPool.java
index eeefa2e80e..e3e924e2ff 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-dbcp-base/src/main/java/org/apache/nifi/dbcp/AbstractDBCPConnectionPool.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-dbcp-base/src/main/java/org/apache/nifi/dbcp/AbstractDBCPConnectionPool.java
@@ -86,7 +86,7 @@ public abstract class AbstractDBCPConnectionPool extends AbstractControllerServi
.explanation("Successfully configured data source")
.build());
- try (final Connection conn = getConnection(basicDataSource, kerberosUser)) {
+ try (final Connection ignored = getConnection(basicDataSource, kerberosUser)) {
results.add(new ConfigVerificationResult.Builder()
.verificationStepName("Establish Connection")
.outcome(SUCCESSFUL)
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketTest.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketTest.java
index 7efdd13c1c..3e8bda5236 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketTest.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketTest.java
@@ -769,7 +769,6 @@ public class ListGCSBucketTest extends AbstractGCSTest {
@Test
public void testYieldOnBadStateRestore() {
- final Iterable<Blob> mockList = Collections.emptyList();
runner.getStateManager().setFailOnStateGet(Scope.CLUSTER, true);
runner.enqueue("test");
diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/FlowFileStreamUnpackerSequenceFileWriter.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/FlowFileStreamUnpackerSequenceFileWriter.java
index 4f7040702b..e1db5ef96a 100644
--- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/FlowFileStreamUnpackerSequenceFileWriter.java
+++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/FlowFileStreamUnpackerSequenceFileWriter.java
@@ -41,7 +41,7 @@ public class FlowFileStreamUnpackerSequenceFileWriter extends SequenceFileWriter
@Override
protected void processInputStream(final InputStream stream, final FlowFile flowFileStreamPackedFlowFile, final Writer writer) throws IOException {
final FlowFileUnpackager unpackager = new FlowFileUnpackager();
- try (final InputStream in = new BufferedInputStream(stream)) {
+ try (final InputStream ignored = new BufferedInputStream(stream)) {
while (unpackager.hasMoreData()) {
unpackager.unpackageFlowFile(stream, writer);
}
diff --git a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java
index 9863acf5fd..a1a8477fef 100644
--- a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java
+++ b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java
@@ -139,7 +139,7 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement
final String key = serializeCacheEntryKey(entry.getKey(), keySerializer);
- try (final HazelcastCache.HazelcastCacheEntryLock lock = cache.acquireLock(key)) {
+ try (final HazelcastCache.HazelcastCacheEntryLock ignored = cache.acquireLock(key)) {
final byte[] oldValue = cache.get(key);
if (oldValue == null && (entry.getRevision().isEmpty() || entry.getRevision().get() < STARTING_REVISION)) {
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/ConsumeKafka.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/ConsumeKafka.java
index 35600aec0e..0c627e8ea1 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/ConsumeKafka.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/ConsumeKafka.java
@@ -330,7 +330,6 @@ public class ConsumeKafka extends AbstractProcessor implements VerifiableProcess
@OnScheduled
public void onScheduled(final ProcessContext context) {
- final KafkaConnectionService connectionService = context.getProperty(CONNECTION_SERVICE).asControllerService(KafkaConnectionService.class);
pollingContext = createPollingContext(context);
headerEncoding = Charset.forName(context.getProperty(HEADER_ENCODING).getValue());
diff --git a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestScriptedTransformRecord.java b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestScriptedTransformRecord.java
index c86d11e5c8..54f570a0a7 100644
--- a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestScriptedTransformRecord.java
+++ b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestScriptedTransformRecord.java
@@ -134,6 +134,7 @@ public class TestScriptedTransformRecord {
assertEquals(0, testRunner.getCounterValue("Records Dropped").intValue());
final List<Record> written = recordWriter.getRecordsWritten();
+ assertEquals(0, written.size());
}
@Test
diff --git a/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/services/smb/SmbjClientServiceIT.java b/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/services/smb/SmbjClientServiceIT.java
index 56cd07803f..9be1ec3583 100644
--- a/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/services/smb/SmbjClientServiceIT.java
+++ b/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/services/smb/SmbjClientServiceIT.java
@@ -26,7 +26,6 @@ import static org.apache.nifi.services.smb.SmbjClientProviderService.USERNAME;
import static org.apache.nifi.smb.common.SmbProperties.TIMEOUT;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
-import static org.mockito.Mockito.mock;
import eu.rekawek.toxiproxy.model.ToxicDirection;
import java.util.HashMap;
@@ -38,7 +37,6 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.controller.ConfigurationContext;
import org.apache.nifi.util.MockConfigurationContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -94,7 +92,6 @@ public class SmbjClientServiceIT {
writeFile("testDirectory/directory2/nested_directory/file", "content");
ContainerProxy sambaProxy = toxiproxy.getProxy("samba", 445);
SmbjClientProviderService smbjClientProviderService = new SmbjClientProviderService();
- ConfigurationContext context = mock(ConfigurationContext.class);
Map<PropertyDescriptor, String> properties = new HashMap<>();
properties.put(HOSTNAME, sambaProxy.getContainerIpAddress());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java
index a5826dcf39..b3b57cb019 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/KubernetesSecretParameterProvider.java
@@ -148,7 +148,6 @@ public class KubernetesSecretParameterProvider extends AbstractParameterProvider
try {
final List<ParameterGroup> parameterGroups = fetchParameters(context);
- final Set<String> parameterGroupNames = parameterGroups.stream().map(ParameterGroup::getGroupName).collect(Collectors.toSet());
final long parameterCount = parameterGroups.stream()
.flatMap(group -> group.getParameters().stream())
.count();
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java
index 00135aebf8..60e244c1a3 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java
@@ -717,7 +717,6 @@ public class ReplaceText extends AbstractProcessor {
out.write(updatedValue.getBytes(charset));
});
} else {
- final Pattern searchPattern = Pattern.compile(searchValue, Pattern.LITERAL);
flowFile = session.write(flowFile, new StreamReplaceCallback(charset, maxBufferSize, context.getProperty(LINE_BY_LINE_EVALUATION_MODE).getValue(),
(bw, oneLine) -> {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
index 6b85cc3f74..2ad3df3db9 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
@@ -255,8 +255,6 @@ public class PutDatabaseRecordTest {
LocalDate testDate1 = LocalDate.of(2021, 1, 26);
Date jdbcDate1 = Date.valueOf(testDate1); // in local TZ
- LocalDate testDate2 = LocalDate.of(2021, 7, 26);
- Date jdbcDate2 = Date.valueOf(testDate2); // in local TZ
parser.addRecord(1, "rec1", 101, jdbcDate1);
@@ -1221,7 +1219,6 @@ public class PutDatabaseRecordTest {
runner.setProperty(PutDatabaseRecord.TABLE_NAME, "PERSONS");
// Set some existing records with different values for name and code
- Exception e;
ResultSet rs;
stmt.execute("INSERT INTO SCHEMA1.PERSONS VALUES (1,'x1',101,null)");
@@ -1715,14 +1712,6 @@ public class PutDatabaseRecordTest {
public void testGenerateTableName() throws InitializationException, ProcessException {
setRunner(TestCaseEnum.DEFAULT_0.getTestCase());
- final List<RecordField> fields = Arrays.asList(new RecordField("id", RecordFieldType.INT.getDataType()),
- new RecordField("name", RecordFieldType.STRING.getDataType()),
- new RecordField("code", RecordFieldType.INT.getDataType()),
- new RecordField("non_existing", RecordFieldType.BOOLEAN.getDataType())
- );
-
- final RecordSchema schema = new SimpleRecordSchema(fields);
-
final TableSchema tableSchema = new TableSchema(
null,
null,
@@ -1831,9 +1820,6 @@ public class PutDatabaseRecordTest {
parser.addSchemaField("code", RecordFieldType.INT);
parser.addSchemaField("dt", RecordFieldType.ARRAY.getArrayDataType(RecordFieldType.FLOAT.getDataType()).getFieldType());
- LocalDate testDate1 = LocalDate.of(2021, 1, 26);
- LocalDate testDate2 = LocalDate.of(2021, 7, 26);
-
parser.addRecord("1", "rec1", 101, Arrays.asList(1.0, 2.0));
parser.addRecord("2", "rec2", 102, Arrays.asList(3.0, 4.0));
parser.addRecord("3", "rec3", 103, null);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java
index b27307bc9b..e5e7daa27c 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java
@@ -1104,7 +1104,6 @@ public class QueryDatabaseTableTest {
// load test data to database
final Connection con = ((DBCPService) runner.getControllerService("dbcp")).getConnection();
Statement stmt = con.createStatement();
- InputStream in;
try {
stmt.execute("drop table TEST_QUERY_DB_TABLE");
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
index cb60bf6632..f4671b685b 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
@@ -563,7 +563,6 @@ public class TestExecuteSQLRecord {
// ResultSet size will be 1x200x100 = 20 000 rows
// because of where PER.ID = ${person.id}
- final int nrOfRows = 20000;
MockRecordWriter recordWriter = new MockRecordWriter(null, true, -1);
runner.addControllerService("writer", recordWriter);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExtractTextNamedGroups.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExtractTextNamedGroups.java
index 902b85a15c..01385b603e 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExtractTextNamedGroups.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExtractTextNamedGroups.java
@@ -48,7 +48,6 @@ public class TestExtractTextNamedGroups {
testRunner.assertAllFlowFilesTransferred(ExtractText.REL_MATCH, 1);
final MockFlowFile out = testRunner.getFlowFilesForRelationship(ExtractText.REL_MATCH).get(0);
- java.util.Map<String, String> attributes = out.getAttributes();
out.assertAttributeEquals("regex.result1.ALL", SAMPLE_STRING);
out.assertAttributeEquals("regex.result2.BAR1", "bar1");
out.assertAttributeEquals("regex.result3.BAR1", "bar1");
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java
index d28f33d9fc..f349fd1a02 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java
@@ -141,11 +141,9 @@ public class TestGetFile {
final Path targetPath = destFile.toPath();
Files.copy(inPath, targetPath);
- boolean verifyLastModified = false;
try {
destFile.setLastModified(1000000000);
- verifyLastModified = true;
- } catch (Exception doNothing) {
+ } catch (Exception ignored) {
}
final TestRunner runner = TestRunners.newTestRunner(new GetFile());
@@ -153,7 +151,6 @@ public class TestGetFile {
runner.run();
runner.assertAllFlowFilesTransferred(GetFile.REL_SUCCESS, 1);
- final List<MockFlowFile> successFiles = runner.getFlowFilesForRelationship(GetFile.REL_SUCCESS);
//permissions are not verified as these are very environmentally specific
}
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListFile.java
index 391c02facb..16c6fba16c 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListFile.java
@@ -140,7 +140,7 @@ public class TestListFile {
private void runNext() throws InterruptedException {
runner.clearTransferState();
- final List<File> files = listFiles(testDir);
+ listFiles(testDir);
final Long lagMillis;
if (isMillisecondSupported) {
lagMillis = AbstractListProcessor.LISTING_LAG_MILLIS.get(TimeUnit.MILLISECONDS);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTCP.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTCP.java
index 05fa9df746..b034c09b89 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTCP.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTCP.java
@@ -352,7 +352,7 @@ public class TestPutTCP {
private void assertMessagesReceived(final String[] sentData, final int iterations) throws Exception {
for (int i = 0; i < iterations; i++) {
- for (String item : sentData) {
+ for (String ignored : sentData) {
final ByteArrayMessage message = messages.take();
assertNotNull(message, String.format("Message [%d] not found", i));
assertTrue(Arrays.asList(sentData).contains(new String(message.getMessage())));
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
index 59413b71e4..5be3a4eb28 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
@@ -353,7 +353,7 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
.explanation("Successfully configured data source")
.build());
- try (final Connection conn = getConnection(hikariDataSource, kerberosUser)) {
+ try (final Connection ignored = getConnection(hikariDataSource, kerberosUser)) {
results.add(new ConfigVerificationResult.Builder()
.verificationStepName("Establish Connection")
.outcome(SUCCESSFUL)
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestInferJsonSchemaAccessStrategy.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestInferJsonSchemaAccessStrategy.java
index 5f78e6fdd4..8af290ef9e 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestInferJsonSchemaAccessStrategy.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestInferJsonSchemaAccessStrategy.java
@@ -79,7 +79,7 @@ class TestInferJsonSchemaAccessStrategy {
for (int i = 0; i < 10_000; i++) {
try (final InputStream in = new ByteArrayInputStream(manyCopies)) {
- final RecordSchema schema = accessStrategy.getSchema(null, in, null);
+ accessStrategy.getSchema(null, in, null);
}
}
@@ -107,7 +107,7 @@ class TestInferJsonSchemaAccessStrategy {
final InferSchemaAccessStrategy<?> accessStrategy = new InferSchemaAccessStrategy<>((var, content) -> new JsonRecordSource(content),
noTimestampInference, Mockito.mock(ComponentLog.class));
- final RecordSchema schema = accessStrategy.getSchema(null, in, null);
+ accessStrategy.getSchema(null, in, null);
}
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
index fa99b447b5..e45b9fb8f8 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
@@ -131,7 +131,6 @@ public class TestInferXmlSchema {
final SchemaInferenceEngine<XmlNode> schemaInference = new XmlSchemaInference(timeValueInference);
final InferSchemaAccessStrategy<XmlNode> inferStrategy = new InferSchemaAccessStrategy<>(xmlSourceFactory, schemaInference, Mockito.mock(ComponentLog.class));
- final RecordSchema schema;
try (final InputStream fis = new FileInputStream(file);
final InputStream in = new BufferedInputStream(fis)) {
return inferStrategy.getSchema(Collections.emptyMap(), in, null);
diff --git a/nifi-framework-api/src/test/java/org/apache/nifi/authorization/TestUser.java b/nifi-framework-api/src/test/java/org/apache/nifi/authorization/TestUser.java
index 45c1c59068..9560ffffd1 100644
--- a/nifi-framework-api/src/test/java/org/apache/nifi/authorization/TestUser.java
+++ b/nifi-framework-api/src/test/java/org/apache/nifi/authorization/TestUser.java
@@ -27,8 +27,6 @@ public class TestUser {
public void testSimpleCreation() {
final String identifier = "1";
final String identity = "user1";
- final String group1 = "group1";
- final String group2 = "group2";
final User user = new User.Builder()
.identifier(identifier)
@@ -57,8 +55,6 @@ public class TestUser {
public void testFromUser() {
final String identifier = "1";
final String identity = "user1";
- final String group1 = "group1";
- final String group2 = "group2";
final User user = new User.Builder()
.identifier(identifier)
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/toc/TestStandardTocWriter.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/toc/TestStandardTocWriter.java
index b4434db0f4..13fa05fc60 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/toc/TestStandardTocWriter.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/toc/TestStandardTocWriter.java
@@ -32,7 +32,7 @@ public class TestStandardTocWriter {
try {
assertTrue(tocFile.createNewFile());
- try (final StandardTocWriter writer = new StandardTocWriter(tocFile, false, false)) {
+ try (final StandardTocWriter ignored = new StandardTocWriter(tocFile, false, false)) {
}
} finally {
FileUtils.deleteFile(tocFile, false);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AccessPolicyProviderInvocationHandler.java b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AccessPolicyProviderInvocationHandler.java
index 63bd2ab4e9..a6fbe502bd 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AccessPolicyProviderInvocationHandler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AccessPolicyProviderInvocationHandler.java
@@ -42,7 +42,7 @@ public class AccessPolicyProviderInvocationHandler implements InvocationHandler
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
if (getUserGroupProviderMethod.equals(method)) {
final UserGroupProvider userGroupProvider = (UserGroupProvider) method.invoke(accessPolicyProvider, args);
if (userGroupProvider == null) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerInvocationHandler.java b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerInvocationHandler.java
index c8b67713db..8ecc01a398 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerInvocationHandler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerInvocationHandler.java
@@ -43,7 +43,7 @@ public class AuthorizerInvocationHandler implements InvocationHandler {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
if (getAccessPolicyProviderMethod.equals(method)) {
final AccessPolicyProvider accessPolicyProvider = (AccessPolicyProvider) method.invoke(authorizer, args);
if (accessPolicyProvider == null) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/UserGroupProviderInvocationHandler.java b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/UserGroupProviderInvocationHandler.java
index 21feada44f..75c921f9ec 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/UserGroupProviderInvocationHandler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/UserGroupProviderInvocationHandler.java
@@ -34,7 +34,7 @@ public class UserGroupProviderInvocationHandler implements InvocationHandler {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
return method.invoke(userGroupProvider, args);
} catch (final InvocationTargetException e) {
// If the proxied instance throws an Exception, it'll be wrapped in an InvocationTargetException. We want
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
index 3156efd39b..fa3da9ad4e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
@@ -74,7 +74,6 @@ public class TestJaxbProtocolUtils {
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
assertTrue(unmarshalled instanceof ConnectionResponseMessage);
- final ConnectionResponseMessage unmarshalledMsg = (ConnectionResponseMessage) unmarshalled;
final ComponentRevisionSnapshot receivedSnapshot = msg.getConnectionResponse().getComponentRevisions();
final List<ComponentRevision> revisions = receivedSnapshot.getComponentRevisions();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/TestProcessorEndpointMerger.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/TestProcessorEndpointMerger.java
index eccc969932..83125b2f28 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/TestProcessorEndpointMerger.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/TestProcessorEndpointMerger.java
@@ -34,7 +34,6 @@ public class TestProcessorEndpointMerger {
@Test
public void testMergeValidationErrors() {
- final ProcessorEndpointMerger merger = new ProcessorEndpointMerger();
final Map<String, Set<NodeIdentifier>> validationErrorMap = new HashMap<>();
final NodeIdentifier nodeId1234 = new NodeIdentifier("1234", "localhost", 9000, "localhost", 9001, "localhost", 9002, 9003, false);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewallTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewallTest.java
index 16a46528f8..b894d79dc8 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewallTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewallTest.java
@@ -58,9 +58,8 @@ public class FileBasedClusterNodeFirewallTest {
*/
@BeforeAll
public static void ensureBadHostsDoNotWork() {
- final InetAddress ip;
try {
- ip = InetAddress.getByName(NONEXISTENT_HOSTNAME);
+ InetAddress.getByName(NONEXISTENT_HOSTNAME);
} catch (final UnknownHostException uhe) {
badHostsDoNotResolve = true;
}
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 51f55fd1a6..6afb9492b3 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
@@ -844,7 +844,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final Set<Relationship> relationships;
final Processor processor = processorRef.get().getProcessor();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
relationships = processor.getRelationships();
}
@@ -898,7 +898,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final Set<Relationship> undefined = new HashSet<>();
final Set<Relationship> relationships;
final Processor processor = processorRef.get().getProcessor();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
relationships = processor.getRelationships();
}
@@ -1015,7 +1015,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
}
} else {
// Verify the configuration, using the component's classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), getIdentifier())) {
results.addAll(verifiable.verify(context, logger, attributes));
}
}
@@ -1227,7 +1227,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
@Override
public Collection<Relationship> getRelationships() {
final Processor processor = processorRef.get().getProcessor();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
return getProcessor().getRelationships();
}
}
@@ -1235,7 +1235,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
@Override
public String toString() {
final Processor processor = processorRef.get().getProcessor();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
return getProcessor().toString();
}
}
@@ -1268,7 +1268,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final Processor processor = processorRef.get().getProcessor();
activateThread();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
processor.onTrigger(context, sessionFactory);
} finally {
deactivateThread();
@@ -1508,7 +1508,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
lifecycleState.incrementActiveThreadCount(null);
activateThread();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), implClass, getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), implClass, getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, getProcessor(), nodeState);
} finally {
deactivateThread();
@@ -1655,7 +1655,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final ProcessContext processContext = processContextFactory.get();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
try {
hasActiveThreads = true;
@@ -1713,7 +1713,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
+ "initialize and run the Processor again after the 'Administrative Yield Duration' has elapsed. Failure is due to " + cause, cause);
// If processor's task completed Exceptionally, then we want to retry initiating the start (if Processor is still scheduled to run).
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
activateThread();
try {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, processor, processContext);
@@ -1823,7 +1823,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
LOG.debug("Triggering @OnUnscheduled methods of {}", this);
activateThread();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, processor, processContext);
} finally {
deactivateThread();
@@ -1841,7 +1841,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
LOG.debug("Triggering @OnStopped methods of {}", this);
activateThread();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), processor.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, processor, processContext);
} finally {
deactivateThread();
@@ -2059,7 +2059,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
@Override
public void onConfigurationRestored(final ProcessContext context) {
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), getProcessor().getClass(), getProcessor().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), getProcessor().getClass(), getProcessor().getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, getProcessor(), context);
}
@@ -2094,7 +2094,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final StandardPropertyConfiguration propertyConfig = new StandardPropertyConfiguration(effectiveValues,
originalPropertyValues, this::mapRawValueToEffectiveValue, toString(), serviceFactory);
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), processor.getClass(), getIdentifier())) {
processor.migrateProperties(propertyConfig);
}
@@ -2114,7 +2114,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final Processor processor = getProcessor();
final StandardRelationshipConfiguration relationshipConfig = new StandardRelationshipConfiguration(this);
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), getProcessor().getClass(), getProcessor().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), getProcessor().getClass(), getProcessor().getIdentifier())) {
processor.migrateRelationships(relationshipConfig);
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flow/AbstractFlowManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flow/AbstractFlowManager.java
index 16494f6ae4..6d36f7917e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flow/AbstractFlowManager.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flow/AbstractFlowManager.java
@@ -463,7 +463,7 @@ public abstract class AbstractFlowManager implements FlowManager {
reportingTaskNode.verifyCanDelete();
final Class<?> taskClass = reportingTaskNode.getReportingTask().getClass();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, reportingTaskNode.getReportingTask().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, reportingTaskNode.getReportingTask().getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, reportingTaskNode.getReportingTask(), reportingTaskNode.getConfigurationContext());
}
@@ -511,7 +511,7 @@ public abstract class AbstractFlowManager implements FlowManager {
flowAnalysisRuleNode.verifyCanDelete();
final Class<?> taskClass = flowAnalysisRuleNode.getFlowAnalysisRule().getClass();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, flowAnalysisRuleNode.getFlowAnalysisRule().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, flowAnalysisRuleNode.getFlowAnalysisRule().getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, flowAnalysisRuleNode.getFlowAnalysisRule(), flowAnalysisRuleNode.getConfigurationContext());
}
@@ -556,7 +556,7 @@ public abstract class AbstractFlowManager implements FlowManager {
}
final Class<?> taskClass = parameterProvider.getParameterProvider().getClass();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, parameterProvider.getParameterProvider().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, parameterProvider.getParameterProvider().getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, parameterProvider.getParameterProvider(), parameterProvider.getConfigurationContext());
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java
index 8d934b286e..52bed5dd1b 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java
@@ -251,7 +251,7 @@ public abstract class AbstractFlowAnalysisRuleNode extends AbstractComponentNode
@Override
public String toString() {
FlowAnalysisRule flowAnalysisRule = flowAnalysisRuleRef.get().getFlowAnalysisRule();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), flowAnalysisRule.getClass(), flowAnalysisRule.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), flowAnalysisRule.getClass(), flowAnalysisRule.getIdentifier())) {
return getFlowAnalysisRule().toString();
}
}
@@ -274,7 +274,7 @@ public abstract class AbstractFlowAnalysisRuleNode extends AbstractComponentNode
private void setState(FlowAnalysisRuleState newState, Class<? extends Annotation> annotation) {
final ConfigurationContext configContext = new StandardConfigurationContext(this, this.serviceLookup, null);
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), getFlowAnalysisRule().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), getFlowAnalysisRule().getClass(), getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(annotation, getFlowAnalysisRule(), configContext);
this.state = newState;
@@ -340,7 +340,7 @@ public abstract class AbstractFlowAnalysisRuleNode extends AbstractComponentNode
}
} else {
// Verify the configuration, using the component's classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, flowAnalysisRule.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, flowAnalysisRule.getClass(), getIdentifier())) {
results.addAll(verifiable.verify(context, logger));
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
index e4d6a073f6..5d6d450f57 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
@@ -280,7 +280,7 @@ public class StandardParameterProviderNode extends AbstractComponentNode impleme
final ParameterProvider parameterProvider = parameterProviderRef.get().getParameterProvider();
final ConfigurationContext configurationContext = getConfigurationContext();
List<ParameterGroup> fetchedParameterGroups;
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), parameterProvider.getClass(), parameterProvider.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), parameterProvider.getClass(), parameterProvider.getIdentifier())) {
fetchedParameterGroups = parameterProvider.fetchParameters(configurationContext);
} catch (final IOException | RuntimeException e) {
throw new IllegalStateException(String.format("Error fetching parameters for %s: %s", this, e.getMessage()), e);
@@ -440,7 +440,7 @@ public class StandardParameterProviderNode extends AbstractComponentNode impleme
}
} else {
// Verify the configuration, using the component's classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, parameterProvider.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, parameterProvider.getClass(), getIdentifier())) {
results.addAll(verifiable.verify(context, logger));
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
index e1201cc47b..48c214a3d8 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
@@ -381,7 +381,7 @@ public abstract class AbstractReportingTaskNode extends AbstractComponentNode im
}
} else {
// Verify the configuration, using the component's classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, reportingTask.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, reportingTask.getClass(), getIdentifier())) {
results.addAll(verifiable.verify(context, logger));
}
}
@@ -417,7 +417,7 @@ public abstract class AbstractReportingTaskNode extends AbstractComponentNode im
lifecycleState.incrementActiveThreadCount(null);
try {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), taskClass, getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, getReportingTask(), nodeState);
}
} finally {
@@ -440,7 +440,7 @@ public abstract class AbstractReportingTaskNode extends AbstractComponentNode im
final StandardPropertyConfiguration propertyConfig = new StandardPropertyConfiguration(effectiveValues,
originalPropertyValues, this::mapRawValueToEffectiveValue, toString(), serviceFactory);
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), task.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), task.getClass(), getIdentifier())) {
task.migrateProperties(propertyConfig);
} catch (final Exception e) {
LOG.error("Failed to migrate Property Configuration for {}.", this, e);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceInvocationHandler.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceInvocationHandler.java
index 1c6b8b7e8c..9b87040540 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceInvocationHandler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceInvocationHandler.java
@@ -98,7 +98,7 @@ public class StandardControllerServiceInvocationHandler implements ControllerSer
}
final ClassLoader callerClassLoader = Thread.currentThread().getContextClassLoader();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, originalService.getClass(), originalService.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, originalService.getClass(), originalService.getIdentifier())) {
// If any objects are proxied, unwrap them so that we provide the unproxied object to the Controller Service.
ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
index 2bee7fe62b..edfba0e5c4 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
@@ -527,7 +527,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
}
} else {
// Verify the configuration, using the component's classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, controllerService.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, controllerService.getClass(), getIdentifier())) {
results.addAll(verifiable.verify(context, logger, variables));
}
}
@@ -651,7 +651,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
}
try {
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), getControllerServiceImplementation().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), getControllerServiceImplementation().getClass(), getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnEnabled.class, getControllerServiceImplementation(), configContext);
}
@@ -749,7 +749,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
private void invokeDisable(ConfigurationContext configContext) {
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), getControllerServiceImplementation().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), getControllerServiceImplementation().getClass(), getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnDisabled.class, StandardControllerServiceNode.this.getControllerServiceImplementation(), configContext);
LOG.debug("Successfully disabled {}", this);
} catch (Exception e) {
@@ -829,7 +829,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
return;
}
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), implementationClass, getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), implementationClass, getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, getControllerServiceImplementation(), nodeState);
}
}
@@ -843,7 +843,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
originalPropertyValues, super::mapRawValueToEffectiveValue, toString(), serviceFactory);
final ControllerService implementation = getControllerServiceImplementation();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getExtensionManager(), implementation.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), implementation.getClass(), getIdentifier())) {
implementation.migrateProperties(propertyConfig);
} catch (final Exception e) {
LOG.error("Failed to migrate Property Configuration for {}.", this, e);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java
index 085e0003ef..10b6665aa2 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java
@@ -423,126 +423,126 @@ public class StandardStateManagerProvider implements StateManagerProvider {
return new StateProvider() {
@Override
public void initialize(StateProviderInitializationContext context) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.initialize(context);
}
}
@Override
public void shutdown() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.shutdown();
}
}
@Override
public void setState(Map<String, String> state, String componentId) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.setState(state, componentId);
}
}
@Override
public StateMap getState(String componentId) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getState(componentId);
}
}
@Override
public boolean replace(StateMap oldValue, Map<String, String> newValue, String componentId) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.replace(oldValue, newValue, componentId);
}
}
@Override
public void clear(String componentId) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.clear(componentId);
}
}
@Override
public void onComponentRemoved(String componentId) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.onComponentRemoved(componentId);
}
}
@Override
public void enable() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.enable();
}
}
@Override
public void disable() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.disable();
}
}
@Override
public boolean isEnabled() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.isEnabled();
}
}
@Override
public Scope[] getSupportedScopes() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getSupportedScopes();
}
}
@Override
public Collection<ValidationResult> validate(ValidationContext context) {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.validate(context);
}
}
@Override
public PropertyDescriptor getPropertyDescriptor(String name) {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getPropertyDescriptor(name);
}
}
@Override
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue) {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
stateProvider.onPropertyModified(descriptor, oldValue, newValue);
}
}
@Override
public List<PropertyDescriptor> getPropertyDescriptors() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getPropertyDescriptors();
}
}
@Override
public String getIdentifier() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getIdentifier();
}
}
@Override
public boolean isComponentEnumerationSupported() {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.isComponentEnumerationSupported();
}
}
@Override
public Collection<String> getStoredComponentIds() throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return stateProvider.getStoredComponentIds();
}
}
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 f99969e371..e6fcacdeab 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
@@ -666,7 +666,7 @@ public final class StandardProcessGroup implements ProcessGroup {
private void shutdown(final ProcessGroup procGroup) {
for (final ProcessorNode node : procGroup.getProcessors()) {
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, node.getProcessor().getClass(), node.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, node.getProcessor().getClass(), node.getIdentifier())) {
final StandardProcessContext processContext = new StandardProcessContext(node, controllerServiceProvider,
getStateManager(node.getIdentifier()), () -> false, nodeTypeProvider);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, node.getProcessor(), processContext);
@@ -1232,7 +1232,7 @@ public final class StandardProcessGroup implements ProcessGroup {
// with the Python process even after the Python process has been destroyed.
processor.pauseValidationTrigger();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, processor.getProcessor().getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, processor.getProcessor().getClass(), processor.getIdentifier())) {
final StandardProcessContext processContext = new StandardProcessContext(processor, controllerServiceProvider,
getStateManager(processor.getIdentifier()), () -> false, nodeTypeProvider);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, processor.getProcessor(), processContext);
@@ -2590,7 +2590,7 @@ public final class StandardProcessGroup implements ProcessGroup {
service.verifyCanDelete();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, service.getControllerServiceImplementation().getClass(), service.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getControllerServiceImplementation().getClass(), service.getIdentifier())) {
final ConfigurationContext configurationContext = new StandardConfigurationContext(service, controllerServiceProvider, null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, service.getControllerServiceImplementation(), configurationContext);
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClientNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClientNode.java
index 4fed6f6452..8b968d3f2e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClientNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClientNode.java
@@ -186,7 +186,7 @@ public final class StandardFlowRegistryClientNode extends AbstractComponentNode
@Override
public boolean isStorageLocationApplicable(final String location) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), client.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), client.getClass(), getIdentifier())) {
return client.get().getComponent().isStorageLocationApplicable(getConfigurationContext(), location);
}
}
@@ -310,7 +310,7 @@ public final class StandardFlowRegistryClientNode extends AbstractComponentNode
throw new FlowRegistryInvalidException(validationProblems);
}
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getExtensionManager(), client.getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), client.getClass(), getIdentifier())) {
return action.execute();
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
index 9e83dab33d..efc6528318 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
@@ -400,7 +400,6 @@ public class TestStandardParameterContext {
public void testAlertReferencingComponents() {
final String inheritedParamName = "def";
final String originalValue = "123";
- final String changedValue = "321";
final HashMapParameterReferenceManager referenceManager = Mockito.spy(new HashMapParameterReferenceManager());
final Set<ProcessGroup> processGroups = new HashSet<>();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java
index 493a3886fb..27b18743ab 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java
@@ -283,7 +283,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
final Set<String> removedPropertyNames = new LinkedHashSet<>();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), id)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), id)) {
boolean classpathChanged = false;
for (final Map.Entry<String, String> entry : properties.entrySet()) {
final String propertyName = entry.getKey();
@@ -640,7 +640,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
}
public Map<PropertyDescriptor, PropertyConfiguration> getProperties() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
final List<PropertyDescriptor> supported = getComponent().getPropertyDescriptors();
if (supported == null || supported.isEmpty()) {
return Collections.unmodifiableMap(properties);
@@ -670,7 +670,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
}
private Map<PropertyDescriptor, String> getPropertyValues(final BiFunction<PropertyDescriptor, PropertyConfiguration, String> valueFunction) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
final List<PropertyDescriptor> supported = getComponent().getPropertyDescriptors();
final Map<PropertyDescriptor, String> props = new LinkedHashMap<>();
@@ -827,7 +827,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
@Override
public String toString() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
return getComponent().toString();
} catch (final Throwable t) {
return getClass().getSimpleName() + "[id=" + getIdentifier() + "]";
@@ -843,7 +843,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
@Override
public ValidationState performValidation(final ValidationContext validationContext) {
final Collection<ValidationResult> results;
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getIdentifier())) {
results = computeValidationErrors(validationContext);
}
@@ -1192,7 +1192,7 @@ public abstract class AbstractComponentNode implements ComponentNode {
@Override
public PropertyDescriptor getPropertyDescriptor(final String name) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
final PropertyDescriptor propertyDescriptor = getComponent().getPropertyDescriptor(name);
if (propertyDescriptor.isDynamic() && isSensitiveDynamicProperty(name)) {
return new PropertyDescriptor.Builder().fromPropertyDescriptor(propertyDescriptor).sensitive(true).build();
@@ -1204,14 +1204,14 @@ public abstract class AbstractComponentNode implements ComponentNode {
@Override
public List<PropertyDescriptor> getPropertyDescriptors() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
return getComponent().getPropertyDescriptors();
}
}
protected void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) {
getComponent().onPropertyModified(descriptor, oldValue, newValue);
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/ClassLoaderAwarePythonBridge.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/ClassLoaderAwarePythonBridge.java
index 3352472f72..81b940fa78 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/ClassLoaderAwarePythonBridge.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/ClassLoaderAwarePythonBridge.java
@@ -42,84 +42,84 @@ public class ClassLoaderAwarePythonBridge implements PythonBridge {
@Override
public void initialize(final PythonBridgeInitializationContext context) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.initialize(context);
}
}
@Override
public void start() throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.start();
}
}
@Override
public void shutdown() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.shutdown();
}
}
@Override
public void ping() throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.ping();
}
}
@Override
public List<PythonProcessorDetails> getProcessorTypes() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
return delegate.getProcessorTypes();
}
}
@Override
public Map<String, Integer> getProcessCountsPerType() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
return delegate.getProcessCountsPerType();
}
}
@Override
public List<BoundObjectCounts> getBoundObjectCounts() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
return delegate.getBoundObjectCounts();
}
}
@Override
public void discoverExtensions(final boolean includeNarDirectories) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.discoverExtensions(includeNarDirectories);
}
}
@Override
public void discoverExtensions(final List<File> extensionDirectories) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.discoverExtensions(extensionDirectories);
}
}
@Override
public AsyncLoadedProcessor createProcessor(final String identifier, final String type, final String version, final boolean preferIsolatedProcess, final boolean initialize) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
return delegate.createProcessor(identifier, type, version, preferIsolatedProcess, initialize);
}
}
@Override
public void onProcessorRemoved(final String identifier, final String type, final String version) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.onProcessorRemoved(identifier, type, version);
}
}
@Override
public void removeProcessorType(final String type, final String version) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(classLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(classLoader)) {
delegate.removeProcessorType(type, version);
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
index fea884ecdc..4f2d5050b0 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
@@ -716,7 +716,7 @@ public class ExtensionBuilder {
// Find any Controller Service API's that are bundled in the same NAR.
final Set<Class<?>> cobundledApis = new HashSet<>();
- try (final NarCloseable closeable = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
final List<PropertyDescriptor> descriptors = component.getPropertyDescriptors();
if (descriptors != null && !descriptors.isEmpty()) {
for (final PropertyDescriptor descriptor : descriptors) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
index 6310e01afb..51d83d12f2 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
@@ -950,7 +950,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
final FlowFileSwapManager swapManager = NarThreadContextClassLoader.createInstance(extensionManager, implementationClassName, FlowFileSwapManager.class, nifiProperties);
final EventReporter eventReporter = createEventReporter();
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
final SwapManagerInitializationContext initializationContext = new SwapManagerInitializationContext() {
@Override
public ResourceClaimManager getResourceClaimManager() {
@@ -1096,7 +1096,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
private void notifyComponentsConfigurationRestored() {
for (final ProcessorNode procNode : flowManager.getRootGroup().findAllProcessors()) {
final Processor processor = procNode.getProcessor();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), processor.getIdentifier())) {
final StandardProcessContext processContext = new StandardProcessContext(procNode, controllerServiceProvider,
getStateManagerProvider().getStateManager(processor.getIdentifier()), () -> false, this);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, processor, processContext);
@@ -1106,7 +1106,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
for (final ControllerServiceNode serviceNode : flowManager.getAllControllerServices()) {
final ControllerService service = serviceNode.getControllerServiceImplementation();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
final ConfigurationContext configurationContext = new StandardConfigurationContext(serviceNode, controllerServiceProvider, null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, service, configurationContext);
}
@@ -1115,7 +1115,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
for (final ReportingTaskNode taskNode : getAllReportingTasks()) {
final ReportingTask task = taskNode.getReportingTask();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, task.getClass(), task.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, task.getClass(), task.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, task, taskNode.getConfigurationContext());
}
}
@@ -1123,7 +1123,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
for (final FlowAnalysisRuleNode ruleNode : getAllFlowAnalysisRules()) {
final FlowAnalysisRule rule = ruleNode.getFlowAnalysisRule();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, rule.getClass(), rule.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, rule.getClass(), rule.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, rule, ruleNode.getConfigurationContext());
}
}
@@ -1131,7 +1131,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
for (final ParameterProviderNode parameterProviderNode : flowManager.getAllParameterProviders()) {
final ParameterProvider provider = parameterProviderNode.getParameterProvider();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, provider.getClass(), provider.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, provider.getClass(), provider.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, provider);
}
}
@@ -1372,42 +1372,42 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
final AssetManager instrumented = new AssetManager() {
@Override
public void initialize(final AssetManagerInitializationContext context) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
assetManager.initialize(context);
}
}
@Override
public Asset createAsset(final String parameterContextId, final String assetName, final InputStream contents) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
return assetManager.createAsset(parameterContextId, assetName, contents);
}
}
@Override
public Optional<Asset> getAsset(final String id) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
return assetManager.getAsset(id);
}
}
@Override
public List<Asset> getAssets(final String parameterContextId) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
return assetManager.getAssets(parameterContextId);
}
}
@Override
public Asset createMissingAsset(final String parameterContextId, final String assetName) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
return assetManager.createMissingAsset(parameterContextId, assetName);
}
}
@Override
public Optional<Asset> deleteAsset(final String id) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(assetManagerClassLoader)) {
return assetManager.deleteAsset(id);
}
}
@@ -2293,7 +2293,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
final FlowFileSwapManager swapManager = createSwapManager();
final EventReporter eventReporter = createEventReporter();
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
final SwapManagerInitializationContext initializationContext = new SwapManagerInitializationContext() {
@Override
public ResourceClaimManager getResourceClaimManager() {
@@ -3265,7 +3265,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr
private class HeartbeatSendTask implements Runnable {
@Override
public void run() {
- try (final NarCloseable narCloseable = NarCloseable.withFrameworkNar()) {
+ try (final NarCloseable ignored = NarCloseable.withFrameworkNar()) {
if (heartbeatsSuspended.get()) {
return;
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
index e9990afb64..c3ae6023f9 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
@@ -81,7 +81,7 @@ public class StandardReloadComponent implements ReloadComponent {
stateManager, () -> false, flowController);
// call OnRemoved for the existing processor using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getProcessor(), processContext);
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
@@ -143,7 +143,7 @@ public class StandardReloadComponent implements ReloadComponent {
// call OnRemoved for the existing service using the previous instance class loader
final ConfigurationContext configurationContext = new StandardConfigurationContext(existingNode, flowController.getControllerServiceProvider(), null);
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getControllerServiceImplementation(), configurationContext);
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
@@ -199,7 +199,7 @@ public class StandardReloadComponent implements ReloadComponent {
// call OnRemoved for the existing reporting task using the previous instance class loader
final ConfigurationContext configurationContext = existingNode.getConfigurationContext();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getReportingTask(), configurationContext);
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
@@ -248,7 +248,7 @@ public class StandardReloadComponent implements ReloadComponent {
// call OnRemoved for the existing flow analysis rule using the previous instance class loader
final ConfigurationContext configurationContext = existingNode.getConfigurationContext();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getFlowAnalysisRule(), configurationContext);
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
@@ -300,7 +300,7 @@ public class StandardReloadComponent implements ReloadComponent {
final ParameterProviderNode newNode = flowController.getFlowManager().createParameterProvider(newType, id, bundleCoordinate, additionalUrls, true, false);
// call OnRemoved for the existing parameter provider using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getParameterProvider(), existingNode.getConfigurationContext());
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
index 9809a389c3..ac3ddf71a8 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
@@ -363,7 +363,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
if (firstTimeAdded) {
final Processor processor = procNode.getProcessor();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), processor.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, processor.getClass(), processor.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, processor);
logDeprecationNotice(processor);
} catch (final Exception e) {
@@ -419,7 +419,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final Class<?> clientClass = clientNode.getComponent().getClass();
final String identifier = clientNode.getComponent().getIdentifier();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), clientClass, identifier)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), clientClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, clientNode.getComponent());
if (flowController.isInitialized()) {
@@ -452,7 +452,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
}
final Class<?> clientClass = clientNode.getComponent().getClass();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(getExtensionManager(), clientClass, clientNode.getComponent().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(getExtensionManager(), clientClass, clientNode.getComponent().getIdentifier())) {
final ConfigurationContext configurationContext = new StandardConfigurationContext(clientNode, flowController.getControllerServiceProvider(), null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, clientNode.getComponent(), configurationContext);
}
@@ -497,7 +497,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final Class<? extends ConfigurableComponent> taskClass = reportingTask.getClass();
final String identifier = reportingTask.getIdentifier();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), taskClass, identifier)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), taskClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, reportingTask);
logDeprecationNotice(reportingTask);
@@ -562,7 +562,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final Class<? extends ConfigurableComponent> flowAnalysisRuleClass = flowAnalysisRule.getClass();
final String identifier = flowAnalysisRule.getIdentifier();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), flowAnalysisRuleClass, identifier)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), flowAnalysisRuleClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, flowAnalysisRule);
logDeprecationNotice(flowAnalysisRule);
@@ -617,7 +617,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final Class<? extends ConfigurableComponent> parameterProviderClass = parameterProvider.getClass();
final String identifier = parameterProvider.getIdentifier();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), parameterProviderClass, identifier)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), parameterProviderClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, parameterProvider);
logDeprecationNotice(parameterProvider);
@@ -664,7 +664,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final ExtensionManager extensionManager = flowController.getExtensionManager();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, service.getControllerServiceImplementation().getClass(), service.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getControllerServiceImplementation().getClass(), service.getIdentifier())) {
final ConfigurationContext configurationContext = new StandardConfigurationContext(service, flowController.getControllerServiceProvider(), null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, service.getControllerServiceImplementation(), configurationContext);
}
@@ -731,7 +731,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
final ControllerService service = serviceNode.getControllerServiceImplementation();
if (flowController.isInitialized()) {
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
final ConfigurationContext configurationContext =
new StandardConfigurationContext(serviceNode, controllerServiceProvider, null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, service, configurationContext);
@@ -739,7 +739,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
}
final ControllerService serviceImpl = serviceNode.getControllerServiceImplementation();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, serviceImpl.getClass(), serviceImpl.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, serviceImpl.getClass(), serviceImpl.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, serviceImpl);
logDeprecationNotice(serviceImpl);
} catch (final Exception e) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
index 4104176f7f..0f578d67e7 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
@@ -227,7 +227,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
@Override
public void shutdownReportingTask(final ReportingTaskNode reportingTask) {
final ConfigurationContext configContext = reportingTask.getConfigurationContext();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getReportingTask().getClass(), reportingTask.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getReportingTask().getClass(), reportingTask.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, reportingTask.getReportingTask(), configContext);
}
}
@@ -235,7 +235,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
@Override
public void shutdownControllerService(final ControllerServiceNode serviceNode, final ControllerServiceProvider controllerServiceProvider) {
final Class<?> serviceImplClass = serviceNode.getControllerServiceImplementation().getClass();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), serviceImplClass, serviceNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), serviceImplClass, serviceNode.getIdentifier())) {
final ConfigurationContext configContext = new StandardConfigurationContext(serviceNode, controllerServiceProvider, null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, serviceNode.getControllerServiceImplementation(), configContext);
}
@@ -283,7 +283,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
return;
}
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnScheduled.class, reportingTask, taskNode.getConfigurationContext());
}
@@ -299,7 +299,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
reportingTask, e.toString(), administrativeYieldDuration, e);
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, reportingTask, taskNode.getConfigurationContext());
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, reportingTask, taskNode.getConfigurationContext());
}
@@ -338,7 +338,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
synchronized (lifecycleState) {
lifecycleState.setScheduled(false);
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), reportingTask.getClass(), reportingTask.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnUnscheduled.class, reportingTask, configurationContext);
} catch (final Exception e) {
final Throwable cause = e instanceof InvocationTargetException ? e.getCause() : e;
@@ -696,7 +696,7 @@ public final class StandardProcessScheduler implements ProcessScheduler {
if (!state.isScheduled() && state.getActiveThreadCount() == 0 && state.mustCallOnStoppedMethods()) {
final ConnectableProcessContext processContext = new ConnectableProcessContext(connectable, getStateManager(connectable.getIdentifier()));
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), connectable.getClass(), connectable.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), connectable.getClass(), connectable.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, connectable, processContext);
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java
index 9958601b98..dec9b0f453 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java
@@ -110,7 +110,6 @@ public class WriteAheadLocalStateProvider extends AbstractStateProvider {
@Override
public synchronized void init(final StateProviderInitializationContext context) throws IOException {
long checkpointIntervalMillis = context.getProperty(CHECKPOINT_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
- int numPartitions = context.getProperty(NUM_PARTITIONS).asInteger();
alwaysSync = context.getProperty(ALWAYS_SYNC).asBoolean();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java
index bb46cb629a..88841c3c73 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java
@@ -237,7 +237,7 @@ public class ConnectableTask {
final String originalThreadName = Thread.currentThread().getName();
try {
- try (final AutoCloseable ncl = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), connectable.getRunnableComponent().getClass(), connectable.getIdentifier())) {
+ try (final AutoCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), connectable.getRunnableComponent().getClass(), connectable.getIdentifier())) {
boolean shouldRun = connectable.getScheduledState() == ScheduledState.RUNNING || connectable.getScheduledState() == ScheduledState.RUN_ONCE;
while (shouldRun) {
invocationCount++;
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ReportingTaskWrapper.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ReportingTaskWrapper.java
index aebf0a33c8..6aa93a07ab 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ReportingTaskWrapper.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ReportingTaskWrapper.java
@@ -43,7 +43,7 @@ public class ReportingTaskWrapper implements Runnable {
if (!lifecycleState.tryIncrementActiveThreadCount(null)) {
return;
}
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
taskNode.getReportingTask().onTrigger(taskNode.getReportingContext());
} catch (final Throwable t) {
final ComponentLog componentLog = new SimpleProcessLogger(taskNode.getIdentifier(), taskNode.getReportingTask(), new StandardLoggingContext(null));
@@ -56,7 +56,7 @@ public class ReportingTaskWrapper implements Runnable {
// if the reporting task is no longer scheduled to run and this is the last thread,
// invoke the OnStopped methods
if (!lifecycleState.isScheduled() && lifecycleState.getActiveThreadCount() == 1 && lifecycleState.mustCallOnStoppedMethods()) {
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, taskNode.getReportingTask(), taskNode.getConfigurationContext());
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/NarPersistenceProviderFactoryBean.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/NarPersistenceProviderFactoryBean.java
index d0579d024e..cbce5b28ea 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/NarPersistenceProviderFactoryBean.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/NarPersistenceProviderFactoryBean.java
@@ -95,63 +95,63 @@ public class NarPersistenceProviderFactoryBean implements FactoryBean<NarPersist
return new NarPersistenceProvider() {
@Override
public void initialize(final NarPersistenceProviderInitializationContext initializationContext) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
originalInstance.initialize(initializationContext);
}
}
@Override
public void shutdown() {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
originalInstance.shutdown();
}
}
@Override
public File createTempFile(final InputStream inputStream) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.createTempFile(inputStream);
}
}
@Override
public NarPersistenceInfo saveNar(final NarPersistenceContext persistenceContext, final File tempNarFile) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.saveNar(persistenceContext, tempNarFile);
}
}
@Override
public void deleteNar(final BundleCoordinate narCoordinate) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
originalInstance.deleteNar(narCoordinate);
}
}
@Override
public InputStream readNar(final BundleCoordinate narCoordinate) throws FileNotFoundException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.readNar(narCoordinate);
}
}
@Override
public boolean exists(final BundleCoordinate narCoordinate) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.exists(narCoordinate);
}
}
@Override
public NarPersistenceInfo getNarInfo(final BundleCoordinate narCoordinate) throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.getNarInfo(narCoordinate);
}
}
@Override
public Set<NarPersistenceInfo> getAllNarInfo() throws IOException {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(originalClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(originalClassLoader)) {
return originalInstance.getAllNarInfo();
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFileSystemSwapManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFileSystemSwapManager.java
index cd7a92a2ee..9e0a1324a4 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFileSystemSwapManager.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFileSystemSwapManager.java
@@ -28,8 +28,6 @@ import org.apache.nifi.stream.io.StreamUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -74,22 +72,18 @@ public class TestFileSystemSwapManager {
@Test
public void testBackwardCompatible() throws IOException {
- try (final InputStream fis = new FileInputStream("src/test/resources/old-swap-file.swap");
- final DataInputStream in = new DataInputStream(new BufferedInputStream(fis))) {
-
- final FlowFileQueue flowFileQueue = mock(FlowFileQueue.class);
- when(flowFileQueue.getIdentifier()).thenReturn("87bb99fe-412c-49f6-a441-d1b0af4e20b4");
+ final FlowFileQueue flowFileQueue = mock(FlowFileQueue.class);
+ when(flowFileQueue.getIdentifier()).thenReturn("87bb99fe-412c-49f6-a441-d1b0af4e20b4");
- final FileSystemSwapManager swapManager = createSwapManager();
- final SwapContents swapContents = swapManager.peek("src/test/resources/old-swap-file.swap", flowFileQueue);
+ final FileSystemSwapManager swapManager = createSwapManager();
+ final SwapContents swapContents = swapManager.peek("src/test/resources/old-swap-file.swap", flowFileQueue);
- final List<FlowFileRecord> records = swapContents.getFlowFiles();
- assertEquals(10000, records.size());
+ final List<FlowFileRecord> records = swapContents.getFlowFiles();
+ assertEquals(10000, records.size());
- for (final FlowFileRecord record : records) {
- assertEquals(4, record.getAttributes().size());
- assertEquals("value", record.getAttribute("key"));
- }
+ for (final FlowFileRecord record : records) {
+ assertEquals(4, record.getAttributes().size());
+ assertEquals("value", record.getAttribute("key"));
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
index 20cd11e2b4..8510da238a 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
@@ -440,8 +440,6 @@ public class StandardProcessSessionIT {
@Test
public void testCheckpointOnSessionDoesNotInteractWithFlowFile() {
- final Relationship relationship = new Relationship.Builder().name("A").build();
-
session.adjustCounter("a", 1, false);
session.adjustCounter("a", 1, true);
session.checkpoint();
@@ -2148,7 +2146,7 @@ public class StandardProcessSessionIT {
in.close();
// Should now be okay
- try (final OutputStream out = session.write(flowFile)) {
+ try (final OutputStream ignored = session.write(flowFile)) {
}
}
@@ -2170,7 +2168,7 @@ public class StandardProcessSessionIT {
out.close();
// Should now be okay
- try (final InputStream in = session.read(flowFile)) {
+ try (final InputStream ignored = session.read(flowFile)) {
}
}
@@ -2512,7 +2510,7 @@ public class StandardProcessSessionIT {
final FlowFile flowFile = session.get();
- FlowFile clone = session.clone(flowFile);
+ session.clone(flowFile);
session.rollback();
assertEquals(1, contentRepo.getClaimantCount(originalClaim));
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
index 5f3655ee3a..748db9ea20 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
@@ -401,7 +401,7 @@ public class TestFileSystemRepository {
// should not be equal because claim1 may still be in use
assertNotSame(claim1.getResourceClaim(), claim2.getResourceClaim());
- try (final OutputStream out = repository.write(claim1)) {
+ try (final OutputStream ignored = repository.write(claim1)) {
}
final ContentClaim claim3 = repository.create(false);
@@ -411,7 +411,7 @@ public class TestFileSystemRepository {
@Test
public void testResourceClaimNotReusedAfterRestart() throws IOException, InterruptedException {
final ContentClaim claim1 = repository.create(false);
- try (final OutputStream out = repository.write(claim1)) {
+ try (final OutputStream ignored = repository.write(claim1)) {
}
repository.shutdown();
@@ -434,7 +434,7 @@ public class TestFileSystemRepository {
final ContentClaim claim2 = repository.create(false);
assertEquals(claim1.getResourceClaim(), claim2.getResourceClaim());
- try (final OutputStream out = repository.write(claim2)) {
+ try (final OutputStream ignored = repository.write(claim2)) {
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
index 8df3d6d036..8c5434f6f7 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
@@ -471,6 +471,7 @@ public class TestStandardProcessScheduler {
*/
@Test
@Disabled
+ @SuppressWarnings("PMD.UnusedLocalVariable")
public void validateEnabledDisableMultiThread() throws Exception {
final StandardProcessScheduler scheduler = createScheduler();
final StandardControllerServiceProvider provider = new StandardControllerServiceProvider(scheduler, null, flowManager, extensionManager);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CollisionAwareResourceProviderWorker.java b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CollisionAwareResourceProviderWorker.java
index 5147dfdb1a..8f61579009 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CollisionAwareResourceProviderWorker.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CollisionAwareResourceProviderWorker.java
@@ -55,7 +55,7 @@ final class CollisionAwareResourceProviderWorker extends ConflictResolvingExtern
final File backupFile = new File(getTargetDirectory().getPath() + "/.provider_" + getId() + "_aside.tmp");
try (
- final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getProviderClassLoader());
+ final NarCloseable ignored = NarCloseable.withComponentNarLoader(getProviderClassLoader());
final InputStream inputStream = getProvider().fetchExternalResource(availableResource);
) {
if (tempFile.exists() && !tempFile.delete()) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/ConflictResolvingExternalResourceProviderWorker.java b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/ConflictResolvingExternalResourceProviderWorker.java
index 2cf08cb0fd..47de8ac1e3 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/ConflictResolvingExternalResourceProviderWorker.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/ConflictResolvingExternalResourceProviderWorker.java
@@ -109,7 +109,7 @@ abstract class ConflictResolvingExternalResourceProviderWorker implements Extern
LOGGER.debug("Worker starts polling provider for resources");
final Collection<ExternalResourceDescriptor> availableResources;
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(providerClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(providerClassLoader)) {
availableResources = provider.listResources();
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/FlowRegistryClientInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/FlowRegistryClientInitializer.java
index ed0b70adcb..c9152badd2 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/FlowRegistryClientInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/FlowRegistryClientInitializer.java
@@ -45,7 +45,7 @@ public class FlowRegistryClientInitializer implements ConfigurableComponentIniti
public void initialize(final ConfigurableComponent component) throws InitializationException {
FlowRegistryClient flowRegistryClient = (FlowRegistryClient) component;
FlowRegistryClientInitializationContext context = new MockFlowRegistryClientInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
flowRegistryClient.initialize(context);
}
}
@@ -53,7 +53,7 @@ public class FlowRegistryClientInitializer implements ConfigurableComponentIniti
@Override
public void teardown(final ConfigurableComponent component) {
FlowRegistryClient flowRegistryClient = (FlowRegistryClient) component;
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final MockConfigurationContext context = new MockConfigurationContext();
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, flowRegistryClient, new MockComponentLogger(), context);
} finally {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ControllerServiceInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ControllerServiceInitializer.java
index 1c3f136bbf..ebb225bb33 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ControllerServiceInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ControllerServiceInitializer.java
@@ -45,14 +45,14 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia
public void initialize(ConfigurableComponent component) throws InitializationException {
ControllerService controllerService = (ControllerService) component;
ControllerServiceInitializationContext context = new MockControllerServiceInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
controllerService.initialize(context);
}
}
@Override
public void teardown(ConfigurableComponent component) {
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
ControllerService controllerService = (ControllerService) component;
final ComponentLog logger = new MockComponentLogger();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/FlowAnalysisRuleInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/FlowAnalysisRuleInitializer.java
index e78732a8bd..7e17a983a0 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/FlowAnalysisRuleInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/FlowAnalysisRuleInitializer.java
@@ -42,7 +42,7 @@ public class FlowAnalysisRuleInitializer implements ConfigurableComponentInitial
public void initialize(ConfigurableComponent component) throws InitializationException {
FlowAnalysisRule flowAnalysisRule = (FlowAnalysisRule) component;
FlowAnalysisRuleInitializationContext context = new MockFlowAnalysisRuleInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
flowAnalysisRule.initialize(context);
}
}
@@ -50,7 +50,7 @@ public class FlowAnalysisRuleInitializer implements ConfigurableComponentInitial
@Override
public void teardown(ConfigurableComponent component) {
FlowAnalysisRule flowAnalysisRule = (FlowAnalysisRule) component;
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final MockConfigurationContext context = new MockConfigurationContext();
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, flowAnalysisRule, new MockComponentLogger(), context);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ParameterProviderInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ParameterProviderInitializer.java
index c220d118ae..dea6174df0 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ParameterProviderInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ParameterProviderInitializer.java
@@ -44,7 +44,7 @@ public class ParameterProviderInitializer implements ConfigurableComponentInitia
public void initialize(final ConfigurableComponent component) throws InitializationException {
ParameterProvider parameterProvider = (ParameterProvider) component;
ParameterProviderInitializationContext context = new MockParameterProviderInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
parameterProvider.initialize(context);
}
}
@@ -52,7 +52,7 @@ public class ParameterProviderInitializer implements ConfigurableComponentInitia
@Override
public void teardown(final ConfigurableComponent component) {
ParameterProvider parameterProvider = (ParameterProvider) component;
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final MockConfigurationContext context = new MockConfigurationContext();
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, parameterProvider, new MockComponentLogger(), context);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ProcessorInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ProcessorInitializer.java
index c1ca26e293..06b0fe4fd5 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ProcessorInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ProcessorInitializer.java
@@ -44,7 +44,7 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
public void initialize(ConfigurableComponent component) {
Processor processor = (Processor) component;
ProcessorInitializationContext initializationContext = new MockProcessorInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), initializationContext.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), initializationContext.getIdentifier())) {
processor.initialize(initializationContext);
}
}
@@ -52,7 +52,7 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
@Override
public void teardown(ConfigurableComponent component) {
Processor processor = (Processor) component;
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final ComponentLog logger = new MockComponentLogger();
final MockProcessContext context = new MockProcessContext();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ReportingTaskInitializer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ReportingTaskInitializer.java
index 5a1780fc17..848529363c 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ReportingTaskInitializer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/init/ReportingTaskInitializer.java
@@ -44,7 +44,7 @@ public class ReportingTaskInitializer implements ConfigurableComponentInitialize
public void initialize(ConfigurableComponent component) throws InitializationException {
ReportingTask reportingTask = (ReportingTask) component;
ReportingInitializationContext context = new MockReportingInitializationContext();
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), context.getIdentifier())) {
reportingTask.initialize(context);
}
}
@@ -52,7 +52,7 @@ public class ReportingTaskInitializer implements ConfigurableComponentInitialize
@Override
public void teardown(ConfigurableComponent component) {
ReportingTask reportingTask = (ReportingTask) component;
- try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final MockConfigurationContext context = new MockConfigurationContext();
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, reportingTask, new MockComponentLogger(), context);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java
index b93910b243..735716640b 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java
@@ -493,7 +493,7 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering
final Bundle bundle = extensionDefinition.getBundle();
final ClassLoader bundleClassLoader = bundle.getClassLoader();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(bundleClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(bundleClassLoader)) {
return Class.forName(extensionDefinition.getImplementationClassName(), true, bundleClassLoader);
} catch (final Exception e) {
throw new RuntimeException("Could not create Class for " + extensionDefinition, e);
@@ -654,7 +654,7 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering
protected Set<BundleCoordinate> findReachableApiBundles(final ConfigurableComponent component) {
final Set<BundleCoordinate> reachableApiBundles = new HashSet<>();
- try (final NarCloseable closeable = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
final List<PropertyDescriptor> descriptors = component.getPropertyDescriptors();
if (descriptors != null && !descriptors.isEmpty()) {
for (final PropertyDescriptor descriptor : descriptors) {
@@ -854,7 +854,7 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering
}
final ClassLoader bundleClassLoader = bundle.getClassLoader();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(bundleClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(bundleClassLoader)) {
final ConfigurableComponent tempComponent;
if (PythonBundle.isPythonCoordinate(bundle.getBundleDetails().getCoordinate())) {
final String procId = getPythonTempComponentId(classType);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-headless-server/src/main/java/org/apache/nifi/headless/HeadlessNiFiServer.java b/nifi-framework-bundle/nifi-framework/nifi-headless-server/src/main/java/org/apache/nifi/headless/HeadlessNiFiServer.java
index eadd9b4012..6a1cb93be3 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-headless-server/src/main/java/org/apache/nifi/headless/HeadlessNiFiServer.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-headless-server/src/main/java/org/apache/nifi/headless/HeadlessNiFiServer.java
@@ -103,7 +103,7 @@ public class HeadlessNiFiServer implements NiFiServer {
ExtensionManagerHolder.init(extensionManager);
// Enrich the flow xml using the Extension Manager mapping
- final FlowParser flowParser = new FlowParser();
+ new FlowParser();
logger.info("Loading Flow...");
FlowFileEventRepository flowFileEventRepository = new RingBufferEventRepository(5);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/socket/TestSocketFlowFileServerProtocol.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/socket/TestSocketFlowFileServerProtocol.java
index c34d0fe1f0..f6957aa8af 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/socket/TestSocketFlowFileServerProtocol.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/socket/TestSocketFlowFileServerProtocol.java
@@ -18,7 +18,6 @@ package org.apache.nifi.remote.protocol.socket;
import org.apache.nifi.remote.Peer;
import org.apache.nifi.remote.PeerDescription;
-import org.apache.nifi.remote.StandardVersionNegotiator;
import org.apache.nifi.remote.cluster.ClusterNodeInformation;
import org.apache.nifi.remote.cluster.NodeInformation;
import org.apache.nifi.remote.io.socket.SocketCommunicationsSession;
@@ -90,9 +89,7 @@ public class TestSocketFlowFileServerProtocol {
}
private SocketFlowFileServerProtocol getDefaultSocketFlowFileServerProtocol() {
- final StandardVersionNegotiator versionNegotiator = new StandardVersionNegotiator(5, 4, 3, 2, 1);
- final SocketFlowFileServerProtocol protocol = spy(new SocketFlowFileServerProtocol());
- return protocol;
+ return spy(new SocketFlowFileServerProtocol());
}
@Test
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
index ad5f200f5d..de87bf5eb1 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
@@ -3463,7 +3463,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
});
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(parameterProvider);
- final PermissionsDTO operatePermissions = dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
+ dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(parameterProvider.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createParameterProviderEntity(snapshot.getComponent(), dtoFactory.createRevisionDTO(snapshot.getLastModification()), permissions, bulletinEntities);
@@ -3485,7 +3485,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
public ParameterProviderEntity deleteParameterProvider(final Revision revision, final String parameterProviderId) {
final ParameterProviderNode parameterProvider = parameterProviderDAO.getParameterProvider(parameterProviderId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(parameterProvider);
- final PermissionsDTO operatePermissions = dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
+ dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
final ParameterProviderDTO snapshot = deleteComponent(
revision,
parameterProvider.getResource(),
@@ -5002,7 +5002,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
private ParameterProviderEntity createParameterProviderEntity(final ParameterProviderNode parameterProvider) {
final RevisionDTO revision = dtoFactory.createRevisionDTO(revisionManager.getRevision(parameterProvider.getIdentifier()));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(parameterProvider);
- final PermissionsDTO operatePermissions = dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
+ dtoFactory.createPermissionsDto(new OperationAuthorizable(parameterProvider));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(parameterProvider.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createParameterProviderEntity(dtoFactory.createParameterProviderDto(parameterProvider),
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
index 306d452578..d616c2e8f6 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
@@ -894,15 +894,11 @@ public class RemoteProcessGroupResource extends ApplicationResource {
},
() -> serviceFacade.verifyUpdateRemoteProcessGroups(processGroupId, shouldTransmit(requestRemotePortRunStatusEntity)),
(_revisions, remotePortRunStatusEntity) -> {
- Set<RemoteProcessGroupEntity> remoteProcessGroupEntities = _revisions.stream()
- .map(revision -> {
- final RemoteProcessGroupEntity entity = serviceFacade.updateRemoteProcessGroup(revision, createDTOWithDesiredRunStatus(revision.getComponentId(),
- remotePortRunStatusEntity));
+ _revisions.forEach(revision -> {
+ final RemoteProcessGroupEntity entity =
+ serviceFacade.updateRemoteProcessGroup(revision, createDTOWithDesiredRunStatus(revision.getComponentId(), remotePortRunStatusEntity));
populateRemainingRemoteProcessGroupEntityContent(entity);
-
- return entity;
- })
- .collect(Collectors.toSet());
+ });
RemoteProcessGroupsEntity remoteProcessGroupsEntity = new RemoteProcessGroupsEntity();
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 bfe6b6f1a4..938394fdc3 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
@@ -44,7 +44,7 @@ public class SearchableMatcher implements AttributeMatcher<ProcessorNode> {
final SearchContext context = new StandardSearchContext(searchTerm, component, flowController.getControllerServiceProvider());
// search the processor using the appropriate thread context classloader
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), component.getClass(), component.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), component.getClass(), component.getIdentifier())) {
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());
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
index d19da4dd85..f7e0a45dbf 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
@@ -392,8 +392,6 @@ public class TestFlowResource {
}
private void setUpGetVersionDifference() {
- final FlowVersionLocation baseLocation = new FlowVersionLocation(SAMPLE_BRANCH_ID_A, SAMPLE_BUCKET_ID_A, SAMPLE_FLOW_ID_A, "1");
- final FlowVersionLocation comparedLocation = new FlowVersionLocation(SAMPLE_BRANCH_ID_B, SAMPLE_BUCKET_ID_B, SAMPLE_FLOW_ID_B, "2");
doReturn(getDifferences()).when(serviceFacade).getVersionDifference(anyString(), any(FlowVersionLocation.class), any(FlowVersionLocation.class));
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/spring/LoginIdentityProviderFactoryBean.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/spring/LoginIdentityProviderFactoryBean.java
index c5ce3935cc..5d6206e449 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/spring/LoginIdentityProviderFactoryBean.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/spring/LoginIdentityProviderFactoryBean.java
@@ -277,28 +277,28 @@ public class LoginIdentityProviderFactoryBean implements FactoryBean<Object>, Di
@Override
public AuthenticationResponse authenticate(LoginCredentials credentials) {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
return baseProvider.authenticate(credentials);
}
}
@Override
public void initialize(LoginIdentityProviderInitializationContext initializationContext) throws ProviderCreationException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
baseProvider.initialize(initializationContext);
}
}
@Override
public void onConfigured(LoginIdentityProviderConfigurationContext configurationContext) throws ProviderCreationException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
baseProvider.onConfigured(configurationContext);
}
}
@Override
public void preDestruction() throws ProviderDestructionException {
- try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ try (final NarCloseable ignored = NarCloseable.withNarLoader()) {
baseProvider.preDestruction();
}
}
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java
index 7642125f4f..3124aaae08 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AuthorizerFactory.java
@@ -178,7 +178,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
for (final org.apache.nifi.registry.security.authorization.generated.UserGroupProvider provider : authorizerConfiguration.getUserGroupProvider()) {
final UserGroupProvider instance = userGroupProviders.get(provider.getIdentifier());
final ClassLoader instanceClassLoader = instance.getClass().getClassLoader();
- try (final ExtensionCloseable extClosable = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
instance.onConfigured(loadAuthorizerConfiguration(provider.getIdentifier(), provider.getProperty()));
}
}
@@ -195,7 +195,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
for (final org.apache.nifi.registry.security.authorization.generated.AccessPolicyProvider provider : authorizerConfiguration.getAccessPolicyProvider()) {
final AccessPolicyProvider instance = accessPolicyProviders.get(provider.getIdentifier());
final ClassLoader instanceClassLoader = instance.getClass().getClassLoader();
- try (final ExtensionCloseable extClosable = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
instance.onConfigured(loadAuthorizerConfiguration(provider.getIdentifier(), provider.getProperty()));
}
}
@@ -215,7 +215,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
}
final Authorizer instance = authorizers.get(provider.getIdentifier());
final ClassLoader instanceClassLoader = instance.getClass().getClassLoader();
- try (final ExtensionCloseable extClosable = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(instanceClassLoader)) {
instance.onConfigured(loadAuthorizerConfiguration(provider.getIdentifier(), provider.getProperty()));
}
}
@@ -248,7 +248,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
// configure the authorizer that is wrapped with integrity checks
// set the context ClassLoader the wrapped authorizer's ClassLoader
- try (final ExtensionCloseable extClosable = ExtensionCloseable.withClassLoader(authorizerClassLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(authorizerClassLoader)) {
authorizer.onConfigured(authorizerConfigurationContext);
}
}
@@ -321,7 +321,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
throw new IllegalStateException("Extension not found in any of the configured class loaders: " + userGroupProviderClassName);
}
- try (final ExtensionCloseable closeable = ExtensionCloseable.withClassLoader(classLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(classLoader)) {
// attempt to load the class
Class<?> rawUserGroupProviderClass = Class.forName(userGroupProviderClassName, true, classLoader);
Class<? extends UserGroupProvider> userGroupProviderClass = rawUserGroupProviderClass.asSubclass(UserGroupProvider.class);
@@ -351,7 +351,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
throw new IllegalStateException("Extension not found in any of the configured class loaders: " + accessPolicyProviderClassName);
}
- try (final ExtensionCloseable closeable = ExtensionCloseable.withClassLoader(classLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(classLoader)) {
// attempt to load the class
Class<?> rawAccessPolicyProviderClass = Class.forName(accessPolicyProviderClassName, true, classLoader);
Class<? extends AccessPolicyProvider> accessPolicyClass = rawAccessPolicyProviderClass.asSubclass(AccessPolicyProvider.class);
@@ -401,7 +401,7 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
classLoader = extensionClassLoader;
}
- try (final ExtensionCloseable closeable = ExtensionCloseable.withClassLoader(classLoader)) {
+ try (final ExtensionCloseable ignored = ExtensionCloseable.withClassLoader(classLoader)) {
// attempt to load the class
Class<?> rawAuthorizerClass = Class.forName(authorizerClassName, true, classLoader);
Class<? extends Authorizer> authorizerClass = rawAuthorizerClass.asSubclass(Authorizer.class);
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
index 2c80df8eef..7cbd856d47 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
@@ -52,7 +52,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
-import java.util.Set;
import java.util.SortedSet;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -1107,8 +1106,6 @@ public class TestRegistryService {
existingFlow.setModified(new Date());
existingFlow.setBucketId(existingBucket.getId());
- final Set<FlowSnapshotEntity> snapshots = new HashSet<>();
-
when(metadataService.getFlowById(existingFlow.getId())).thenReturn(existingFlow);
final SortedSet<VersionedFlowSnapshotMetadata> retrievedSnapshots = registryService.getFlowSnapshots(existingBucket.getId(), existingFlow.getId());
diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/scheduling/StatelessProcessScheduler.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/scheduling/StatelessProcessScheduler.java
index 58bd8366ec..bbf50c3f84 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/scheduling/StatelessProcessScheduler.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/scheduling/StatelessProcessScheduler.java
@@ -100,7 +100,7 @@ public class StatelessProcessScheduler implements ProcessScheduler {
@Override
public void shutdownControllerService(final ControllerServiceNode serviceNode, final ControllerServiceProvider controllerServiceProvider) {
final Class<?> serviceImplClass = serviceNode.getControllerServiceImplementation().getClass();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, serviceImplClass, serviceNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, serviceImplClass, serviceNode.getIdentifier())) {
final ConfigurationContext configContext = new StandardConfigurationContext(serviceNode, controllerServiceProvider, null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, serviceNode.getControllerServiceImplementation(), configContext);
}
@@ -109,7 +109,7 @@ public class StatelessProcessScheduler implements ProcessScheduler {
@Override
public void shutdownReportingTask(final ReportingTaskNode taskNode) {
final ConfigurationContext configContext = taskNode.getConfigurationContext();
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, taskNode.getReportingTask(), configContext);
}
}
@@ -290,7 +290,7 @@ public class StatelessProcessScheduler implements ProcessScheduler {
}
final ReportingTask reportingTask = taskNode.getReportingTask();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, reportingTask.getClass(), taskNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, reportingTask.getClass(), taskNode.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnScheduled.class, reportingTask, taskNode.getConfigurationContext());
}
}
diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java
index 92c3457f91..36e6f49430 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java
@@ -285,7 +285,7 @@ public class StandardStatelessEngine implements StatelessEngine {
}
public Map<PropertyDescriptor, PropertyConfiguration> buildConfiguredAndDefaultPropertyMap(final ConfigurableComponent component, final Map<PropertyDescriptor, PropertyConfiguration> properties) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, component.getClass(), component.getIdentifier())) {
final List<PropertyDescriptor> supported = component.getPropertyDescriptors();
if (supported == null || supported.isEmpty()) {
return Collections.unmodifiableMap(properties);
diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java
index 641b8db994..cdcb0108f4 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java
@@ -172,13 +172,13 @@ public class StatelessFlowManager extends AbstractFlowManager implements FlowMan
.additionalClassPathUrls(additionalUrls)
.buildProcessor();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, procNode.getProcessor());
} catch (final Exception e) {
throw new ComponentLifeCycleException("Failed to invoke @OnAdded methods of " + procNode.getProcessor(), e);
}
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
final StateManager stateManager = statelessEngine.getStateManagerProvider().getStateManager(id);
final StandardProcessContext processContext = new StandardProcessContext(procNode, statelessEngine.getControllerServiceProvider(),
stateManager, () -> false, new StatelessNodeTypeProvider());
@@ -297,7 +297,7 @@ public class StatelessFlowManager extends AbstractFlowManager implements FlowMan
final Class<?> taskClass = taskNode.getReportingTask().getClass();
final String identifier = taskNode.getReportingTask().getIdentifier();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(statelessEngine.getExtensionManager(), taskClass, identifier)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(statelessEngine.getExtensionManager(), taskClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, taskNode.getReportingTask());
if (isFlowInitialized()) {
@@ -393,14 +393,14 @@ public class StatelessFlowManager extends AbstractFlowManager implements FlowMan
final ControllerService service = serviceNode.getControllerServiceImplementation();
final ExtensionManager extensionManager = statelessEngine.getExtensionManager();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
final ConfigurationContext configurationContext =
new StandardConfigurationContext(serviceNode, statelessEngine.getControllerServiceProvider(), null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, service, configurationContext);
}
final ControllerService serviceImpl = serviceNode.getControllerServiceImplementation();
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, serviceImpl.getClass(), serviceImpl.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, serviceImpl.getClass(), serviceImpl.getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, serviceImpl);
} catch (final Exception e) {
throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + serviceImpl, e);
diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessReloadComponent.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessReloadComponent.java
index 911ce8c3e1..1228a4a089 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessReloadComponent.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessReloadComponent.java
@@ -86,7 +86,7 @@ public class StatelessReloadComponent implements ReloadComponent {
newType, id, bundleCoordinate, additionalUrls, true, false, null);
// call OnRemoved for the existing processor using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
final StateManager stateManager = statelessEngine.getStateManagerProvider().getStateManager(id);
final StandardProcessContext processContext = new StandardProcessContext(existingNode, statelessEngine.getControllerServiceProvider(),
stateManager, () -> false, new StatelessNodeTypeProvider());
@@ -142,7 +142,7 @@ public class StatelessReloadComponent implements ReloadComponent {
final ControllerServiceNode newNode = statelessEngine.getFlowManager().createControllerService(newType, id, bundleCoordinate, additionalUrls, true, false, null);
// call OnRemoved for the existing service using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
final ConfigurationContext configurationContext = new StandardConfigurationContext(existingNode, statelessEngine.getControllerServiceProvider(), null);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getControllerServiceImplementation(), configurationContext);
} finally {
@@ -196,7 +196,7 @@ public class StatelessReloadComponent implements ReloadComponent {
final ReportingTaskNode newNode = statelessEngine.getFlowManager().createReportingTask(newType, id, bundleCoordinate, additionalUrls, true, false, null);
// call OnRemoved for the existing reporting task using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getReportingTask(), existingNode.getConfigurationContext());
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
@@ -241,7 +241,7 @@ public class StatelessReloadComponent implements ReloadComponent {
final ParameterProviderNode newNode = statelessEngine.getFlowManager().createParameterProvider(newType, id, bundleCoordinate, additionalUrls, true, false);
// call OnRemoved for the existing reporting task using the previous instance class loader
- try (final NarCloseable x = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(existingInstanceClassLoader)) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, existingNode.getParameterProvider(), existingNode.getConfigurationContext());
} finally {
extensionManager.closeURLClassLoader(id, existingInstanceClassLoader);
diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessSchedulingAgent.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessSchedulingAgent.java
index 31b8d10544..25c814a7e3 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessSchedulingAgent.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessSchedulingAgent.java
@@ -79,7 +79,7 @@ public class StatelessSchedulingAgent implements SchedulingAgent {
}
private void triggerReportingTask(final ReportingTaskNode taskNode, final LifecycleState scheduleState) {
- try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, taskNode.getReportingTask().getClass(), taskNode.getIdentifier())) {
logger.debug("Triggering {} to run", taskNode);
scheduleState.incrementActiveThreadCount(null);
diff --git a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/StateStorageIT.java b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/StateStorageIT.java
index 9a6c131045..ac2027fb29 100644
--- a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/StateStorageIT.java
+++ b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/StateStorageIT.java
@@ -18,7 +18,6 @@
package org.apache.nifi.stateless.basics;
import org.apache.nifi.components.state.Scope;
-import org.apache.nifi.flow.VersionedConnection;
import org.apache.nifi.flow.VersionedPort;
import org.apache.nifi.flow.VersionedProcessor;
import org.apache.nifi.stateless.StatelessSystemIT;
@@ -46,7 +45,7 @@ public class StateStorageIT extends StatelessSystemIT {
final VersionedProcessor generate = flowBuilder.createSimpleProcessor("GenerateFlowFile");
final VersionedPort outPort = flowBuilder.createOutputPort("Out");
- final VersionedConnection connection = flowBuilder.createConnection(generate, outPort, "success");
+ flowBuilder.createConnection(generate, outPort, "success");
// Startup the dataflow
final StatelessDataflow dataflow = loadDataflow(flowBuilder.getFlowSnapshot(), Collections.emptyList());
@@ -73,7 +72,7 @@ public class StateStorageIT extends StatelessSystemIT {
final VersionedProcessor generate = flowBuilder.createSimpleProcessor("GenerateFlowFile");
final VersionedPort outPort = flowBuilder.createOutputPort("Out");
- final VersionedConnection connection = flowBuilder.createConnection(generate, outPort, "success");
+ flowBuilder.createConnection(generate, outPort, "success");
// Startup the dataflow
final StatelessDataflow dataflow = loadDataflow(flowBuilder.getFlowSnapshot(), Collections.emptyList());
@@ -123,7 +122,7 @@ public class StateStorageIT extends StatelessSystemIT {
final VersionedProcessor generate = flowBuilder.createSimpleProcessor("GenerateFlowFile");
final VersionedProcessor failure = flowBuilder.createSimpleProcessor("ThrowProcessException");
- final VersionedConnection connection = flowBuilder.createConnection(generate, failure, "success");
+ flowBuilder.createConnection(generate, failure, "success");
// Startup the dataflow
final StatelessDataflow dataflow = loadDataflow(flowBuilder.getFlowSnapshot(), Collections.emptyList());
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/AutoResumeStateClusteredIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/AutoResumeStateClusteredIT.java
index 3fcb20d8ed..d0ca93fdf3 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/AutoResumeStateClusteredIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/AutoResumeStateClusteredIT.java
@@ -21,7 +21,6 @@ import org.apache.nifi.tests.system.NiFiInstanceFactory;
import org.apache.nifi.tests.system.NiFiSystemIT;
import org.apache.nifi.toolkit.client.NiFiClientException;
import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.web.api.entity.ConnectionEntity;
import org.apache.nifi.web.api.entity.ProcessorEntity;
import org.junit.jupiter.api.Test;
@@ -38,7 +37,7 @@ public class AutoResumeStateClusteredIT extends NiFiSystemIT {
public void testRestartWithAutoResumeStateFalse() throws NiFiClientException, IOException, InterruptedException {
final ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile");
final ProcessorEntity terminate = getClientUtil().createProcessor("TerminateFlowFile");
- final ConnectionEntity connection = getClientUtil().createConnection(generate, terminate, "success");
+ getClientUtil().createConnection(generate, terminate, "success");
getClientUtil().waitForValidProcessor(generate.getId());
getClientUtil().startProcessor(terminate);
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/pg/SingleFlowFileConcurrencyIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/pg/SingleFlowFileConcurrencyIT.java
index 4ee0e9ec65..b566ce87b6 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/pg/SingleFlowFileConcurrencyIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/pg/SingleFlowFileConcurrencyIT.java
@@ -121,9 +121,9 @@ public class SingleFlowFileConcurrencyIT extends NiFiSystemIT {
// Connect Generate -> Input Port -> Count -> Output Port -> Terminate
// Also connect InputPort -> Out2 -> Terminate
- final ConnectionEntity generateToInput = getClientUtil().createConnection(generate, inputPort, "success");
+ getClientUtil().createConnection(generate, inputPort, "success");
final ConnectionEntity inputToSleep = getClientUtil().createConnection(inputPort, sleep);
- final ConnectionEntity sleepToOutput = getClientUtil().createConnection(sleep, outputPort, "success");
+ getClientUtil().createConnection(sleep, outputPort, "success");
final ConnectionEntity inputToSecondOut = getClientUtil().createConnection(inputPort, secondOut);
final ConnectionEntity outputToTerminate = getClientUtil().createConnection(outputPort, terminate);
final ConnectionEntity secondOutToTerminate = getClientUtil().createConnection(secondOut, terminate);
@@ -192,7 +192,7 @@ public class SingleFlowFileConcurrencyIT extends NiFiSystemIT {
// Connect Generate -> Input Port -> Count -> Output Port -> Terminate
// Also connect InputPort -> Out2 -> Terminate
- final ConnectionEntity generateToInput = getClientUtil().createConnection(generate, inputPort, "success");
+ getClientUtil().createConnection(generate, inputPort, "success");
final ConnectionEntity inputToOutput = getClientUtil().createConnection(inputPort, outputPort);
final ConnectionEntity inputToSecondOut = getClientUtil().createConnection(inputPort, secondOut);
final ConnectionEntity outputToTerminate = getClientUtil().createConnection(outputPort, terminate);
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/repositories/ContentAccessIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/repositories/ContentAccessIT.java
index ccc4cbcc31..df74be6286 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/repositories/ContentAccessIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/repositories/ContentAccessIT.java
@@ -105,7 +105,7 @@ public class ContentAccessIT extends NiFiSystemIT {
final ProcessorEntity terminateAa = getClientUtil().createProcessor("TerminateFlowFile");
final ProcessorEntity terminateBa = getClientUtil().createProcessor("TerminateFlowFile");
final ProcessorEntity terminateCa = getClientUtil().createProcessor("TerminateFlowFile");
- final ProcessorEntity terminateUnmatched = getClientUtil().createProcessor("TerminateFlowFile");
+ getClientUtil().createProcessor("TerminateFlowFile");
// Configure Generate
getClientUtil().updateProcessorSchedulingPeriod(generate, "10 mins");
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/stateless/StatelessBasicsIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/stateless/StatelessBasicsIT.java
index d4ed25e6f5..77020c914b 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/stateless/StatelessBasicsIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/stateless/StatelessBasicsIT.java
@@ -806,7 +806,7 @@ public class StatelessBasicsIT extends NiFiSystemIT {
getClientUtil().createConnection(reverseContents, outputPort, SUCCESS, statelessGroup.getId());
// Save v2 of the flow
- final VersionControlInformationEntity v2Vci = getClientUtil().saveFlowVersion(statelessGroup, registryClient, vci);
+ getClientUtil().saveFlowVersion(statelessGroup, registryClient, vci);
waitFor(() -> VersionControlInformationDTO.UP_TO_DATE.equals(getClientUtil().getVersionControlState(statelessGroup.getId())) );
// Let a FlowFile go through and verify the results
diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml
index 6c7def2da2..116f149709 100644
--- a/pmd-ruleset.xml
+++ b/pmd-ruleset.xml
@@ -38,6 +38,7 @@ under the License.
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnnecessaryVarargsArrayCreation" />
+ <rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UseStandardCharsets" />
<rule ref="category/java/codestyle.xml/AvoidDollarSigns" />