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 7483e76dab2 NIFI-16345 Removed redundant or unnecessary variable
checking and fixed incorrect constant usage (#11682)
7483e76dab2 is described below
commit 7483e76dab238498fa308504c1823de9232368a7
Author: dan-s1 <[email protected]>
AuthorDate: Fri Sep 18 17:36:42 2026 -0400
NIFI-16345 Removed redundant or unnecessary variable checking and fixed
incorrect constant usage (#11682)
Signed-off-by: David Handermann <[email protected]>
---
.../evaluation/functions/MathEvaluator.java | 15 ---
.../nifi/stream/io/ByteCountingInputStream.java | 6 +-
.../apache/nifi/processors/aws/s3/PutS3Object.java | 2 +-
.../nifi/processors/aws/s3/util/S3UtilTest.java | 15 +--
.../data/explorer/StandardKustoIngestService.java | 2 +-
.../nifi/processors/box/BoxParseJsonTest.java | 14 +--
.../cdc/mysql/processors/CaptureChangeMySQL.java | 5 -
.../nifi/processors/gcp/storage/PutGCSObject.java | 4 +-
.../processors/graph/ExecuteGraphQueryRecord.java | 2 +-
.../groovyx/flow/ProcessSessionWrap.java | 2 +-
.../apache/nifi/jms/processors/ConsumeJMSIT.java | 12 +--
.../apache/nifi/jms/processors/PublishJMSIT.java | 12 +--
.../nifi/processors/mongodb/PutMongoRecord.java | 2 +-
.../org/apache/nifi/redis/util/RedisUtils.java | 4 +-
.../salesforce/rest/SalesforceRestClient.java | 2 +-
.../nifi/processors/standard/InvokeHTTP.java | 2 +-
.../processors/standard/UpdateDatabaseTable.java | 2 +-
.../nifi/processors/standard/util/FTPTransfer.java | 2 +-
.../org/apache/nifi/lookup/RestLookupService.java | 6 +-
.../apache/nifi/csv/JacksonCSVRecordReader.java | 2 +-
.../main/java/org/apache/nifi/web/Revision.java | 6 +-
.../nifi/provenance/index/lucene/QueryTask.java | 17 +---
.../nifi/authorization/user/NiFiUserUtils.java | 12 +--
.../authorization/resource/DataAuthorizable.java | 4 -
.../endpoints/StatusHistoryEndpointMerger.java | 2 +-
...StandardControllerServiceInvocationHandler.java | 2 +-
.../nifi/processor/StandardProcessContext.java | 2 +-
.../nifi/processor/StandardValidationContext.java | 2 +-
.../nifi/remote/StandardRemoteProcessGroup.java | 1 +
.../apache/nifi/reporting/AbstractEventAccess.java | 16 ++--
.../apache/nifi/util/FlowDifferenceFilters.java | 2 +-
.../CompositeExternalResourceProviderService.java | 6 +-
.../AbstractNativeLibHandlingClassLoaderTest.java | 24 ++---
.../org/apache/nifi/web/api/ConnectorResource.java | 2 +-
.../org/apache/nifi/web/api/ProcessorResource.java | 2 +-
.../metrics/jmx/JmxMetricsResultConverterTest.java | 5 +-
.../org/apache/nifi/util/MockProcessSession.java | 103 +++++++--------------
.../org/apache/nifi/util/MockPropertyValue.java | 2 +-
.../nifi/registry/bootstrap/BootstrapCodec.java | 3 -
.../nifi/registry/bootstrap/RunNiFiRegistry.java | 4 -
.../apache/nifi/registry/event/StandardEvent.java | 2 +-
.../security/authorization/AuthorizerFactory.java | 12 +--
.../nifi/registry/revision/api/Revision.java | 6 +-
.../revision/naive/NaiveRevisionManager.java | 3 +-
.../authorization/ResourceAuthorizationFilter.java | 2 +-
.../nifi/toolkit/cli/impl/result/writer/Table.java | 3 +-
46 files changed, 118 insertions(+), 240 deletions(-)
diff --git
a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/MathEvaluator.java
b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/MathEvaluator.java
index 6fe83c85ba4..e9a2c8edb07 100644
---
a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/MathEvaluator.java
+++
b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/MathEvaluator.java
@@ -78,10 +78,6 @@ public class MathEvaluator extends NumberEvaluator {
methodNamedValue + "'",
subjectlessNoMethodException);
}
- if (method == null) {
- throw new AttributeExpressionLanguageException("Cannot
evaluate 'math' function because no subjectless method was found with the
name:'" + methodNamedValue + "'");
- }
-
executionValue = (Number) method.invoke(null);
} else if (optionalArg == null) {
@@ -94,11 +90,6 @@ public class MathEvaluator extends NumberEvaluator {
" name:'" + methodNamedValue + "', one argument of
type: '" + (subjectIsDecimal ? "double" : "long") + "'",
noOptionalNoMethodException);
}
- if (method == null) {
- throw new AttributeExpressionLanguageException("Cannot
evaluate 'math' function because no method was found matching the passed
parameters:" +
- " name:'" + methodNamedValue + "', one argument of
type: '" + (subjectIsDecimal ? "double" : "long") + "'");
- }
-
if (subjectIsDecimal) {
executionValue = (Number) method.invoke(null,
subjectValue.doubleValue());
} else {
@@ -130,12 +121,6 @@ public class MathEvaluator extends NumberEvaluator {
}
}
- if (method == null) {
- throw new AttributeExpressionLanguageException("Cannot
evaluate 'math' function because no method was found matching the passed
parameters: " +
- "name:'" + methodNamedValue + "', first argument
type: '" + (subjectIsDecimal ? "double" : "long") + "', second argument type:
'"
- + (optionalArgIsDecimal ? "double" : "long") +
"'");
- }
-
if (optionalArgIsDecimal) {
executionValue = (Number) method.invoke(null,
subjectValue, optionalArgValue.doubleValue());
} else {
diff --git
a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingInputStream.java
b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingInputStream.java
index 1d4ac0ff30f..c6349984918 100644
---
a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingInputStream.java
+++
b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingInputStream.java
@@ -66,10 +66,8 @@ public class ByteCountingInputStream extends InputStream {
@Override
public long skip(final long n) throws IOException {
final long skipped = in.skip(n);
- if (skipped >= 0) {
- bytesSkipped += skipped;
- bytesSkippedSinceMark += skipped;
- }
+ bytesSkipped += skipped;
+ bytesSkippedSinceMark += skipped;
return skipped;
}
diff --git
a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
index 8f74e195bc6..19eef27f2f3 100644
---
a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
+++
b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
@@ -1029,7 +1029,7 @@ public class PutS3Object extends AbstractS3Processor {
filePosition = Long.parseLong(fields[1]);
completedParts = new ArrayList<>();
for (String part : fields[2].split(",")) {
- if (part != null && !part.isEmpty()) {
+ if (!part.isEmpty()) {
String[] partFields = part.split("/");
this.completedParts.add(CompletedPart.builder()
.partNumber(Integer.parseInt(partFields[0]))
diff --git
a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/util/S3UtilTest.java
b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/util/S3UtilTest.java
index efb10472377..cc709233647 100644
---
a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/util/S3UtilTest.java
+++
b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/util/S3UtilTest.java
@@ -17,6 +17,8 @@
package org.apache.nifi.processors.aws.s3.util;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.RequestPayer;
@@ -51,14 +53,13 @@ public class S3UtilTest {
assertNull(S3Util.nullIfBlank(null));
}
- @Test
- void testRequestPayerWithFalse() {
- assertNull(S3Util.getRequestPayer(false));
- }
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ void testRequestPayer(boolean requesterPays) {
+ final RequestPayer expected = requesterPays ? RequestPayer.REQUESTER :
null;
+ final RequestPayer actual = S3Util.getRequestPayer(requesterPays);
- @Test
- void testRequestPayerWithTrue() {
- assertEquals(RequestPayer.REQUESTER, S3Util.getRequestPayer(true));
+ assertEquals(expected, actual);
}
@Test
diff --git
a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/data/explorer/StandardKustoIngestService.java
b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/data/explorer/StandardKustoIngestService.java
index 3fe0249fecf..0f55b2b1a96 100644
---
a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/data/explorer/StandardKustoIngestService.java
+++
b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/data/explorer/StandardKustoIngestService.java
@@ -313,7 +313,7 @@ public class StandardKustoIngestService extends
AbstractControllerService implem
KustoIngestQueryResponse kustoIngestQueryResponse;
try {
// Requires a change in the new SDK version. This will fail with
executeQuery v7.0.0 and up of the SDK
- boolean isMgmtCommand = query != null && query.startsWith(".");
+ boolean isMgmtCommand = query.startsWith(".");
final KustoOperationResult kustoOperationResult = isMgmtCommand ?
this.executionClient.executeMgmt(databaseName, query) :
this.executionClient.executeQuery(databaseName, query);
final KustoResultSetTable kustoResultSetTable =
kustoOperationResult.getPrimaryResults();
diff --git
a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/BoxParseJsonTest.java
b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/BoxParseJsonTest.java
index c6279f8c95b..fa335a165d7 100644
---
a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/BoxParseJsonTest.java
+++
b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/BoxParseJsonTest.java
@@ -22,6 +22,8 @@ import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import org.apache.nifi.processors.box.utils.BoxMetadataUtils;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -39,17 +41,11 @@ public class BoxParseJsonTest {
assertEquals(expected, result);
}
- @Test
- void testParseBoolean() {
- // Test true
- boolean expected = true;
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ void testParseBoolean(boolean expected) {
Object result = BoxMetadataUtils.parseJsonValue(Json.value(expected));
assertEquals(expected, result);
-
- // Test false
- expected = false;
- result = BoxMetadataUtils.parseJsonValue(Json.value(expected));
- assertEquals(expected, result);
}
@Test
diff --git
a/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
b/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
index 82db4a52577..269dfb956eb 100644
---
a/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
+++
b/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
@@ -1341,14 +1341,9 @@ public class CaptureChangeMySQL extends
AbstractSessionFactoryProcessor {
if (locationString != null && locationString.length() > 0) {
try {
final Class<?> clazz = Class.forName(drvName);
- if (clazz == null) {
- throw new InitializationException("Can't load Database
Driver " + drvName);
- }
final Driver driver = (Driver)
clazz.getDeclaredConstructor().newInstance();
DriverManager.registerDriver(new DriverShim(driver));
- } catch (final InitializationException e) {
- throw e;
} catch (final Exception e) {
throw new InitializationException("Can't load Database
Driver", e);
}
diff --git
a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java
b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java
index 7a58c2a3af3..b4f3dab2dca 100644
---
a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java
+++
b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java
@@ -525,9 +525,7 @@ public class PutGCSObject extends AbstractGCSProcessor {
}
}
- if (!attributes.isEmpty()) {
- flowFile = session.putAllAttributes(flowFile, attributes);
- }
+ flowFile = session.putAllAttributes(flowFile, attributes);
session.transfer(flowFile, REL_SUCCESS);
final long millis =
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos);
diff --git
a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
index 5c0611d189a..0b72e4a148f 100644
---
a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
+++
b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
@@ -179,7 +179,7 @@ public class ExecuteGraphQueryRecord extends
AbstractGraphExecutor {
private Object getRecordValue(Record record, RecordPath recordPath) {
final RecordPathResult result = recordPath.evaluate(record);
final List<FieldValue> values =
result.getSelectedFields().collect(Collectors.toList());
- if (values != null && !values.isEmpty()) {
+ if (!values.isEmpty()) {
if (values.size() == 1) {
Object raw = values.get(0).getValue();
diff --git
a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/flow/ProcessSessionWrap.java
b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/flow/ProcessSessionWrap.java
index d86075b1a4a..b2727fc1cc2 100644
---
a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/flow/ProcessSessionWrap.java
+++
b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/flow/ProcessSessionWrap.java
@@ -213,7 +213,7 @@ public abstract class ProcessSessionWrap implements
ProcessSession {
String errorMessage = Throwables.getMessage(t, null, 950);
String stackTrace = Throwables.stringStackTrace(t);
for (FlowFile f : toFail) {
- if (t != null && r != null) {
+ if (r != null) {
f = session.putAttribute(f, ERROR_MESSAGE, errorMessage);
f = session.putAttribute(f, ERROR_STACKTRACE, stackTrace);
}
diff --git
a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/ConsumeJMSIT.java
b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/ConsumeJMSIT.java
index 3d6a79d9b63..c89d3c4cd3e 100644
---
a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/ConsumeJMSIT.java
+++
b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/ConsumeJMSIT.java
@@ -340,9 +340,7 @@ public class ConsumeJMSIT {
} catch (Exception e) {
throw e;
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
@@ -421,9 +419,7 @@ public class ConsumeJMSIT {
assertFalse(tcpTransport.get().isConnected(), "It is expected
transport be closed. ");
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
@@ -701,9 +697,7 @@ public class ConsumeJMSIT {
assertEquals(0, broker.getCurrentConnections());
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
diff --git
a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
index 40cc7855160..410398e63a5 100644
---
a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
+++
b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
@@ -431,9 +431,7 @@ public class PublishJMSIT {
runner.run();
assertFalse(tcpTransport.get().isConnected(), "It is expected
transport be closed. ");
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
@@ -493,9 +491,7 @@ public class PublishJMSIT {
assertEquals(threads, connectionFactoryProxy.openedProducers(),
"It is expected " + threads + " MessageProducer to be opened and there are " +
connectionFactoryProxy.openedProducers());
assertTrue(connectionFactoryProxy.isAllResourcesClosed(), "Some
resources were not closed.");
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
@@ -558,9 +554,7 @@ public class PublishJMSIT {
assertTrue(connectionFactoryProxy.openedProducers() <= threads,
"It is expected " + threads + " MessageProducer to be opened and there are " +
connectionFactoryProxy.openedProducers());
assertTrue(connectionFactoryProxy.isAllResourcesClosed(), "Some
resources were not closed.");
} finally {
- if (broker != null) {
- broker.stop();
- }
+ broker.stop();
}
}
diff --git
a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java
b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java
index 41e1633b9b4..2b52a7a41d0 100644
---
a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java
+++
b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java
@@ -274,7 +274,7 @@ public class PutMongoRecord extends AbstractMongoProcessor {
for (Map.Entry<String, Object> entry : doc.entrySet()) {
if (entry.getValue() != null &&
entry.getValue().getClass().isArray()) {
retVal.put(entry.getKey(), convertArrays((Object[])
entry.getValue()));
- } else if (entry.getValue() != null && (entry.getValue()
instanceof Map || entry.getValue() instanceof Document)) {
+ } else if (entry.getValue() != null && entry.getValue() instanceof
Map) {
retVal.put(entry.getKey(), convertArrays(new Document((Map)
entry.getValue())));
} else {
retVal.put(entry.getKey(), entry.getValue());
diff --git
a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java
b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java
index 8fa0f67d5d8..1ff170ff21e 100644
---
a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java
+++
b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java
@@ -472,7 +472,7 @@ public class RedisUtils {
.build());
} else if (REDIS_MODE_STANDALONE.getValue().equals(redisMode)) {
final String[] hostAndPort = connectionString.split("[:]");
- if (hostAndPort == null || hostAndPort.length != 2 ||
StringUtils.isBlank(hostAndPort[0]) || StringUtils.isBlank(hostAndPort[1]) ||
!isInteger(hostAndPort[1])) {
+ if (hostAndPort.length != 2 || StringUtils.isBlank(hostAndPort[0])
|| StringUtils.isBlank(hostAndPort[1]) || !isInteger(hostAndPort[1])) {
results.add(new ValidationResult.Builder()
.subject(CONNECTION_STRING.getDisplayName())
.input(connectionString)
@@ -483,7 +483,7 @@ public class RedisUtils {
} else {
for (final String connection : connectionString.split("[,]")) {
final String[] hostAndPort = connection.split("[:]");
- if (hostAndPort == null || hostAndPort.length != 2 ||
StringUtils.isBlank(hostAndPort[0]) || StringUtils.isBlank(hostAndPort[1]) ||
!isInteger(hostAndPort[1])) {
+ if (hostAndPort.length != 2 ||
StringUtils.isBlank(hostAndPort[0]) || StringUtils.isBlank(hostAndPort[1]) ||
!isInteger(hostAndPort[1])) {
results.add(new ValidationResult.Builder()
.subject(CONNECTION_STRING.getDisplayName())
.input(connection)
diff --git
a/nifi-extension-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/rest/SalesforceRestClient.java
b/nifi-extension-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/rest/SalesforceRestClient.java
index 5fd0ff326d8..f570de1d198 100644
---
a/nifi-extension-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/rest/SalesforceRestClient.java
+++
b/nifi-extension-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/rest/SalesforceRestClient.java
@@ -83,7 +83,7 @@ public class SalesforceRestClient {
try {
response = httpClient.newCall(request).execute();
if (!response.isSuccessful()) {
- throw new ProcessException(String.format("Invalid response
[%s]: %s", response.code(), response.body() == null ? null :
response.body().string()));
+ throw new ProcessException(String.format("Invalid response
[%s]: %s", response.code(), response.body().string()));
}
return response.body().byteStream();
} catch (IOException e) {
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
index ee5434dc69f..a5467a1bb7f 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
@@ -909,7 +909,7 @@ public class InvokeHTTP extends AbstractProcessor {
boolean outputBodyToRequestAttribute = (!isSuccess(statusCode)
|| putToAttribute) && requestFlowFile != null;
boolean outputBodyToResponseContent = (isSuccess(statusCode)
&& !putToAttribute) ||
context.getProperty(RESPONSE_GENERATION_REQUIRED).asBoolean();
ResponseBody responseBody = responseHttp.body();
- boolean bodyExists = responseBody != null &&
!context.getProperty(RESPONSE_BODY_IGNORED).asBoolean();
+ boolean bodyExists =
!context.getProperty(RESPONSE_BODY_IGNORED).asBoolean();
InputStream responseBodyStream = null;
SoftLimitBoundedByteArrayOutputStream
outputStreamToRequestAttribute = null;
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java
index 1e59c506e3c..fc543ca7adb 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java
@@ -400,7 +400,7 @@ public class UpdateDatabaseTable extends AbstractProcessor {
if (createIfNotExists && primaryKeyFields != null) {
primaryKeyColumnNames = new HashSet<>();
Arrays.stream(primaryKeyFields.split(","))
- .filter(path -> path != null && !path.isBlank())
+ .filter(path -> !path.isBlank())
.map(String::trim)
.forEach(primaryKeyColumnNames::add);
} else {
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
index 973fd8f2c59..8ef1ea0312e 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
@@ -205,7 +205,7 @@ public class FTPTransfer implements FileTransfer {
if (remotePath != null) {
reldir = Paths.get(remotePath).relativize(reldir);
}
- if (reldir != null && !reldir.toString().isEmpty()) {
+ if (!reldir.toString().isEmpty()) {
if (!pathPattern.matcher(reldir.toString().replace("\\",
"/")).matches()) {
pathFilterMatches = false;
}
diff --git
a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/RestLookupService.java
b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/RestLookupService.java
index a6b8d1d86a0..ee4e8c62cbb 100644
---
a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/RestLookupService.java
+++
b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/RestLookupService.java
@@ -360,14 +360,10 @@ public class RestLookupService extends
AbstractControllerService implements Reco
if (!response.isSuccessful()
&&
responseHandlingStrategy.equals(ResponseHandlingStrategy.EVALUATED)) {
- final String responseText = responseBody == null ? "[No
Message Received]" : responseBody.string();
+ final String responseText = responseBody.string();
throw new IOException("Request failed with HTTP %d for [%s]:
%s".formatted(response.code(), request.url(), responseText));
}
- if (responseBody == null) {
- return Optional.empty();
- }
-
final Record record;
try (final InputStream is = responseBody.byteStream();
final InputStream bufferedIn = new BufferedInputStream(is,
INPUT_STREAM_BUFFER_SIZE)) {
diff --git
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
index 330ab25533a..bfd4a6f375a 100644
---
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
+++
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
@@ -161,7 +161,7 @@ public class JacksonCSVRecordReader extends
AbstractCSVRecordReader {
final int numFieldNames = rawFieldNames.size();
for (int i = 0; i < csvRecord.length; i++) {
final String rawFieldName = numFieldNames <= i ?
"unknown_field_index_" + i : rawFieldNames.get(i);
- String rawValue = (i >= csvRecord.length) ? null :
csvRecord[i];
+ String rawValue = csvRecord[i];
final Optional<DataType> dataTypeOption =
schema.getDataType(rawFieldName);
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/web/Revision.java
b/nifi-framework-api/src/main/java/org/apache/nifi/web/Revision.java
index e2533b32f8c..e24319adb5c 100644
--- a/nifi-framework-api/src/main/java/org/apache/nifi/web/Revision.java
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/web/Revision.java
@@ -104,7 +104,7 @@ public class Revision implements Serializable {
return false;
}
- if (this.version != null && this.version.equals(thatRevision.version))
{
+ if (this.version.equals(thatRevision.version)) {
return true;
} else {
return clientId != null && !clientId.isBlank() &&
clientId.equals(thatRevision.getClientId());
@@ -115,8 +115,8 @@ public class Revision implements Serializable {
@Override
public int hashCode() {
int hash = 5;
- hash = 59 * hash + (this.componentId != null ?
this.componentId.hashCode() : 0);
- hash = 59 * hash + (this.version != null ? this.version.hashCode() :
0);
+ hash = 59 * hash + this.componentId.hashCode();
+ hash = 59 * hash + this.version.hashCode();
hash = 59 * hash + (this.clientId != null ? this.clientId.hashCode() :
0);
return hash;
}
diff --git
a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
index 47f6d5db144..6c5d5af4500 100644
---
a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
+++
b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
@@ -155,19 +155,12 @@ public class QueryTask implements Runnable {
}
final Tuple<List<ProvenanceEventRecord>, Long> eventsAndTotalHits
= readDocuments(topDocs, storedFields);
+ queryResult.update(eventsAndTotalHits.getKey(),
eventsAndTotalHits.getValue());
- if (eventsAndTotalHits == null) {
- queryResult.update(Collections.emptyList(), 0L);
- logger.info("Will not update query results for queried index
{} for query {} because the maximum number of results have been reached
already",
- indexDir, query);
- } else {
- queryResult.update(eventsAndTotalHits.getKey(),
eventsAndTotalHits.getValue());
-
- final long searchNanos = System.nanoTime() - startNanos;
- final long millis = TimeUnit.NANOSECONDS.toMillis(searchNanos);
- logger.info("Successfully queried index {} for query {};
retrieved {} events with a total of {} hits in {} millis",
- indexDir, query, eventsAndTotalHits.getKey().size(),
eventsAndTotalHits.getValue(), millis);
- }
+ final long searchNanos = System.nanoTime() - startNanos;
+ final long millis = TimeUnit.NANOSECONDS.toMillis(searchNanos);
+ logger.info("Successfully queried index {} for query {}; retrieved
{} events with a total of {} hits in {} millis",
+ indexDir, query, eventsAndTotalHits.getKey().size(),
eventsAndTotalHits.getValue(), millis);
} catch (final Exception e) {
logger.error("Failed to query events against index {}", indexDir,
e);
queryResult.setError("Failed to complete query due to " + e);
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java
index 0248462cde3..d11d874a43f 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/user/NiFiUserUtils.java
@@ -99,16 +99,12 @@ public final class NiFiUserUtils {
final Optional<Object> authenticationCredentials;
final SecurityContext securityContext =
SecurityContextHolder.getContext();
- if (securityContext == null) {
+ final Authentication authentication =
securityContext.getAuthentication();
+ if (authentication == null) {
authenticationCredentials = Optional.empty();
} else {
- final Authentication authentication =
securityContext.getAuthentication();
- if (authentication == null) {
- authenticationCredentials = Optional.empty();
- } else {
- final Object credentials = authentication.getCredentials();
- authenticationCredentials = Optional.ofNullable(credentials);
- }
+ final Object credentials = authentication.getCredentials();
+ authenticationCredentials = Optional.ofNullable(credentials);
}
return authenticationCredentials;
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataAuthorizable.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataAuthorizable.java
index a8a304b86fb..24398f9f9a4 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataAuthorizable.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataAuthorizable.java
@@ -83,10 +83,6 @@ public class DataAuthorizable implements Authorizable,
EnforcePolicyPermissionsT
}
} while (chainedUser != null);
- if (result == null) {
- result = AuthorizationResult.denied();
- }
-
return result;
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java
index 729d662cbd1..3240ab0ab4b 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java
@@ -106,7 +106,7 @@ public class StatusHistoryEndpointMerger implements
EndpointResponseMerger {
}
final Map<String, MetricDescriptor<?>> descriptors =
getStandardMetricDescriptors(uri);
- return descriptors != null && !descriptors.isEmpty();
+ return !descriptors.isEmpty();
}
@Override
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 767d25d39b2..5728f4ff4c3 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
@@ -165,7 +165,7 @@ public class StandardControllerServiceInvocationHandler
implements ControllerSer
// only that method, but the object itself is a
javax.jms.BytesMessage, then code such as the following will result in `isBytes
== false`
// when it should be `true`:
final List<Class<?>> interfaces =
ClassUtils.getAllInterfaces(bareObject.getClass());
- if (interfaces == null || interfaces.isEmpty()) {
+ if (interfaces.isEmpty()) {
return bareObject;
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardProcessContext.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardProcessContext.java
index 5b7b33d50a2..25a13ebb7e5 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardProcessContext.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardProcessContext.java
@@ -346,7 +346,7 @@ public class StandardProcessContext implements
ProcessContext, ControllerService
}
final List<Range> elRanges =
Query.extractExpressionRanges(getProperty(property).getValue());
- return (elRanges != null && !elRanges.isEmpty());
+ return !elRanges.isEmpty();
}
@Override
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardValidationContext.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardValidationContext.java
index 9ee15d3eff1..cdf72800b97 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardValidationContext.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/StandardValidationContext.java
@@ -189,7 +189,7 @@ public class StandardValidationContext implements
ValidationContext {
}
final List<Range> elRanges = Query.extractExpressionRanges(value);
- return (elRanges != null && !elRanges.isEmpty());
+ return !elRanges.isEmpty();
}
@Override
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
index f534f1bb795..ab136cd1af5 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
@@ -637,6 +637,7 @@ public class StandardRemoteProcessGroup implements
RemoteProcessGroup {
// If port has connections, it will be cleaned up when
connections are removed
if (port.getConnections().isEmpty()) {
itr.remove();
+ prunedCount++;
logger.info("Pruning unused Output Port {} from
{}", port, this);
}
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
index 1720fa5d80e..0c735bc5453 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
@@ -256,16 +256,14 @@ public abstract class AbstractEventAccess implements
EventAccess {
status.setRemoteProcessGroupStatus(remoteProcessGroupStatusCollection);
for (final RemoteProcessGroup remoteGroup :
group.getRemoteProcessGroups()) {
final RemoteProcessGroupStatus remoteStatus =
createRemoteGroupStatus(remoteGroup, statusReport, isAuthorized);
- if (remoteStatus != null) {
- if (populateChildStatuses) {
- remoteProcessGroupStatusCollection.add(remoteStatus);
- }
-
- flowFilesReceived += remoteStatus.getReceivedCount();
- bytesReceived += remoteStatus.getReceivedContentSize();
- flowFilesSent += remoteStatus.getSentCount();
- bytesSent += remoteStatus.getSentContentSize();
+ if (populateChildStatuses) {
+ remoteProcessGroupStatusCollection.add(remoteStatus);
}
+
+ flowFilesReceived += remoteStatus.getReceivedCount();
+ bytesReceived += remoteStatus.getReceivedContentSize();
+ flowFilesSent += remoteStatus.getSentCount();
+ bytesSent += remoteStatus.getSentContentSize();
}
// connection status
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
index c4d0e955062..b56279e0d18 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
@@ -1205,7 +1205,7 @@ public class FlowDifferenceFilters {
private static Optional<VersionedPropertyDescriptor>
getVersionedPropertyDescriptor(final FlowDifference difference, final boolean
fromComponentA) {
final VersionedComponent component = fromComponentA ?
difference.getComponentA() : difference.getComponentB();
final Map<String, VersionedPropertyDescriptor> descriptors =
getPropertyDescriptors(component);
- if (descriptors == null || descriptors.isEmpty()) {
+ if (descriptors.isEmpty()) {
return Optional.empty();
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CompositeExternalResourceProviderService.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CompositeExternalResourceProviderService.java
index a20b4ddceba..0d119e327bf 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CompositeExternalResourceProviderService.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-external-resource-utils/src/main/java/org/apache/nifi/flow/resource/CompositeExternalResourceProviderService.java
@@ -72,10 +72,8 @@ final class CompositeExternalResourceProviderService
implements ExternalResource
public synchronized void stop() {
started = false;
- if (workers != null) {
- workers.forEach(ExternalResourceProviderWorker::stop);
- workers.clear();
- }
+ workers.forEach(ExternalResourceProviderWorker::stop);
+ workers.clear();
LOGGER.info("External Resource Provider Service is stopped");
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoaderTest.java
b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoaderTest.java
index b46b4b47c76..950e696b36b 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoaderTest.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoaderTest.java
@@ -39,6 +39,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -72,9 +73,7 @@ public class AbstractNativeLibHandlingClassLoaderTest {
createTempFile("dylib");
createTempFile("lib", "dylib");
- String expected = null;
-
- testFindLibrary(expected);
+ testFindLibrary(null);
}
@Test
@@ -98,9 +97,7 @@ public class AbstractNativeLibHandlingClassLoaderTest {
createTempFile("dll");
- String expected = null;
-
- testFindLibrary(expected);
+ testFindLibrary(null);
}
@Test
@@ -165,9 +162,7 @@ public class AbstractNativeLibHandlingClassLoaderTest {
createTempFile("dylib");
createTempFile("lib", "dylib");
- String expected = null;
-
- testFindLibrary(expected);
+ testFindLibrary(null);
}
@Test
@@ -300,11 +295,10 @@ public class AbstractNativeLibHandlingClassLoaderTest {
nativeLibDirs = new ArrayList<>();
AbstractNativeLibHandlingClassLoader testSubject = createTestSubject();
- String expected = null;
String actual = testSubject.findLibrary("libName");
- assertEquals(expected, actual);
+ assertNull(actual);
verifyNoMoreInteractions(testSubjectHelper);
}
@@ -317,22 +311,18 @@ public class AbstractNativeLibHandlingClassLoaderTest {
when(testSubjectHelper.findLibrary("libName",
nativeLibDir)).thenReturn(null);
AbstractNativeLibHandlingClassLoader testSubject = createTestSubject();
- String expected = null;
String actual = testSubject.findLibrary("libName");
- assertEquals(expected, actual);
+ assertNull(actual);
verify(testSubjectHelper).findLibrary("libName", nativeLibDir);
verifyNoMoreInteractions(testSubjectHelper);
}
@Test
public void testToDirShouldReturnNullForNullInput() {
- File expected = null;
-
File actual = createTestSubject().toDir(null);
-
- assertEquals(expected, actual);
+ assertNull(actual);
}
@Test
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectorResource.java
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectorResource.java
index a0efe4386cd..1da36de45f4 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectorResource.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectorResource.java
@@ -3498,7 +3498,7 @@ public class ConnectorResource extends
ApplicationResource {
}
final String rootCauseMessage = ExceptionUtils.getRootCauseMessage(e);
- if (rootCauseMessage == null || rootCauseMessage.isBlank()) {
+ if (rootCauseMessage.isBlank()) {
return topLevelMessage;
}
return topLevelMessage + " (" + rootCauseMessage + ")";
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
index 0ee9a45099a..5605fa53a91 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
@@ -581,7 +581,7 @@ public class ProcessorResource extends ApplicationResource {
}
final String rootCauseMessage = ExceptionUtils.getRootCauseMessage(e);
- if (rootCauseMessage == null || rootCauseMessage.isBlank()) {
+ if (rootCauseMessage.isBlank()) {
return topLevelMessage;
}
return topLevelMessage + " (" + rootCauseMessage + ")";
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/metrics/jmx/JmxMetricsResultConverterTest.java
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/metrics/jmx/JmxMetricsResultConverterTest.java
index 44edd3b31c0..54c9477b397 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/metrics/jmx/JmxMetricsResultConverterTest.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/metrics/jmx/JmxMetricsResultConverterTest.java
@@ -84,15 +84,14 @@ class JmxMetricsResultConverterTest {
public void testSimpleTypeKeptOriginalType() {
final String expectedString = "Test String";
final int expectedInt = 1;
- final boolean expectedBoolean = Boolean.TRUE;
final Object actualString =
metricsResultConverter.convert(expectedString);
final Object actualInt = metricsResultConverter.convert(expectedInt);
- final Object actualBoolean =
metricsResultConverter.convert(expectedBoolean);
+ final Object actualBoolean = metricsResultConverter.convert(true);
assertEquals(expectedString, actualString);
assertEquals(expectedInt, actualInt);
- assertEquals(expectedBoolean, actualBoolean);
+ assertEquals(Boolean.TRUE, actualBoolean);
assertEquals(SimpleType.STRING.getTypeName(),
actualString.getClass().getName());
assertEquals(SimpleType.INTEGER.getTypeName(),
actualInt.getClass().getName());
assertEquals(SimpleType.BOOLEAN.getTypeName(),
actualBoolean.getClass().getName());
diff --git
a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
index 13b5d20e688..8cd5e3691ca 100644
--- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
+++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
@@ -430,13 +430,9 @@ public class MockProcessSession implements ProcessSession {
@Override
public void exportTo(FlowFile flowFile, final OutputStream out) {
- flowFile = validateState(flowFile);
- if (flowFile == null || out == null) {
- throw new IllegalArgumentException("arguments cannot be null");
- }
-
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ final MockFlowFile mock = validateState(flowFile);
+ if (out == null) {
+ throw new IllegalArgumentException("OutputStream argument cannot
be null");
}
try {
@@ -448,12 +444,9 @@ public class MockProcessSession implements ProcessSession {
@Override
public void exportTo(FlowFile flowFile, final Path path, final boolean
append) {
- flowFile = validateState(flowFile);
- if (flowFile == null || path == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ final MockFlowFile mock = validateState(flowFile);
+ if (path == null) {
+ throw new IllegalArgumentException("Path argument cannot be null");
}
final OpenOption mode = append ? StandardOpenOption.APPEND :
StandardOpenOption.CREATE;
@@ -530,14 +523,11 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile importFrom(final InputStream in, FlowFile flowFile) {
flowFile = validateState(flowFile);
- if (in == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ if (in == null) {
+ throw new IllegalArgumentException("InputStream argument cannot be
null");
}
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
try {
final byte[] data = readFully(in);
@@ -551,13 +541,11 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile importFrom(final Path path, final boolean
keepSourceFile, FlowFile flowFile) {
flowFile = validateState(flowFile);
- if (path == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ if (path == null) {
+ throw new IllegalArgumentException("Path argument cannot be null");
}
- MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile);
+
+ MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -597,13 +585,11 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile putAllAttributes(FlowFile flowFile, final Map<String,
String> attrs) {
flowFile = validateState(flowFile);
- if (attrs == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
+ if (attrs == null) {
+ throw new IllegalArgumentException("Map argument cannot be null");
}
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot update attributes of a
flow file that I did not create");
- }
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
final Map<String, String> updatedAttributes;
@@ -620,18 +606,15 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile putAttribute(FlowFile flowFile, final String attrName,
final String attrValue) {
flowFile = validateState(flowFile);
- if (attrName == null || attrValue == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot update attributes of a
flow file that I did not create");
+ if (attrName == null || attrValue == null) {
+ throw new IllegalArgumentException("arguments cannot be null");
}
if ("uuid".equals(attrName)) {
Assertions.fail("Should not be attempting to set FlowFile UUID via
putAttribute. This will be ignored in production");
}
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
final Map<String, String> attrs = new HashMap<>();
@@ -646,11 +629,7 @@ public class MockProcessSession implements ProcessSession {
throw new IllegalArgumentException("argument cannot be null");
}
- flowFile = validateState(flowFile);
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
- }
-
+ final MockFlowFile mock = validateState(flowFile);
final ByteArrayInputStream bais = new
ByteArrayInputStream(mock.getData());
incrementReadCount(flowFile);
try {
@@ -786,14 +765,11 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile removeAllAttributes(FlowFile flowFile, final
Set<String> attrNames) {
flowFile = validateState(flowFile);
- if (attrNames == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ if (attrNames == null) {
+ throw new IllegalArgumentException("Set argument cannot be null");
}
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
newFlowFile.removeAttributes(attrNames);
@@ -803,9 +779,6 @@ public class MockProcessSession implements ProcessSession {
@Override
public MockFlowFile removeAllAttributes(FlowFile flowFile, final Pattern
keyPattern) {
flowFile = validateState(flowFile);
- if (flowFile == null) {
- throw new IllegalArgumentException("flowFile cannot be null");
- }
if (keyPattern == null) {
return (MockFlowFile) flowFile;
}
@@ -823,13 +796,11 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile removeAttribute(FlowFile flowFile, final String
attrName) {
flowFile = validateState(flowFile);
- if (attrName == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ if (attrName == null) {
+ throw new IllegalArgumentException("String argument cannot be
null");
}
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
final Set<String> attrNames = new HashSet<>();
@@ -890,10 +861,7 @@ public class MockProcessSession implements ProcessSession {
@Override
public void transfer(FlowFile flowFile) {
- flowFile = validateState(flowFile);
- if (!(flowFile instanceof final MockFlowFile mockFlowFile)) {
- throw new IllegalArgumentException("I only accept MockFlowFile");
- }
+ final MockFlowFile mockFlowFile = validateState(flowFile);
// if the flowfile provided was created in this session (i.e. it's in
currentVersions and not in original versions),
// then throw an exception indicating that you can't transfer
FlowFiles back to self.
@@ -963,11 +931,8 @@ public class MockProcessSession implements ProcessSession {
@Override
public MockFlowFile write(FlowFile flowFile, final OutputStreamCallback
callback) {
flowFile = validateState(flowFile);
- if (callback == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
- }
- if (!(flowFile instanceof final MockFlowFile mock)) {
- throw new IllegalArgumentException("Cannot export a flow file that
I did not create");
+ if (callback == null) {
+ throw new IllegalArgumentException("OutputStreamCallback argument
cannot be null");
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -980,7 +945,7 @@ public class MockProcessSession implements ProcessSession {
writeRecursionSet.remove(flowFile);
}
- final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(),
flowFile);
+ final MockFlowFile newFlowFile = new MockFlowFile(flowFile.getId(),
flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
newFlowFile.setData(baos.toByteArray());
@@ -1035,8 +1000,8 @@ public class MockProcessSession implements ProcessSession
{
@Override
public MockFlowFile write(FlowFile flowFile, final StreamCallback
callback) {
flowFile = validateState(flowFile);
- if (callback == null || flowFile == null) {
- throw new IllegalArgumentException("argument cannot be null");
+ if (callback == null) {
+ throw new IllegalArgumentException("StreamCallback argument cannot
be null");
}
final MockFlowFile mock = (MockFlowFile) flowFile;
final ByteArrayInputStream in = new
ByteArrayInputStream(mock.getData());
diff --git
a/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java
b/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java
index 48d859907e5..835fb04af28 100644
--- a/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java
+++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java
@@ -355,6 +355,6 @@ public class MockPropertyValue implements PropertyValue {
}
final List<Range> elRanges = Query.extractExpressionRanges(rawValue);
- return (elRanges != null && !elRanges.isEmpty());
+ return !elRanges.isEmpty();
}
}
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/BootstrapCodec.java
b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/BootstrapCodec.java
index 79a1f718627..2d137e180c6 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/BootstrapCodec.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/BootstrapCodec.java
@@ -42,9 +42,6 @@ public class BootstrapCodec {
public void communicate() throws IOException {
final String line = reader.readLine();
final String[] splits = line.split(" ");
- if (splits.length < 0) {
- throw new IOException("Received invalid command from NiFi
Registry: " + line);
- }
final String cmd = splits[0];
final String[] args;
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
index 71da5c19830..c4702b2e478 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
@@ -455,10 +455,6 @@ public class RunNiFiRegistry {
return new Status(null, null, false, false);
}
- if (props == null) {
- return new Status(null, null, false, false);
- }
-
final String portValue = props.getProperty("port");
final String pid = props.getProperty(PID_KEY);
final String secretKey = props.getProperty("secret.key");
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java
b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java
index 701b241321e..e5db815fff0 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/StandardEvent.java
@@ -38,7 +38,7 @@ public class StandardEvent implements Event {
private StandardEvent(final Builder builder) {
this.eventType = Objects.requireNonNull(builder.eventType);
- this.eventFields = Collections.unmodifiableList(builder.eventFields ==
null
+ this.eventFields =
Collections.unmodifiableList(builder.eventFields.isEmpty()
? Collections.emptyList() : new
ArrayList<>(builder.eventFields));
}
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 8b971a24837..adbe443e2a2 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
@@ -266,17 +266,11 @@ public class AuthorizerFactory implements
UserGroupProviderLookup, AccessPolicyP
@Override
public void destroy() throws Exception {
- if (authorizers != null) {
- authorizers.forEach((key, value) -> value.preDestruction());
- }
+ authorizers.forEach((key, value) -> value.preDestruction());
- if (accessPolicyProviders != null) {
- accessPolicyProviders.forEach((key, value) ->
value.preDestruction());
- }
+ accessPolicyProviders.forEach((key, value) -> value.preDestruction());
- if (userGroupProviders != null) {
- userGroupProviders.forEach((key, value) -> value.preDestruction());
- }
+ userGroupProviders.forEach((key, value) -> value.preDestruction());
}
private Authorizers loadAuthorizersConfiguration() throws Exception {
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-api/src/main/java/org/apache/nifi/registry/revision/api/Revision.java
b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-api/src/main/java/org/apache/nifi/registry/revision/api/Revision.java
index fc45f103c67..4502ec729fe 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-api/src/main/java/org/apache/nifi/registry/revision/api/Revision.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-api/src/main/java/org/apache/nifi/registry/revision/api/Revision.java
@@ -91,7 +91,7 @@ public class Revision {
return false;
}
- if (this.version != null && this.version.equals(thatRevision.version))
{
+ if (this.version.equals(thatRevision.version)) {
return true;
} else {
return clientId != null && !clientId.isBlank() &&
clientId.equals(thatRevision.getClientId());
@@ -102,8 +102,8 @@ public class Revision {
@Override
public int hashCode() {
int hash = 5;
- hash = 59 * hash + (this.entityId != null ? this.entityId.hashCode() :
0);
- hash = 59 * hash + (this.version != null ? this.version.hashCode() :
0);
+ hash = 59 * hash + this.entityId.hashCode();
+ hash = 59 * hash + this.version.hashCode();
hash = 59 * hash + (this.clientId != null ? this.clientId.hashCode() :
0);
return hash;
}
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-common/src/main/java/org/apache/nifi/registry/revision/naive/NaiveRevisionManager.java
b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-common/src/main/java/org/apache/nifi/registry/revision/naive/NaiveRevisionManager.java
index 1119c0fae52..9d376a0691c 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-common/src/main/java/org/apache/nifi/registry/revision/naive/NaiveRevisionManager.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-revision/nifi-registry-revision-common/src/main/java/org/apache/nifi/registry/revision/naive/NaiveRevisionManager.java
@@ -88,11 +88,10 @@ public class NaiveRevisionManager implements
RevisionManager {
revisionList.sort(new RevisionComparator());
// Verify the provided revisions.
- String failedId = null;
for (final Revision revision : revisionList) {
final Revision curRevision = getRevision(revision.getEntityId());
if (!curRevision.equals(revision)) {
- throw new ExpiredRevisionClaimException("Invalid Revision was
given for entity with ID '" + failedId + "'");
+ throw new ExpiredRevisionClaimException("Invalid Revision was
given for entity with ID '" + revision.getEntityId() + "'");
}
}
diff --git
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authorization/ResourceAuthorizationFilter.java
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authorization/ResourceAuthorizationFilter.java
index adf0745d42c..948e534aced 100644
---
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authorization/ResourceAuthorizationFilter.java
+++
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authorization/ResourceAuthorizationFilter.java
@@ -101,7 +101,7 @@ public class ResourceAuthorizationFilter extends
GenericFilterBean {
HttpMethod httpMethod = HttpMethod.valueOf(httpMethodStr);
// Only require authorization for HTTP methods included in
this resource type's rule set
- if (httpMethod != null &&
authorizationRules.requiresAuthorization(httpMethod)) {
+ if (authorizationRules.requiresAuthorization(httpMethod)) {
authorizationCheckIsRequired = true;
action =
authorizationRules.mapHttpMethodToAction(httpMethod);
}
diff --git
a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/writer/Table.java
b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/writer/Table.java
index 6289a0a8db3..682a53b8edc 100644
---
a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/writer/Table.java
+++
b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/result/writer/Table.java
@@ -28,8 +28,7 @@ public class Table {
private final List<String[]> rows = new ArrayList<>();
private Table(final Builder builder) {
- this.columns = Collections.unmodifiableList(
- builder.columns == null ? Collections.emptyList() : new
ArrayList<>(builder.columns));
+ this.columns = Collections.unmodifiableList(new
ArrayList<>(builder.columns));
if (this.columns.isEmpty()) {
throw new IllegalStateException("Cannot create a table with no
columns");