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

pvillard 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 62a21054cf NIFI-14724 Improved Maximum Read Size error message for 
Cache Server
62a21054cf is described below

commit 62a21054cf5c3eee1ab3aff0c5c42ce72a955fe9
Author: exceptionfactory <[email protected]>
AuthorDate: Tue Aug 12 09:26:02 2025 -0500

    NIFI-14724 Improved Maximum Read Size error message for Cache Server
    
    - Updated exception message wording in Cache Request Decoder to use Maximum 
Read Size aligning with property name for easier troubleshooting
    
    Signed-off-by: Pierre Villard <[email protected]>
    
    This closes #10196.
---
 .../cache/server/codec/CacheRequestDecoder.java            | 14 +++++++-------
 .../cache/server/codec/MapCacheRequestDecoder.java         |  4 ++--
 .../cache/server/map/StandardMapCacheServer.java           |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
index 51b4bfa608..627f4c8c0b 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
@@ -53,17 +53,17 @@ public class CacheRequestDecoder extends 
ByteToMessageDecoder {
 
     private final ComponentLog log;
 
-    private final int maxLength;
+    private final int maxReadSize;
 
     private final CacheOperation[] supportedOperations;
 
     public CacheRequestDecoder(
             final ComponentLog log,
-            final int maxLength,
+            final int maxReadSize,
             final CacheOperation[] supportedOperations
     ) {
         this.log = log;
-        this.maxLength = maxLength;
+        this.maxReadSize = maxReadSize;
         this.supportedOperations = supportedOperations;
     }
 
@@ -175,8 +175,8 @@ public class CacheRequestDecoder extends 
ByteToMessageDecoder {
 
         if (byteBuf.readableBytes() >= SHORT_LENGTH) {
             final int length = byteBuf.readUnsignedShort();
-            if (length > maxLength) {
-                throw new IllegalArgumentException(String.format("Maximum 
Operation Length [%d] exceeded [%d]", maxLength, length));
+            if (length > maxReadSize) {
+                throw new IllegalArgumentException(String.format("Maximum Read 
Size [%d] exceeded [%d]", maxReadSize, length));
             }
             if (byteBuf.readableBytes() >= length) {
                 unicodeString = byteBuf.readCharSequence(length, 
StandardCharsets.UTF_8).toString();
@@ -202,8 +202,8 @@ public class CacheRequestDecoder extends 
ByteToMessageDecoder {
         final int readableBytes = byteBuf.readableBytes();
         if (readableBytes >= INT_LENGTH) {
             integer = byteBuf.readInt();
-            if (integer > maxLength) {
-                throw new IllegalArgumentException(String.format("Maximum 
Length [%d] exceeded [%d]", maxLength, integer));
+            if (integer > maxReadSize) {
+                throw new IllegalArgumentException(String.format("Maximum Read 
Size [%d] exceeded [%d]", maxReadSize, integer));
             }
         } else {
             integer = null;
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/MapCacheRequestDecoder.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/MapCacheRequestDecoder.java
index 44421ee707..e2742602e2 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/MapCacheRequestDecoder.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/MapCacheRequestDecoder.java
@@ -35,10 +35,10 @@ public class MapCacheRequestDecoder extends 
CacheRequestDecoder {
 
     public MapCacheRequestDecoder(
             final ComponentLog log,
-            final int maxLength,
+            final int maxReadSize,
             final CacheOperation[] supportedOperations
     ) {
-        super(log, maxLength, supportedOperations);
+        super(log, maxReadSize, supportedOperations);
     }
 
     @Override
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/map/StandardMapCacheServer.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/map/StandardMapCacheServer.java
index f5e57fd5fe..419656ee1f 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/map/StandardMapCacheServer.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/map/StandardMapCacheServer.java
@@ -57,7 +57,7 @@ public class StandardMapCacheServer extends EventCacheServer {
             final int maxCacheEntries,
             final EvictionPolicy evictionPolicy,
             final File persistencePath,
-            final int maxReadLength
+            final int maxReadSize
     ) throws IOException {
         super(log, port);
 
@@ -89,7 +89,7 @@ public class StandardMapCacheServer extends EventCacheServer {
                         mapRemoveResponseEncoder,
                         mapSizeResponseEncoder,
                         mapValueResponseEncoder,
-                        new MapCacheRequestDecoder(log, maxReadLength, 
MapOperation.values()),
+                        new MapCacheRequestDecoder(log, maxReadSize, 
MapOperation.values()),
                         mapCacheRequestHandler,
                         new CacheVersionRequestHandler(log, versionNegotiator)
                 )

Reply via email to