You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2025/11/16 13:19:26 UTC

(poi) branch trunk updated (1604c410d1 -> 73b904f16d)

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

centic pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


    from 1604c410d1 java 11
     new 89fa331beb Sync third-party-library-versions in build.xml
     new d486e50822 Use OpenRewrite to update code to make use of Java 11
     new cd22293975 Newer Mockito prevents using code from org.mockito.internal.matchers
     new 73b904f16d Remove workarounds for IBM JDK and JDK patchlevel 21.0.1

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                          | 42 +++++++++++-----------
 .../poi/examples/crypt/OOXMLPasswordsTry.java      |  4 +--
 .../apache/poi/examples/ss/ConditionalFormats.java |  4 +--
 .../apache/poi/examples/util/TempFileUtils.java    |  4 +--
 .../org/apache/poi/examples/xslf/BarChartDemo.java |  4 +--
 .../apache/poi/examples/xslf/ChartFromScratch.java |  4 +--
 .../examples/xslf/DoughnutChartFromScratch.java    |  4 +--
 .../org/apache/poi/examples/xslf/PieChartDemo.java |  4 +--
 .../examples/xwpf/usermodel/BarChartExample.java   |  4 +--
 .../examples/xwpf/usermodel/ChartFromScratch.java  |  4 +--
 .../org/apache/poi/ooxml/lite/OOXMLLiteAgent.java  |  5 ++-
 .../extractor/POIXMLPropertiesTextExtractor.java   |  4 +--
 .../org/apache/poi/openxml4j/opc/OPCPackage.java   |  4 +--
 .../marshallers/PackagePropertiesMarshaller.java   |  2 +-
 .../org/apache/poi/xdgf/util/HierarchyPrinter.java |  4 +--
 .../java/org/apache/poi/xdgf/util/VsdxToPng.java   |  4 +--
 .../poi/poifs/crypt/dsig/TestSignatureInfo.java    | 16 ++-------
 .../poi/util/tests/TestTempFileThreaded.java       |  4 +--
 .../poi/xssf/eventusermodel/TestXSSFBReader.java   | 20 +++++------
 .../xssf/usermodel/TestXSSFSheetRowGrouping.java   |  3 +-
 .../java/org/apache/poi/hmef/dev/HMEFDumper.java   |  4 +--
 .../java/org/apache/poi/hpbf/dev/PLCDumper.java    |  4 +--
 .../java/org/apache/poi/hslf/dev/PPTXMLDump.java   |  4 +--
 .../apache/poi/hslf/extractor/ImageExtractor.java  |  4 +--
 .../java/org/apache/poi/hslf/record/PPDrawing.java |  6 ++--
 .../java/org/apache/poi/hwpf/model/ListData.java   |  3 +-
 .../org/apache/poi/hwpf/usermodel/HWPFList.java    |  4 ++-
 .../poi/hwpf/model/TestDocumentProperties.java     |  6 ++--
 .../poi/hwpf/model/TestFileInformationBlock.java   | 10 +++---
 .../org/apache/poi/hwpf/model/TestPlexOfCps.java   |  4 ++-
 .../java/org/apache/poi/poifs/dev/POIFSDump.java   |  4 +--
 .../java/org/apache/poi/poifs/dev/POIFSLister.java |  4 +--
 .../poi/poifs/filesystem/POIFSFileSystem.java      |  6 ++--
 .../org/apache/poi/ss/formula/atp/RandBetween.java |  5 ++-
 .../poi/ss/formula/functions/NumericFunction.java  |  3 +-
 .../poi/util/DefaultTempFileCreationStrategy.java  |  3 +-
 .../org/apache/poi/util/FontMetricsDumper.java     |  4 +--
 poi/src/main/java/org/apache/poi/util/HexRead.java |  4 +--
 .../UserNameAwareTempFileCreationStrategy.java     |  3 +-
 poi/src/test/java/org/apache/poi/POITestCase.java  | 13 -------
 .../poi/hssf/usermodel/TestHSSFDataFormatter.java  |  3 +-
 .../function/ExcelCetabFunctionExtractor.java      |  4 +--
 .../UserNameAwareTempFileCreationStrategyTest.java |  3 +-
 43 files changed, 117 insertions(+), 135 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


(poi) 02/04: Use OpenRewrite to update code to make use of Java 11

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit d486e508227820c5f60ae6a9f7fb7ba3bb912497
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Sun Nov 16 11:27:31 2025 +0100

    Use OpenRewrite to update code to make use of Java 11
---
 .../apache/poi/examples/crypt/OOXMLPasswordsTry.java |  4 ++--
 .../apache/poi/examples/ss/ConditionalFormats.java   |  4 ++--
 .../org/apache/poi/examples/util/TempFileUtils.java  |  4 ++--
 .../org/apache/poi/examples/xslf/BarChartDemo.java   |  4 ++--
 .../apache/poi/examples/xslf/ChartFromScratch.java   |  4 ++--
 .../poi/examples/xslf/DoughnutChartFromScratch.java  |  4 ++--
 .../org/apache/poi/examples/xslf/PieChartDemo.java   |  4 ++--
 .../poi/examples/xwpf/usermodel/BarChartExample.java |  4 ++--
 .../examples/xwpf/usermodel/ChartFromScratch.java    |  4 ++--
 .../org/apache/poi/ooxml/lite/OOXMLLiteAgent.java    |  5 ++---
 .../extractor/POIXMLPropertiesTextExtractor.java     |  4 ++--
 .../org/apache/poi/openxml4j/opc/OPCPackage.java     |  4 ++--
 .../marshallers/PackagePropertiesMarshaller.java     |  2 +-
 .../org/apache/poi/xdgf/util/HierarchyPrinter.java   |  4 ++--
 .../java/org/apache/poi/xdgf/util/VsdxToPng.java     |  4 ++--
 .../apache/poi/util/tests/TestTempFileThreaded.java  |  4 ++--
 .../poi/xssf/eventusermodel/TestXSSFBReader.java     | 20 ++++++++++----------
 .../poi/xssf/usermodel/TestXSSFSheetRowGrouping.java |  3 ++-
 .../java/org/apache/poi/hmef/dev/HMEFDumper.java     |  4 ++--
 .../main/java/org/apache/poi/hpbf/dev/PLCDumper.java |  4 ++--
 .../java/org/apache/poi/hslf/dev/PPTXMLDump.java     |  4 ++--
 .../apache/poi/hslf/extractor/ImageExtractor.java    |  4 ++--
 .../java/org/apache/poi/hslf/record/PPDrawing.java   |  6 ++----
 .../java/org/apache/poi/hwpf/model/ListData.java     |  3 ++-
 .../java/org/apache/poi/hwpf/usermodel/HWPFList.java |  4 +++-
 .../org/apache/poi/hwpf/model/TestPlexOfCps.java     |  4 +++-
 .../java/org/apache/poi/poifs/dev/POIFSDump.java     |  4 ++--
 .../java/org/apache/poi/poifs/dev/POIFSLister.java   |  4 ++--
 .../apache/poi/poifs/filesystem/POIFSFileSystem.java |  6 +++---
 .../org/apache/poi/ss/formula/atp/RandBetween.java   |  5 ++++-
 .../poi/ss/formula/functions/NumericFunction.java    |  3 ++-
 .../poi/util/DefaultTempFileCreationStrategy.java    |  3 +--
 .../java/org/apache/poi/util/FontMetricsDumper.java  |  4 ++--
 poi/src/main/java/org/apache/poi/util/HexRead.java   |  4 ++--
 .../util/UserNameAwareTempFileCreationStrategy.java  |  3 +--
 .../poi/hssf/usermodel/TestHSSFDataFormatter.java    |  3 ++-
 .../function/ExcelCetabFunctionExtractor.java        |  4 ++--
 .../UserNameAwareTempFileCreationStrategyTest.java   |  3 +--
 38 files changed, 85 insertions(+), 80 deletions(-)

diff --git a/poi-examples/src/main/java/org/apache/poi/examples/crypt/OOXMLPasswordsTry.java b/poi-examples/src/main/java/org/apache/poi/examples/crypt/OOXMLPasswordsTry.java
index 406d6dc335..534eac6390 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/crypt/OOXMLPasswordsTry.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/crypt/OOXMLPasswordsTry.java
@@ -21,7 +21,7 @@ package org.apache.poi.examples.crypt;
 
 import java.io.File;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.util.Optional;
 import java.util.function.Predicate;
@@ -72,7 +72,7 @@ public final class OOXMLPasswordsTry {
             };
 
             // Try each password in turn, reporting progress
-            try (Stream<String> lines = Files.lines(Paths.get(words))) {
+            try (Stream<String> lines = Files.lines(Path.of(words))) {
                 Optional<String> found = lines.filter(counter).filter(w -> isValid(d, w)).findFirst();
                 System.out.println(found.map(s -> "Password found: " + s).orElse("Error - No password matched"));
             }
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java b/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java
index 5e4d96f0c5..6dda394ff1 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java
@@ -22,7 +22,7 @@ package org.apache.poi.examples.ss;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.List;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -95,7 +95,7 @@ public final class ConditionalFormats {
             if (wb instanceof XSSFWorkbook) {
                 file += "x";
             }
-            try (OutputStream out = Files.newOutputStream(Paths.get(file))) {
+            try (OutputStream out = Files.newOutputStream(Path.of(file))) {
                 wb.write(out);
             }
             System.out.println("Generated: " + file);
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java b/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
index ac6fa02e58..f8ddc6b867 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
@@ -23,7 +23,7 @@ import org.apache.poi.util.DefaultTempFileCreationStrategy;
 import org.apache.poi.util.TempFile;
 
 import java.io.File;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 public final class TempFileUtils {
     private TempFileUtils() {
@@ -31,7 +31,7 @@ public final class TempFileUtils {
 
     @SuppressWarnings("java:S106")
     public static void checkTempFiles() {
-        File tempDir = Paths.get(System.getProperty(TempFile.JAVA_IO_TMPDIR), DefaultTempFileCreationStrategy.POIFILES).toFile();
+        File tempDir = Path.of(System.getProperty(TempFile.JAVA_IO_TMPDIR), DefaultTempFileCreationStrategy.POIFILES).toFile();
         if(tempDir.exists()) {
             String[] tempFiles = tempDir.list();
             if(tempFiles != null && tempFiles.length > 0) {
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java
index 5ddcd19d4a..39c39c51fe 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java
@@ -25,7 +25,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -64,7 +64,7 @@ public final class BarChartDemo {
         }
 
         try (FileInputStream argIS = new FileInputStream(args[0]);
-            BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) {
+            BufferedReader modelReader = Files.newBufferedReader(Path.of(args[1]), StandardCharsets.UTF_8)) {
 
             String chartTitle = modelReader.readLine();  // first line is chart title
             String seriesText = modelReader.readLine();
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java
index 83967307a3..c66a3d194c 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java
@@ -26,7 +26,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -72,7 +72,7 @@ public final class ChartFromScratch {
             return;
         }
 
-        try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) {
+        try (BufferedReader modelReader = Files.newBufferedReader(Path.of(args[0]), StandardCharsets.UTF_8)) {
 
             String chartTitle = modelReader.readLine();  // first line is chart title
             String seriesText = modelReader.readLine();
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java
index 2be46b9b5f..c61e3af625 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java
@@ -41,7 +41,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -64,7 +64,7 @@ public final class DoughnutChartFromScratch {
             return;
         }
 
-        try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) {
+        try (BufferedReader modelReader = Files.newBufferedReader(Path.of(args[0]), StandardCharsets.UTF_8)) {
 
             String chartTitle = modelReader.readLine();  // first line is chart title
             String seriesText = modelReader.readLine();
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/PieChartDemo.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/PieChartDemo.java
index 8fd128314e..f93c7feac8 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/PieChartDemo.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/PieChartDemo.java
@@ -25,7 +25,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -61,7 +61,7 @@ public final class PieChartDemo {
         }
 
         try (FileInputStream argIS = new FileInputStream(args[0]);
-             BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) {
+             BufferedReader modelReader = Files.newBufferedReader(Path.of(args[1]), StandardCharsets.UTF_8)) {
             String chartTitle = modelReader.readLine();  // first line is chart title
 
             try (XMLSlideShow pptx = new XMLSlideShow(argIS)) {
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java
index d96aaeef61..8b643aa5bb 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java
@@ -26,7 +26,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -63,7 +63,7 @@ public final class BarChartExample {
         }
 
         try (FileInputStream argIS = new FileInputStream(args[0]);
-            BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) {
+            BufferedReader modelReader = Files.newBufferedReader(Path.of(args[1]), StandardCharsets.UTF_8)) {
 
             String chartTitle = modelReader.readLine();  // first line is chart title
             String seriesText = modelReader.readLine();
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java
index 6a346aa97b..8f0162da03 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java
@@ -24,7 +24,7 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -67,7 +67,7 @@ public final class ChartFromScratch {
             return;
         }
 
-        try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) {
+        try (BufferedReader modelReader = Files.newBufferedReader(Path.of(args[0]), StandardCharsets.UTF_8)) {
 
             String chartTitle = modelReader.readLine();  // first line is chart title
             String seriesText = modelReader.readLine();
diff --git a/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java b/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java
index b44d6632d5..a19ceec30a 100644
--- a/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java
+++ b/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java
@@ -25,7 +25,6 @@ import java.lang.instrument.Instrumentation;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.security.ProtectionDomain;
 import java.util.HashSet;
@@ -78,7 +77,7 @@ public class OOXMLLiteAgent {
         private static final Set<Integer> hashes = new HashSet<>();
 
         static void load(String path) throws IOException {
-            logPath = Paths.get(path);
+            logPath = Path.of(path);
             if (Files.exists(logPath)) {
                 try (Stream<String> stream = Files.lines(logPath)) {
                     stream.forEach((s) -> hashes.add(s.hashCode()));
@@ -109,7 +108,7 @@ public class OOXMLLiteAgent {
         }
 
         void load(String path) throws IOException {
-            this.logPath = Paths.get(path);
+            this.logPath = Path.of(path);
             if (Files.exists(this.logPath)) {
                 try (Stream<String> stream = Files.lines(this.logPath)) {
                     stream.forEach((s) -> hashes.add(s.hashCode()));
diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java
index 3709fddf4e..d8dd215682 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java
@@ -73,14 +73,14 @@ public class POIXMLPropertiesTextExtractor implements POIXMLTextExtractor {
     }
 
     private void appendDateIfPresent(StringBuilder text, String thing, Optional<Date> value) {
-        if (!value.isPresent()) {
+        if (value.isEmpty()) {
             return;
         }
         appendIfPresent(text, thing, dateFormat.format(value.get()));
     }
 
     private void appendIfPresent(StringBuilder text, String thing, Optional<String> value) {
-        if (!value.isPresent()) {
+        if (value.isEmpty()) {
             return;
         }
         appendIfPresent(text, thing, value.get());
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java
index 237a516d8e..7b5e88647f 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java
@@ -31,7 +31,7 @@ import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -711,7 +711,7 @@ public abstract class OPCPackage implements RelationshipSource, Closeable {
         }
         String name = path.substring(path.lastIndexOf(File.separatorChar) + 1);
 
-        try (InputStream is = Files.newInputStream(Paths.get(path))) {
+        try (InputStream is = Files.newInputStream(Path.of(path))) {
             addThumbnail(name, is);
         }
     }
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
index b682cfc141..9498b22bd3 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
@@ -138,7 +138,7 @@ public class PackagePropertiesMarshaller implements PartMarshaller {
     }
 
     private Element setElementTextContent(String localName, NamespaceImpl namespace, Optional<?> property, String propertyValue) {
-        if (!property.isPresent())
+        if (property.isEmpty())
             return null;
 
         Element root = xmlDoc.getDocumentElement();
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/HierarchyPrinter.java b/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/HierarchyPrinter.java
index b3a8a47b8e..a8745bb042 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/HierarchyPrinter.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/HierarchyPrinter.java
@@ -27,7 +27,7 @@ import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 import org.apache.poi.xdgf.usermodel.XDGFPage;
 import org.apache.poi.xdgf.usermodel.XDGFShape;
@@ -92,7 +92,7 @@ public class HierarchyPrinter {
         String inFilename = args[0];
         String outDir = args[1];
 
-        try (InputStream is = Files.newInputStream(Paths.get(inFilename))) {
+        try (InputStream is = Files.newInputStream(Path.of(inFilename))) {
             XmlVisioDocument doc = new XmlVisioDocument(is);
             printHierarchy(doc, outDir);
         }
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/VsdxToPng.java b/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/VsdxToPng.java
index 8d2aa31555..5616058cbb 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/VsdxToPng.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xdgf/util/VsdxToPng.java
@@ -26,7 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 import javax.imageio.ImageIO;
 
@@ -129,7 +129,7 @@ public class VsdxToPng {
             renderer = new ShapeDebuggerRenderer();
         }
 
-        try (InputStream is = Files.newInputStream(Paths.get(inFilename))) {
+        try (InputStream is = Files.newInputStream(Path.of(inFilename))) {
             XmlVisioDocument doc = new XmlVisioDocument(is);
             renderToPng(doc, pngDir, 2000 / 11.0, renderer);
         }
diff --git a/poi-ooxml/src/test/java/org/apache/poi/util/tests/TestTempFileThreaded.java b/poi-ooxml/src/test/java/org/apache/poi/util/tests/TestTempFileThreaded.java
index 4110ef456b..3b0cf2a08f 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/util/tests/TestTempFileThreaded.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/util/tests/TestTempFileThreaded.java
@@ -24,7 +24,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -83,7 +83,7 @@ class TestTempFileThreaded {
         }
 
         TempFile.setTempFileCreationStrategy(createTempFileCreationStrategy(
-                Paths.get(tmpDir, POIFILES, "TestTempFileThreaded").toFile()));
+                Path.of(tmpDir, POIFILES, "TestTempFileThreaded").toFile()));
     }
 
     @BeforeEach
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java
index 9ea4652f3e..e4b6c7224b 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java
@@ -310,7 +310,7 @@ class TestXSSFBReader {
         ordered.verify(handler).startRow(7);
         ordered.verify(handler).stringCell(eq("A8"), eq("longer int"), isNull());
         ordered.verify(handler).doubleCell(eq("B8"), eq(1.23456789012345E15d), isNull(), any(ExcelNumberFormat.class));
-        ordered.verify(handler).stringCell(eq("C8"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("C8"), isNull(), notNull());
         ordered.verify(handler).endRow(7);
 
         ordered.verify(handler).startRow(8);
@@ -325,7 +325,7 @@ class TestXSSFBReader {
 
         ordered.verify(handler).startRow(10);
         ordered.verify(handler).stringCell(eq("A11"), eq("comment"), isNull());
-        ordered.verify(handler).stringCell(eq("B11"), eq("contents"), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("B11"), eq("contents"), notNull());
         ordered.verify(handler).endRow(10);
 
         ordered.verify(handler).startRow(11);
@@ -372,38 +372,38 @@ class TestXSSFBReader {
         ordered.verify(handler).endRow(20);
 
         ordered.verify(handler).startRow(22);
-        ordered.verify(handler).stringCell(eq("A23"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("A23"), isNull(), notNull());
         ordered.verify(handler).endRow(22);
 
         ordered.verify(handler).startRow(23);
-        ordered.verify(handler).stringCell(eq("C24"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("C24"), isNull(), notNull());
         ordered.verify(handler).endRow(23);
 
         ordered.verify(handler).startRow(27);
-        ordered.verify(handler).stringCell(eq("B28"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("B28"), isNull(), notNull());
         ordered.verify(handler).endRow(27);
 
         ordered.verify(handler).startRow(29);
         ordered.verify(handler).stringCell(eq("B30"), eq("the"), isNull());
-        ordered.verify(handler).stringCell(eq("C30"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("C30"), isNull(), notNull());
         ordered.verify(handler).endRow(29);
 
         ordered.verify(handler).startRow(32);
         ordered.verify(handler).stringCell(eq("B33"), eq("the"), isNull());
-        ordered.verify(handler).stringCell(eq("C33"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("C33"), isNull(), notNull());
         ordered.verify(handler).stringCell(eq("D33"), eq("quick"), isNull());
         ordered.verify(handler).endRow(32);
 
         ordered.verify(handler).startRow(34);
-        ordered.verify(handler).stringCell(eq("B35"), eq("comment6"), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("B35"), eq("comment6"), notNull());
         ordered.verify(handler).endRow(34);
 
         ordered.verify(handler).startRow(64);
-        ordered.verify(handler).stringCell(eq("I65"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("I65"), isNull(), notNull());
         ordered.verify(handler).endRow(64);
 
         ordered.verify(handler).startRow(65);
-        ordered.verify(handler).stringCell(eq("I66"), isNull(), notNull(XSSFComment.class));
+        ordered.verify(handler).stringCell(eq("I66"), isNull(), notNull());
         ordered.verify(handler).endRow(65);
 
         ordered.verify(handler).headerFooter(eq("OddLeftHeader OddCenterHeader OddRightHeader"), eq(true), eq("header"));
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetRowGrouping.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetRowGrouping.java
index b6dddc2c6d..d06acd5c8b 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetRowGrouping.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheetRowGrouping.java
@@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.IOException;
+import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -76,7 +77,7 @@ public final class TestXSSFSheetRowGrouping {
     }
 
     private boolean isCollapsed() {
-        return Math.random() > 0.5d;
+        return ThreadLocalRandom.current().nextDouble() > 0.5d;
     }
 
     private void writeToFile(Workbook p_wb) {
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hmef/dev/HMEFDumper.java b/poi-scratchpad/src/main/java/org/apache/poi/hmef/dev/HMEFDumper.java
index 5e2517f193..e3cbeb3b9a 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hmef/dev/HMEFDumper.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hmef/dev/HMEFDumper.java
@@ -20,7 +20,7 @@ package org.apache.poi.hmef.dev;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.List;
 
 import org.apache.poi.hmef.HMEFMessage;
@@ -68,7 +68,7 @@ public final class HMEFDumper {
             continue;
          }
 
-          try (InputStream stream = Files.newInputStream(Paths.get(arg))) {
+          try (InputStream stream = Files.newInputStream(Path.of(arg))) {
               HMEFDumper dumper = new HMEFDumper(stream);
               dumper.setTruncatePropertyData(truncatePropData);
               dumper.dump();
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hpbf/dev/PLCDumper.java b/poi-scratchpad/src/main/java/org/apache/poi/hpbf/dev/PLCDumper.java
index 74dc8edbe3..dcf4385eac 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hpbf/dev/PLCDumper.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hpbf/dev/PLCDumper.java
@@ -20,7 +20,7 @@ package org.apache.poi.hpbf.dev;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 import org.apache.poi.hpbf.HPBFDocument;
 import org.apache.poi.hpbf.model.QuillContents;
@@ -55,7 +55,7 @@ public final class PLCDumper {
             System.exit(1);
         }
 
-        try (InputStream fis = Files.newInputStream(Paths.get(args[0]))) {
+        try (InputStream fis = Files.newInputStream(Path.of(args[0]))) {
             PLCDumper dump = new PLCDumper(fis);
 
             System.out.println("Dumping " + args[0]);
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java
index fe3788063d..96e3292b66 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java
@@ -26,7 +26,7 @@ import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Arrays;
 
 import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
@@ -216,7 +216,7 @@ public final class PPTXMLDump {
                 System.out.println("Dumping " + arg);
 
                 if (outFile) {
-                    OutputStream fos = Files.newOutputStream(Paths.get(ppt.getName() + ".xml"));
+                    OutputStream fos = Files.newOutputStream(Path.of(ppt.getName() + ".xml"));
                     OutputStreamWriter out = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
                     dump.dump(out);
                     out.close();
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/extractor/ImageExtractor.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/extractor/ImageExtractor.java
index 298d349674..33b52d02d1 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/extractor/ImageExtractor.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/extractor/ImageExtractor.java
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.extractor;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 
 import org.apache.poi.hslf.usermodel.HSLFPictureData;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
@@ -47,7 +47,7 @@ public final class ImageExtractor {
 
                 PictureType type = pict.getType();
                 try (OutputStream out = Files.newOutputStream(
-                        Paths.get("pict_" + i++ + type.extension))) {
+                        Path.of("pict_" + i++ + type.extension))) {
                     out.write(data);
                 }
             }
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
index d710f8b994..ad2ef029f1 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
@@ -143,7 +143,7 @@ public final class PPDrawing extends RecordAtom implements Iterable<EscherRecord
 
     private static Stream<EscherTextboxWrapper> getTextboxHelper(EscherContainerRecord spContainer) {
         Optional<EscherTextboxRecord> oTB = firstEscherRecord(spContainer, EscherRecordTypes.CLIENT_TEXTBOX);
-        if (!oTB.isPresent()) {
+        if (oTB.isEmpty()) {
             return Stream.empty();
         }
 
@@ -309,9 +309,7 @@ public final class PPDrawing extends RecordAtom implements Iterable<EscherRecord
         return Stream.of(dgContainer).
                     flatMap(findEscherContainer(EscherRecordTypes.SPGR_CONTAINER)).
                     flatMap(findEscherContainer(EscherRecordTypes.SP_CONTAINER)).
-                    map(PPDrawing::findInSpContainer).
-                    filter(Optional::isPresent).
-                    map(Optional::get).
+                    map(PPDrawing::findInSpContainer).flatMap(Optional::stream).
                     toArray(StyleTextProp9Atom[]::new);
     }
 
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListData.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListData.java
index a6d817a72f..d01b2dc46c 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListData.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListData.java
@@ -18,6 +18,7 @@
 package org.apache.poi.hwpf.model;
 
 import java.util.Arrays;
+import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.poi.util.Internal;
 
@@ -117,7 +118,7 @@ public final class ListData
 
     int resetListID()
     {
-        _lstf.setLsid( (int) ( Math.random() * System.currentTimeMillis() ) );
+        _lstf.setLsid( (int) ( ThreadLocalRandom.current().nextDouble() * System.currentTimeMillis() ) );
         return _lstf.getLsid();
     }
 
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HWPFList.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HWPFList.java
index 0ba89ec9fa..e67e262097 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HWPFList.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HWPFList.java
@@ -22,6 +22,8 @@ import org.apache.poi.hwpf.model.ListTables;
 import org.apache.poi.util.Internal;
 
 import org.apache.poi.hwpf.model.LFO;
+
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.poi.hwpf.model.LFOData;
 import org.apache.poi.hwpf.model.ListData;
 import org.apache.poi.hwpf.model.ListFormatOverrideLevel;
@@ -65,7 +67,7 @@ public final class HWPFList
     public HWPFList( boolean numbered, StyleSheet styleSheet )
     {
         _listData = new ListData(
-                (int) ( Math.random() * System.currentTimeMillis() ), numbered );
+                (int) ( ThreadLocalRandom.current().nextDouble() * System.currentTimeMillis() ), numbered );
         _lfo = new LFO();
         _lfo.setLsid( _listData.getLsid() );
         _lfoData = new LFOData();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestPlexOfCps.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestPlexOfCps.java
index ef467516e0..bebfed19b9 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestPlexOfCps.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestPlexOfCps.java
@@ -20,6 +20,8 @@ package org.apache.poi.hwpf.model;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.poi.hwpf.HWPFDocFixture;
+
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.poi.util.LittleEndian;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -36,7 +38,7 @@ public final class TestPlexOfCps {
         int last = 0;
         for (int x = 0; x < 110; x++) {
             byte[] intHolder = new byte[4];
-            int span = (int) (110.0f * Math.random());
+            int span = (int) (110.0f * ThreadLocalRandom.current().nextDouble());
             LittleEndian.putInt(intHolder, 0, span);
             _plexOfCps.addProperty(new GenericPropertyNode(last, last + span, intHolder));
             last += span;
diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
index fdf6bb85f4..20db54a6c0 100644
--- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
+++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Iterator;
 
 import org.apache.poi.poifs.common.POIFSConstants;
@@ -66,7 +66,7 @@ public final class POIFSDump {
             }
 
             System.out.println("Dumping " + filename);
-            try (InputStream is = Files.newInputStream(Paths.get(filename));
+            try (InputStream is = Files.newInputStream(Path.of(filename));
                  POIFSFileSystem fs = new POIFSFileSystem(is)) {
                 DirectoryEntry root = fs.getRoot();
                 String filenameWithoutPath = new File(filename).getName();
diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSLister.java b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSLister.java
index 8ae5d6e894..5c2932bcfe 100644
--- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSLister.java
+++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSLister.java
@@ -21,7 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Iterator;
 
 import org.apache.poi.poifs.filesystem.DirectoryNode;
@@ -70,7 +70,7 @@ public class POIFSLister {
    }
 
    public static void viewFileOld(final String filename, boolean withSizes) throws IOException {
-      try (InputStream fis = Files.newInputStream(Paths.get(filename));
+      try (InputStream fis = Files.newInputStream(Path.of(filename));
            POIFSFileSystem fs = new POIFSFileSystem(fis)) {
          displayDirectory(fs.getRoot(), "", withSizes);
       }
diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
index 6ed6610255..910afb4b79 100644
--- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
+++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
@@ -26,7 +26,7 @@ import java.nio.channels.Channels;
 import java.nio.channels.FileChannel;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -822,8 +822,8 @@ public class POIFSFileSystem extends BlockStore
             System.exit(1);
         }
 
-        try (InputStream istream = Files.newInputStream(Paths.get(args[0]))) {
-            try (OutputStream ostream = Files.newOutputStream(Paths.get(args[1]))) {
+        try (InputStream istream = Files.newInputStream(Path.of(args[0]))) {
+            try (OutputStream ostream = Files.newOutputStream(Path.of(args[1]))) {
                 try (POIFSFileSystem fs = new POIFSFileSystem(istream)) {
                     fs.writeFilesystem(ostream);
                 }
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java
index ead3a119d6..ff4c6f96ee 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java
@@ -22,8 +22,11 @@ import org.apache.poi.ss.formula.eval.NumberEval;
 import org.apache.poi.ss.formula.eval.OperandResolver;
 import org.apache.poi.ss.formula.eval.ValueEval;
 import org.apache.poi.ss.formula.functions.FreeRefFunction;
+
 import org.apache.poi.ss.formula.OperationEvaluationContext;
 
+import java.util.concurrent.ThreadLocalRandom;
+
 /**
  * Implementation of Excel 'Analysis ToolPak' function RANDBETWEEN()<br>
  *
@@ -75,7 +78,7 @@ final class RandBetween implements FreeRefFunction{
             top = bottom;
         }
 
-        return new NumberEval((bottom + (long)(Math.random() * ((top - bottom) + 1))));
+        return new NumberEval((bottom + (long)(ThreadLocalRandom.current().nextDouble() * ((top - bottom) + 1))));
 
     }
 
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java
index a0baba1e13..785a37df8d 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java
@@ -27,6 +27,7 @@ import java.math.BigInteger;
 import java.math.MathContext;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
+import java.util.concurrent.ThreadLocalRandom;
 
 public abstract class NumericFunction implements Function {
 
@@ -189,7 +190,7 @@ public abstract class NumericFunction implements Function {
     public static final Function RAND = NumericFunction::evaluateRand;
 
     private static ValueEval evaluateRand(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
-        return (args.length != 0) ? ErrorEval.VALUE_INVALID : new NumberEval(Math.random());
+        return (args.length != 0) ? ErrorEval.VALUE_INVALID : new NumberEval(ThreadLocalRandom.current().nextDouble());
     }
 
     public static final Function POISSON = Poisson::evaluate;
diff --git a/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java b/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java
index 48495c94a3..4f047ecf2c 100644
--- a/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java
+++ b/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java
@@ -23,7 +23,6 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.attribute.FileAttribute;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -130,7 +129,7 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy
 
     protected Path getPOIFilesDirectoryPath() throws IOException {
         if (initDir == null) {
-            return Paths.get(getJavaIoTmpDir(), POIFILES);
+            return Path.of(getJavaIoTmpDir(), POIFILES);
         } else {
             return initDir.toPath();
         }
diff --git a/poi/src/main/java/org/apache/poi/util/FontMetricsDumper.java b/poi/src/main/java/org/apache/poi/util/FontMetricsDumper.java
index 5078436bc2..49abd8c9f4 100644
--- a/poi/src/main/java/org/apache/poi/util/FontMetricsDumper.java
+++ b/poi/src/main/java/org/apache/poi/util/FontMetricsDumper.java
@@ -25,7 +25,7 @@ import java.awt.Toolkit;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Properties;
 
 @SuppressWarnings("deprecation")
@@ -67,7 +67,7 @@ public class FontMetricsDumper {
             props.setProperty("font." + fontName + ".widths", widths.toString());
         }
 
-        try (OutputStream fileOut = Files.newOutputStream(Paths.get("font_metrics.properties"))) {
+        try (OutputStream fileOut = Files.newOutputStream(Path.of("font_metrics.properties"))) {
             props.store(fileOut, "Font Metrics");
         }
     }
diff --git a/poi/src/main/java/org/apache/poi/util/HexRead.java b/poi/src/main/java/org/apache/poi/util/HexRead.java
index 4a1b7a1c4e..737f6d56e9 100644
--- a/poi/src/main/java/org/apache/poi/util/HexRead.java
+++ b/poi/src/main/java/org/apache/poi/util/HexRead.java
@@ -19,7 +19,7 @@ package org.apache.poi.util;
 
 import java.io.*;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -85,7 +85,7 @@ public class HexRead {
     }
 
     public static byte[] readData( String filename, String section ) throws IOException {
-        return readData(Files.newInputStream(Paths.get(filename)), section);
+        return readData(Files.newInputStream(Path.of(filename)), section);
     }
 
     @SuppressWarnings("fallthrough")
diff --git a/poi/src/main/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategy.java b/poi/src/main/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategy.java
index 1fc84e837e..cb8fa00658 100644
--- a/poi/src/main/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategy.java
+++ b/poi/src/main/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategy.java
@@ -19,7 +19,6 @@ package org.apache.poi.util;
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 /**
  * Username-aware subclass of {@link DefaultTempFileCreationStrategy}
@@ -45,7 +44,7 @@ public class UserNameAwareTempFileCreationStrategy extends DefaultTempFileCreati
         if (null != username && !username.isEmpty()) {
             poifilesDir += "_" + username;
         }
-        return Paths.get(tmpDir, poifilesDir);
+        return Path.of(tmpDir, poifilesDir);
     }
 
 }
diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
index 576fa6e279..7020dbf1ed 100644
--- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
+++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
@@ -29,6 +29,7 @@ import java.util.Calendar;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.ss.usermodel.Cell;
@@ -365,7 +366,7 @@ public final class TestHSSFDataFormatter {
         log("\n==== DEFAULT NUMBER FORMAT ====");
         while (it.hasNext()) {
             Cell cell = it.next();
-            cell.setCellValue(cell.getNumericCellValue() * Math.random() / 1000000 - 1000);
+            cell.setCellValue(cell.getNumericCellValue() * ThreadLocalRandom.current().nextDouble() / 1000000 - 1000);
             log(formatter.formatCellValue(cell));
 
             String formatted = formatter.formatCellValue(cell);
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/function/ExcelCetabFunctionExtractor.java b/poi/src/test/java/org/apache/poi/ss/formula/function/ExcelCetabFunctionExtractor.java
index 3d6f525d2b..58f8f81110 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/function/ExcelCetabFunctionExtractor.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/function/ExcelCetabFunctionExtractor.java
@@ -26,7 +26,7 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -369,7 +369,7 @@ public final class ExcelCetabFunctionExtractor {
             throw new IllegalStateException("Did not find file " + SOURCE_DOC_FILE_NAME + " in the resources");
         }
 
-        try (InputStream stream = Files.newInputStream(Paths.get(SOURCE_DOC_FILE_NAME))) {
+        try (InputStream stream = Files.newInputStream(Path.of(SOURCE_DOC_FILE_NAME))) {
             File outFile = new File("functionMetadataCetab.txt");
 
             processFile(stream, outFile);
diff --git a/poi/src/test/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategyTest.java b/poi/src/test/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategyTest.java
index c8fbfcd9dc..fd4b9267a6 100644
--- a/poi/src/test/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategyTest.java
+++ b/poi/src/test/java/org/apache/poi/util/UserNameAwareTempFileCreationStrategyTest.java
@@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import static org.apache.poi.util.DefaultTempFileCreationStrategy.POIFILES;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -33,7 +32,7 @@ class UserNameAwareTempFileCreationStrategyTest {
         UserNameAwareTempFileCreationStrategy strategy = new UserNameAwareTempFileCreationStrategy();
         String tmpDir = System.getProperty(TempFile.JAVA_IO_TMPDIR);
         String username = System.getProperty("user.name");
-        String expectedPath = Paths.get(tmpDir, POIFILES + "_" + username).toString();
+        String expectedPath = Path.of(tmpDir, POIFILES + "_" + username).toString();
 
         Path actualPath = strategy.getPOIFilesDirectoryPath();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


(poi) 04/04: Remove workarounds for IBM JDK and JDK patchlevel 21.0.1

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 73b904f16d937338313d94ddfd629cb7e97eb65b
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Sun Nov 16 14:17:22 2025 +0100

    Remove workarounds for IBM JDK and JDK patchlevel 21.0.1
    
    IBM JDK 11 seems to be fixed and we do not expect to run
    tests with JDK 21.0.1 anymore
---
 .../apache/poi/poifs/crypt/dsig/TestSignatureInfo.java   | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java
index d834fd1e87..539fffa58c 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java
@@ -253,14 +253,7 @@ class TestSignatureInfo {
             SignatureInfo si = new SignatureInfo();
             si.setOpcPackage(pkg);
             si.setSignatureConfig(sic);
-            boolean isValid = si.verifySignature();
-
-            // We reported https://bugs.openjdk.org/browse/JDK-8320597 because of this, it will be fixed in JDK 22
-            // and maybe in newer JDK 21 patch-levels
-            assumeTrue(isValid && !"21.0.1".equals(System.getProperty("java.version")),
-                    "This fails on JDK 21.0.1, see https://bugs.openjdk.org/browse/JDK-8320597");
-
-            assertTrue(isValid,
+            assertTrue(si.verifySignature(),
                     // add some details to find out why "verifySignature()" returns false sometimes
                     "Failed for " + System.getProperty("java.version") +
                             ": Verifying signature failed, hasNext: " + si.getSignatureParts().iterator().hasNext() + ": " +
@@ -638,8 +631,6 @@ class TestSignatureInfo {
 
     @Test
     void testCertChain() throws Exception {
-        final boolean isIBM = System.getProperty("java.vendor").contains("IBM");
-
         DummyKeystore ks = new DummyKeystore(testdata.getFile("chaintest.pfx"), STORE_PASS);
         KeyCertPair certPair = ks.getKeyPair("poitest", "test");
 
@@ -664,10 +655,7 @@ class TestSignatureInfo {
                 X509Certificate signer = sp.getSigner();
                 assertNotNull(signer, "signer undefined?!");
                 List<X509Certificate> certChainRes = sp.getCertChain();
-
-                // IBM JDK is still buggy, even after fix for APAR IJ21985
-                int exp = isIBM ? 1 : 3;
-                assertEquals(exp, certChainRes.size());
+                assertEquals(3, certChainRes.size());
             }
 
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


(poi) 01/04: Sync third-party-library-versions in build.xml

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 89fa331beb94f10702b74809ae9e501c1b6067ef
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Sun Nov 16 08:48:09 2025 +0100

    Sync third-party-library-versions in build.xml
---
 build.xml | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/build.xml b/build.xml
index 0e70f9c0a5..102fd06f23 100644
--- a/build.xml
+++ b/build.xml
@@ -284,7 +284,7 @@ under the License.
     <dependency prefix="main.jmhAnnotation" artifact="org.openjdk.jmh:jmh-generator-annprocess:1.35" usage="main-tests"/>
     <dependency prefix="main.hamcrest" artifact="org.hamcrest:hamcrest:3.0" usage="main-tests"/>
     <dependency prefix="main.xmlunit" artifact="org.xmlunit:xmlunit-core:2.10.3" usage="main-tests"/>
-    <dependency prefix="main.mockito" artifact="org.mockito:mockito-core:4.11.0" usage="main-tests"/>
+    <dependency prefix="main.mockito" artifact="org.mockito:mockito-core:5.20.0" usage="main-tests"/>
     <dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.17.5" usage="main-tests"/>
     <dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.17.5" usage="main-tests"/>
     <dependency prefix="main.objenesis" artifact="org.objenesis:objenesis:3.1" usage="main-tests"/>
@@ -670,11 +670,7 @@ under the License.
             <fileset dir="${basedir}/lib/main-tests">
                 <include name="byte-buddy-*1.12*.jar"/>
                 <include name="mockito-core-3*.jar"/>
-                <include name="mockito-core-4.0*.jar"/>
-                <include name="mockito-core-4.2*.jar"/>
-                <include name="mockito-core-4.5*.jar"/>
-                <include name="mockito-core-4.6*.jar"/>
-                <include name="mockito-core-4.8*.jar"/>
+                <include name="mockito-core-4*.jar"/>
                 <include name="hamcrest-core*"/>
                 <include name="junit-4*.jar"/>
                 <include name="*slf4j*.jar"/>
@@ -2576,29 +2572,30 @@ under the License.
 
         <!-- findbugs successor, spotbugs ... need to use the dependencies used in the spotbugs release. -->
         <!-- compare with the entries found in the MANIFEST.MF of spotbugs.jar -->
-        <dependency prefix="spotbugs" artifact="com.github.spotbugs:spotbugs:4.8.6" usage="${spotbugs.lib}" target="spotbugs.jar"/>
-        <dependency prefix="spotbugs-ant" artifact="com.github.spotbugs:spotbugs-ant:4.8.6" usage="${spotbugs.lib}" target="spotbugs-ant.jar"/>
-        <dependency prefix="spotbugs-anno" artifact="com.github.spotbugs:spotbugs-annotations:4.8.6" usage="${spotbugs.lib}" target="spotbugs-annotations.jar"/>
-        <dependency prefix="spotbugs.asm" artifact="org.ow2.asm:asm:9.7" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.asm-analysis" artifact="org.ow2.asm:asm-analysis:9.7" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.asm-commons" artifact="org.ow2.asm:asm-commons:9.7" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.asm-tree" artifact="org.ow2.asm:asm-tree:9.7" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.asm-util" artifact="org.ow2.asm:asm-util:9.7" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs" artifact="com.github.spotbugs:spotbugs:4.9.8" usage="${spotbugs.lib}" target="spotbugs.jar"/>
+        <dependency prefix="spotbugs-ant" artifact="com.github.spotbugs:spotbugs-ant:4.9.8" usage="${spotbugs.lib}" target="spotbugs-ant.jar"/>
+        <dependency prefix="spotbugs-anno" artifact="com.github.spotbugs:spotbugs-annotations:4.9.8" usage="${spotbugs.lib}" target="spotbugs-annotations.jar"/>
+        <dependency prefix="spotbugs.asm" artifact="org.ow2.asm:asm:9.9" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.asm-analysis" artifact="org.ow2.asm:asm-analysis:9.9" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.asm-commons" artifact="org.ow2.asm:asm-commons:9.9" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.asm-tree" artifact="org.ow2.asm:asm-tree:9.9" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.asm-util" artifact="org.ow2.asm:asm-util:9.9" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.jsr305" artifact="com.google.code.findbugs:jsr305:3.0.2" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.dom4j" artifact="org.dom4j:dom4j:2.1.4" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.dom4j" artifact="org.dom4j:dom4j:2.2.0" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.jaxen" artifact="jaxen:jaxen:2.0.0" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.bcel" artifact="org.apache.bcel:bcel:6.9.0" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.bcel" artifact="org.apache.bcel:bcel:6.11.0" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.slf4j-api" artifact="org.slf4j:slf4j-api:2.0.17" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.commons-lang" artifact="org.apache.commons:commons-lang3:3.14.0" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.commons-text" artifact="org.apache.commons:commons-text:1.10.0" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.commons-lang" artifact="org.apache.commons:commons-lang3:3.19.0" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.commons-text" artifact="org.apache.commons:commons-text:1.14.0" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.commons-codec" artifact="commons-codec:commons-codec:1.15" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.commons-io" artifact="commons-io:commons-io:2.20.0" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.jcip-annotations" artifact="net.jcip:jcip-annotations:1.0" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.icu4j" artifact="com.ibm.icu:icu4j:68.2" usage="${spotbugs.lib}" target="icu4j-68.2.jar"/>
-        <dependency prefix="spotbugs.log4j-api" artifact="org.apache.logging.log4j:log4j-api:2.24.3" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.24.3" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.log4j-slf4j18-impl" artifact="org.apache.logging.log4j:log4j-slf4j2-impl:2.24.3" usage="${spotbugs.lib}"/>
-        <dependency prefix="spotbugs.saxon" artifact="net.sf.saxon:Saxon-HE:12.4" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.log4j-api" artifact="org.apache.logging.log4j:log4j-api:2.25.2" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.25.2" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.log4j-slf4j18-impl" artifact="org.apache.logging.log4j:log4j-slf4j2-impl:2.25.2" usage="${spotbugs.lib}"/>
+        <dependency prefix="spotbugs.saxon" artifact="net.sf.saxon:Saxon-HE:12.9" usage="${spotbugs.lib}"/>
         <dependency prefix="spotbugs.xmlresolver" artifact="org.xmlresolver:xmlresolver:5.2.2" usage="${spotbugs.lib}"/>
 
         <mkdir dir="${basedir}${spotbugs.lib}/config"/>
@@ -2613,6 +2610,7 @@ under the License.
         <downloadfile src="${spotbugs.commons-lang.url}" dest="${spotbugs.commons-lang.jar}"/>
         <downloadfile src="${spotbugs.commons-text.url}" dest="${spotbugs.commons-text.jar}"/>
         <downloadfile src="${spotbugs.commons-codec.url}" dest="${spotbugs.commons-codec.jar}"/>
+        <downloadfile src="${spotbugs.commons-io.url}" dest="${spotbugs.commons-io.jar}"/>
         <downloadfile src="${spotbugs.commons-logging.url}" dest="${spotbugs.commons-logging.jar}"/>
         <downloadfile src="${spotbugs.jcip-annotations.url}" dest="${spotbugs.jcip-annotations.jar}"/>
         <downloadfile src="${spotbugs.jsr305.url}" dest="${spotbugs.jsr305.jar}"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


(poi) 03/04: Newer Mockito prevents using code from org.mockito.internal.matchers

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit cd2229397549611d494042c11ae60305413b72e8
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Sun Nov 16 12:30:39 2025 +0100

    Newer Mockito prevents using code from org.mockito.internal.matchers
    
    At least locally tests fail now for me, so let's get rid of using
    internal code here.
---
 .../org/apache/poi/hwpf/model/TestDocumentProperties.java   |  6 ++++--
 .../org/apache/poi/hwpf/model/TestFileInformationBlock.java | 10 ++++++----
 poi/src/test/java/org/apache/poi/POITestCase.java           | 13 -------------
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java
index 0a33bab46a..716161b7c1 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hwpf.model;
 
-import static org.apache.poi.POITestCase.assertReflectEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 
 import org.apache.poi.hwpf.HWPFDocFixture;
 import org.apache.poi.hwpf.model.types.DOPAbstractType;
@@ -53,6 +53,8 @@ public final class TestDocumentProperties {
         _documentProperties.serialize(buf, 0);
         DocumentProperties newDocProperties = new DocumentProperties(buf, 0, size);
 
-        assertReflectEquals(_documentProperties, newDocProperties);
+        byte[] newBuf = new byte[size];
+        newDocProperties.serialize(newBuf, 0);
+        assertArrayEquals(buf, newBuf);
     }
 }
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java
index b35a8d3c01..dc4899a362 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hwpf.model;
 
-import static org.apache.poi.POITestCase.assertReflectEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import org.apache.poi.hwpf.HWPFDocFixture;
@@ -39,20 +39,22 @@ public final class TestFileInformationBlock {
         FileInformationBlock newFileInformationBlock = new FileInformationBlock(buf);
         FibBase actual = newFileInformationBlock.getFibBase();
 
-        assertReflectEquals(expected, actual);
+        byte[] newBuf = new byte[size];
+        actual.serialize(newBuf, 0);
+        assertArrayEquals(buf, newBuf);
         assertNotNull(_fileInformationBlock.toString());
     }
 
     @BeforeEach
     void setUp() throws Exception {
-        /** @todo verify the constructors */
+        // @todo verify the constructors
         _hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
         _hWPFDocFixture.setUp();
         _fileInformationBlock = _hWPFDocFixture._fib;
     }
 
     @AfterEach
-    void tearDown() throws Exception {
+    void tearDown() {
         _fileInformationBlock = null;
         _hWPFDocFixture.tearDown();
         _hWPFDocFixture = null;
diff --git a/poi/src/test/java/org/apache/poi/POITestCase.java b/poi/src/test/java/org/apache/poi/POITestCase.java
index d4c99bebdb..429ec65705 100644
--- a/poi/src/test/java/org/apache/poi/POITestCase.java
+++ b/poi/src/test/java/org/apache/poi/POITestCase.java
@@ -39,7 +39,6 @@ import javax.imageio.ImageIO;
 
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.SuppressForbidden;
-import org.mockito.internal.matchers.apachecommons.ReflectionEquals;
 
 /**
  * Util class for POI JUnit TestCases, which provide additional features
@@ -129,18 +128,6 @@ public final class POITestCase {
         }
     }
 
-    /**
-     * Utility method to shallow compare all fields of the objects
-     * Only use this method in test cases!!!
-     */
-    public static void assertReflectEquals(final Object expected, Object actual) {
-        // as long as ReflectionEquals is provided by Mockito, use it ... otherwise use commons.lang for the tests
-
-        // JaCoCo Code Coverage adds its own field, don't look at this one here
-        assertTrue(new ReflectionEquals(expected, "$jacocoData").matches(actual));
-    }
-
-
     /**
      * Ensures that the temporary directory is defined and exists and
      * ensures ImageIO uses this directory for cache-files


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org