Apache Lucene open-source search software
Replace BigInteger allocation in StringHelper.idToString with HexFormat (#15807)
Sagarb45ea62ca00e
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 3cfc437107a..a6209f06ed0 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -273,6 +273,8 @@ Other* GITHUB#15783: Refactor QuantizedVectorsReader to be able to access lucene 104 quantized values through this API.(Ignacio Vera)+* GITHUB#15807: Replace BigInteger allocation in StringHelper.idToString with HexFormat. (Sagar Upadhyaya)+* GITHUB#15799: Exclude JNA Cleaner from thread leak detection by LuceneTestCase. (Alan Woodward)======================= Lucene 10.4.0 =======================diff --git a/lucene/core/src/java/org/apache/lucene/util/StringHelper.java b/lucene/core/src/java/org/apache/lucene/util/StringHelper.javaindex 2b75e2dd662..fc44fbfb9b4 100644--- a/lucene/core/src/java/org/apache/lucene/util/StringHelper.java+++ b/lucene/core/src/java/org/apache/lucene/util/StringHelper.java@@ -21,6 +21,7 @@ import java.math.BigInteger;import java.nio.file.Files;import java.nio.file.Paths;import java.util.Arrays;+import java.util.HexFormat;import java.util.Properties;/**@@ -488,7 +489,7 @@ public abstract class StringHelper {return "(null)";} else {StringBuilder sb = new StringBuilder();- sb.append(new BigInteger(1, id).toString(Character.MAX_RADIX));+ sb.append(HexFormat.of().formatHex(id));if (id.length != ID_LENGTH) {sb.append(" (INVALID FORMAT)");}