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

exceptionfactory pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/support/nifi-1.x by this push:
     new 9161485f21 NIFI-11767 Replaced String.repeat() with 
StringUtils.repeat() for Java 8
9161485f21 is described below

commit 9161485f21d1fa7c1b28bbe66af95e6a4f8b912f
Author: exceptionfactory <exceptionfact...@apache.org>
AuthorDate: Thu Jul 6 18:09:07 2023 -0500

    NIFI-11767 Replaced String.repeat() with StringUtils.repeat() for Java 8
    
    Signed-off-by: David Handermann <exceptionfact...@apache.org>
---
 .../org/apache/nifi/web/security/ProxiedEntitiesUtilsTest.java    | 3 ++-
 .../nifi/web/security/requests/ContentLengthFilterTest.java       | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/ProxiedEntitiesUtilsTest.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/ProxiedEntitiesUtilsTest.java
index e245ea861c..df5cc7fbd9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/ProxiedEntitiesUtilsTest.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/ProxiedEntitiesUtilsTest.java
@@ -17,6 +17,7 @@
 package org.apache.nifi.web.security;
 
 import org.apache.nifi.authorization.user.NiFiUser;
+import org.apache.nifi.util.StringUtils;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -180,7 +181,7 @@ public class ProxiedEntitiesUtilsTest {
 
     @Test
     public void testShouldTokenizeDoubleAnonymous() {
-        assertEquals(Arrays.asList(ANONYMOUS_USER, ANONYMOUS_USER), 
ProxiedEntitiesUtils.tokenizeProxiedEntitiesChain(ANONYMOUS_PROXIED_ENTITY_CHAIN.repeat(2)));
+        assertEquals(Arrays.asList(ANONYMOUS_USER, ANONYMOUS_USER), 
ProxiedEntitiesUtils.tokenizeProxiedEntitiesChain(StringUtils.repeat(ANONYMOUS_PROXIED_ENTITY_CHAIN,
 2)));
     }
 
     @Test
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/requests/ContentLengthFilterTest.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/requests/ContentLengthFilterTest.java
index f34268d8e9..f0bd66de79 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/requests/ContentLengthFilterTest.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/requests/ContentLengthFilterTest.java
@@ -48,11 +48,11 @@ class ContentLengthFilterTest {
 
     // These variables hold data for content small enough to be allowed
     private static final int SMALL_CLAIM_SIZE_BYTES = 150;
-    private static final String SMALL_PAYLOAD = 
"1".repeat(SMALL_CLAIM_SIZE_BYTES);
+    private static final String SMALL_PAYLOAD = StringUtils.repeat("1", 
SMALL_CLAIM_SIZE_BYTES);
 
     // These variables hold data for content too large to be allowed
     private static final int LARGE_CLAIM_SIZE_BYTES = 2000;
-    private static final String LARGE_PAYLOAD = 
"1".repeat(LARGE_CLAIM_SIZE_BYTES);
+    private static final String LARGE_PAYLOAD = StringUtils.repeat("1", 
LARGE_CLAIM_SIZE_BYTES);
 
     private Server serverUnderTest;
     private LocalConnector localConnector;
@@ -92,7 +92,7 @@ class ContentLengthFilterTest {
      */
     @Test
     public void 
testShouldRejectRequestWithLongContentLengthHeaderAndSmallPayload() throws 
Exception {
-        String incompletePayload = "1".repeat(SMALL_CLAIM_SIZE_BYTES / 2);
+        String incompletePayload = StringUtils.repeat("1", 
SMALL_CLAIM_SIZE_BYTES / 2);
         final String requestBody = String.format(POST_REQUEST, 
LARGE_CLAIM_SIZE_BYTES, incompletePayload);
         String response = localConnector.getResponse(requestBody);
 
@@ -172,7 +172,7 @@ class ContentLengthFilterTest {
         }, FORM_CONTENT_SIZE);
 
         // Test to catch a form submission that exceeds the FORM_CONTENT_SIZE 
limit
-        String form = "a=" + "1".repeat(FORM_CONTENT_SIZE);
+        String form = "a=" + StringUtils.repeat("1", FORM_CONTENT_SIZE);
         final String formRequest = "POST / HTTP/1.1\r\nContent-Length: 
%d\r\nHost: h\r\nContent-Type: 
application/x-www-form-urlencoded\r\nAccept-Charset: UTF-8\r\n\r\n%s";
         String response = 
localConnector.getResponse(String.format(formRequest, form.length(), form));
 

Reply via email to