This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 372afc9 Do not log the actual exception when Arrays.compareUnsigned
is unavailable (#7663)
372afc9 is described below
commit 372afc9ff6ff8407a20e34c12bbff9089950a269
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Fri Oct 29 11:06:30 2021 -0700
Do not log the actual exception when Arrays.compareUnsigned is unavailable
(#7663)
---
.../java/org/apache/pinot/spi/utils/ByteArray.java | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/ByteArray.java
b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/ByteArray.java
index 74a271e..cc031c7 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/ByteArray.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/ByteArray.java
@@ -45,12 +45,9 @@ public class ByteArray implements Comparable<ByteArray>,
Serializable {
MethodHandle compareUnsigned = null;
try {
compareUnsigned = MethodHandles.publicLookup().findStatic(Arrays.class,
"compareUnsigned",
- MethodType.methodType(int.class,
- byte[].class, int.class, int.class,
- byte[].class, int.class, int.class));
- } catch (NoSuchMethodException | IllegalAccessException ignore) {
- LOGGER.warn("Arrays.compareUnsigned unavailable - this may have a
performance impact (are you using JDK8?)",
- ignore);
+ MethodType.methodType(int.class, byte[].class, int.class, int.class,
byte[].class, int.class, int.class));
+ } catch (Exception ignored) {
+ LOGGER.warn("Arrays.compareUnsigned unavailable - this may have a
performance impact (are you using JDK8?)");
}
COMPARE_UNSIGNED = compareUnsigned;
}
@@ -156,12 +153,12 @@ public class ByteArray implements Comparable<ByteArray>,
Serializable {
* @param rightToIndex exclusive index of last byte to compare in right
* @return Result of comparison as stated above.
*/
- public static int compare(byte[] left, int leftFromIndex, int leftToIndex,
- byte[] right, int rightFromIndex, int rightToIndex) {
+ public static int compare(byte[] left, int leftFromIndex, int leftToIndex,
byte[] right, int rightFromIndex,
+ int rightToIndex) {
if (COMPARE_UNSIGNED != null) {
try {
- return (int) COMPARE_UNSIGNED.invokeExact(left, leftFromIndex,
leftToIndex,
- right, rightFromIndex, rightToIndex);
+ return (int) COMPARE_UNSIGNED.invokeExact(left, leftFromIndex,
leftToIndex, right, rightFromIndex,
+ rightToIndex);
} catch (ArrayIndexOutOfBoundsException outOfBounds) {
throw outOfBounds;
} catch (Throwable ignore) {
@@ -170,8 +167,8 @@ public class ByteArray implements Comparable<ByteArray>,
Serializable {
return compareFallback(left, leftFromIndex, leftToIndex, right,
rightFromIndex, rightToIndex);
}
- private static int compareFallback(byte[] left, int leftFromIndex, int
leftToIndex,
- byte[] right, int rightFromIndex, int rightToIndex) {
+ private static int compareFallback(byte[] left, int leftFromIndex, int
leftToIndex, byte[] right, int rightFromIndex,
+ int rightToIndex) {
int len1 = leftToIndex - leftFromIndex;
int len2 = rightToIndex - rightFromIndex;
int lim = Math.min(len1, len2);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]