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 <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to