This is an automated email from the ASF dual-hosted git repository.

MikeThomsen 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 3699de43ded NIFI-16342 Replaced deprecated PMD rule CheckSkipResult 
with suggested rule UnusedReturnValue. (#11681)
3699de43ded is described below

commit 3699de43ded1abf7039738af61cdcb7f86fd8487
Author: dan-s1 <[email protected]>
AuthorDate: Wed Sep 16 09:04:21 2026 -0400

    NIFI-16342 Replaced deprecated PMD rule CheckSkipResult with suggested rule 
UnusedReturnValue. (#11681)
---
 .../reporting/azure/loganalytics/TestMetricsFactory.java     |  4 +++-
 .../gcp/credentials/service/GCPCredentialsServiceTest.java   |  5 +++--
 .../nifi/processors/mqtt/adapters/HiveMqV5ClientAdapter.java |  1 +
 .../org/apache/nifi/processors/standard/TestRouteText.java   |  2 +-
 .../nifi/components/connector/StandardConnectorNodeIT.java   |  2 +-
 .../repository/io/TestContentClaimInputStream.java           |  3 ++-
 pmd-ruleset.xml                                              | 12 ++++++++++--
 7 files changed, 21 insertions(+), 8 deletions(-)

diff --git 
a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/test/java/org/apache/nifi/reporting/azure/loganalytics/TestMetricsFactory.java
 
b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/test/java/org/apache/nifi/reporting/azure/loganalytics/TestMetricsFactory.java
index 1a82133b46d..3ee17193f77 100644
--- 
a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/test/java/org/apache/nifi/reporting/azure/loganalytics/TestMetricsFactory.java
+++ 
b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/test/java/org/apache/nifi/reporting/azure/loganalytics/TestMetricsFactory.java
@@ -29,6 +29,8 @@ import org.junit.jupiter.api.Test;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+
 public class TestMetricsFactory {
 
     private ProcessGroupStatus status;
@@ -71,6 +73,6 @@ public class TestMetricsFactory {
     public void  testToJsonWithLongValue() {
         Metric metric = new Metric("instanceId", "groupId", "groupName");
         metric.setCount(0x7ff8000000000000L);
-        gson.toJson(metric);
+        assertDoesNotThrow(() -> gson.toJson(metric));
     }
 }
diff --git 
a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java
 
b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java
index 890d41757d6..0d0a2727d44 100644
--- 
a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java
+++ 
b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java
@@ -46,6 +46,7 @@ import static 
org.apache.nifi.processors.gcp.credentials.factory.CredentialPrope
 import static 
org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors.WORKLOAD_IDENTITY_SUBJECT_TOKEN_PROVIDER;
 import static 
org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors.WORKLOAD_IDENTITY_SUBJECT_TOKEN_TYPE;
 import static 
org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors.WORKLOAD_IDENTITY_TOKEN_ENDPOINT;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -60,10 +61,10 @@ public class GCPCredentialsServiceTest {
     private static final String TARGET_SERVICE_ACCOUNT_VALUE = 
"[email protected]";
 
     @Test
-    public void testToString() throws Exception {
+    public void testToString() {
         // toString method shouldn't cause an exception
         final GCPCredentialsControllerService service = new 
GCPCredentialsControllerService();
-        service.toString();
+        assertDoesNotThrow(service::toString);
     }
 
     @Test
diff --git 
a/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/adapters/HiveMqV5ClientAdapter.java
 
b/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/adapters/HiveMqV5ClientAdapter.java
index 9aa927f282d..8894bbbef49 100644
--- 
a/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/adapters/HiveMqV5ClientAdapter.java
+++ 
b/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/adapters/HiveMqV5ClientAdapter.java
@@ -49,6 +49,7 @@ import static 
org.apache.nifi.processors.mqtt.common.MqttProtocolScheme.SSL;
 import static org.apache.nifi.processors.mqtt.common.MqttProtocolScheme.WS;
 import static org.apache.nifi.processors.mqtt.common.MqttProtocolScheme.WSS;
 
+@SuppressWarnings("PMD.UnusedReturnValue")
 public class HiveMqV5ClientAdapter implements MqttClient {
 
     private final Mqtt5BlockingClient mqtt5BlockingClient;
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
index 54547d2d287..c955328dcdc 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
@@ -205,7 +205,7 @@ public class TestRouteText {
 
         
runner.getFlowFilesForRelationship("t").get(0).assertContentEquals(originalText);
         
runner.getFlowFilesForRelationship("e").get(0).assertContentEquals("start 
middle end\n");
-        runner.getFlowFilesForRelationship("z").isEmpty();
+        assertTrue(runner.getFlowFilesForRelationship("z").isEmpty());
         
runner.getFlowFilesForRelationship("original").get(0).assertContentEquals(originalText);
     }
 
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/StandardConnectorNodeIT.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/StandardConnectorNodeIT.java
index 7b28c75b011..cc3e1315aa5 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/StandardConnectorNodeIT.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/StandardConnectorNodeIT.java
@@ -667,7 +667,7 @@ public class StandardConnectorNodeIT {
         final Throwable cause = assertThrows(FlowUpdateException.class, () -> 
configure(connectorNode, removeLogConfiguration));
         connectorNode.abortUpdate(cause);
 
-        rootGroup.findAllConnections().contains(connection);
+        assertTrue(rootGroup.findAllConnections().contains(connection));
         assertFalse(connection.getFlowFileQueue().isEmpty());
     }
 
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/io/TestContentClaimInputStream.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/io/TestContentClaimInputStream.java
index 2296934d8fe..1e6f93424d4 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/io/TestContentClaimInputStream.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/io/TestContentClaimInputStream.java
@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.mock;
 
@@ -252,7 +253,7 @@ public class TestContentClaimInputStream {
         byte[] buff = new byte[bigReadSize];
         // Force the buffer to read from the delegate stream by reading all 
the data and therefore
         // going over the default buffer size.
-        in.read(buff);
+        assertNotEquals(-1, in.read(buff));
         in.reset();
 
         Mockito.verify(repo, Mockito.times(2)).read(contentClaim);
diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml
index 14c3707e127..c20af088e5f 100644
--- a/pmd-ruleset.xml
+++ b/pmd-ruleset.xml
@@ -89,7 +89,6 @@ under the License.
     <rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
     <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
     <rule ref="category/java/errorprone.xml/BrokenNullCheck" />
-    <rule ref="category/java/errorprone.xml/CheckSkipResult" />
     <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
     <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
     <rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
@@ -98,7 +97,16 @@ under the License.
     <rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
     <rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
     <rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
-
+    <rule ref="category/java/errorprone.xml/UnusedReturnValue">
+        <properties>
+            <!--
+          Suppresses UnusedReturnValue if the flagged method call contains
+          a Mockito 'doReturn', 'doThrow', or 'verify' method calls inside its 
invocation or qualifier tree.
+        -->
+            <property name="violationSuppressXPath"
+                      value=".[descendant::MethodCall[@MethodName=('doReturn', 
'doThrow', 'verify')]]" />
+        </properties>
+    </rule>
     <rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
     <rule ref="category/java/multithreading.xml/DontCallThreadRun" />
     <rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />

Reply via email to