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

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b45fce3 Simplify test.
9b45fce3 is described below

commit 9b45fce304a15b02f744b2abe11bd144ff36402e
Author: Gary Gregory <[email protected]>
AuthorDate: Sun May 17 18:21:05 2026 -0400

    Simplify test.
---
 src/test/java/org/apache/commons/text/StrBuilderClearTest.java | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/text/StrBuilderClearTest.java 
b/src/test/java/org/apache/commons/text/StrBuilderClearTest.java
index 80883550..4cd901ee 100644
--- a/src/test/java/org/apache/commons/text/StrBuilderClearTest.java
+++ b/src/test/java/org/apache/commons/text/StrBuilderClearTest.java
@@ -23,7 +23,6 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Reader;
-import java.lang.reflect.Field;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.lang3.SerializationUtils;
@@ -115,11 +114,7 @@ public class StrBuilderClearTest {
         try (ObjectInputStream ois = new ObjectInputStream(new 
ByteArrayInputStream(serialized))) {
             sb2 = (StrBuilder) ois.readObject();
         }
-        final Field bufField = StrBuilder.class.getDeclaredField("buffer");
-        bufField.setAccessible(true);
-        final Field sizeField = StrBuilder.class.getDeclaredField("size");
-        sizeField.setAccessible(true);
-        final char[] buf2 = (char[]) bufField.get(sb2);
+        final char[] buf2 = sb2.buffer;
         final String bufContent = new String(buf2);
         assertFalse(bufContent.contains("secret_password"), "Deserialized 
StrBuilder buffer must not contain stale chars: " + bufContent);
     }

Reply via email to