From 0c78fdbceac8dcee07308ab2b871a4b4f04a8d6f Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Tue, 19 Sep 2023 21:20:24 +0600 Subject: [PATCH] Fix capitalized method name ToByteArray in RediSearchUtil --- .../redis/clients/jedis/search/RediSearchUtil.java | 10 +++++++++- .../redis/clients/jedis/modules/search/UtilTest.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java index a6a82486b7..d1ffdb61ae 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java @@ -48,12 +48,20 @@ public static Map toStringMap(Map input) { * @param input float array * @return byte array */ - public static byte[] ToByteArray(float[] input) { + public static byte[] toByteArray(float[] input) { byte[] bytes = new byte[Float.BYTES * input.length]; ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asFloatBuffer().put(input); return bytes; } + /** + * @deprecated Use {@link RediSearchUtil#toByteArray(float[])}. + */ + @Deprecated + public static byte[] ToByteArray(float[] input) { + return toByteArray(input); + } + private RediSearchUtil() { throw new InstantiationError("Must not instantiate this class"); } diff --git a/src/test/java/redis/clients/jedis/modules/search/UtilTest.java b/src/test/java/redis/clients/jedis/modules/search/UtilTest.java index d63c934a37..efd9ff4726 100644 --- a/src/test/java/redis/clients/jedis/modules/search/UtilTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/UtilTest.java @@ -9,7 +9,7 @@ public class UtilTest { @Test public void floatArrayToByteArray() { float[] floats = new float[]{0.2f}; - byte[] bytes = RediSearchUtil.ToByteArray(floats); + byte[] bytes = RediSearchUtil.toByteArray(floats); byte[] expected = new byte[]{-51, -52, 76, 62}; Assert.assertArrayEquals(expected, bytes); }