From 931067ee203dc8c7365f2e63cb5e8f24f1859c80 Mon Sep 17 00:00:00 2001
From: darling <30583600+ge1995@users.noreply.github.com>
Date: Fri, 30 May 2025 15:31:55 +0800
Subject: [PATCH] [ATK-4416]: update guava version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reason:
Improve #.
Type:
Improve
Influences:
1. update guava version to 32.1.2-jre
2. fix npe warning
---
pom.xml | 2 +-
.../com/actiontech/dble/memory/unsafe/utils/JavaUtils.java | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index f5f2abd59c..65bfd04f41 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,7 @@
com.google.guava
guava
- 24.1.1-jre
+ 32.1.2-jre
com.alibaba
diff --git a/src/main/java/com/actiontech/dble/memory/unsafe/utils/JavaUtils.java b/src/main/java/com/actiontech/dble/memory/unsafe/utils/JavaUtils.java
index 5a0205457a..002374de64 100644
--- a/src/main/java/com/actiontech/dble/memory/unsafe/utils/JavaUtils.java
+++ b/src/main/java/com/actiontech/dble/memory/unsafe/utils/JavaUtils.java
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
+import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -150,7 +151,7 @@ public static long timeStringAs(String str, TimeUnit unit) {
}
// If suffix is valid use that, otherwise none was provided and use the default passed
- return unit.convert(val, suffix != null ? TIME_SUFFIXES.get(suffix) : unit);
+ return unit.convert(val, suffix != null ? Optional.ofNullable(TIME_SUFFIXES.get(suffix)).orElse(unit) : unit);
} catch (NumberFormatException e) {
String timeError = "Time must be specified as seconds (s), " +
"milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). " +
@@ -197,7 +198,7 @@ public static long byteStringAs(String str, ByteUnit unit) {
}
// If suffix is valid use that, otherwise none was provided and use the default passed
- return unit.convertFrom(val, suffix != null ? BYTE_SUFFIXES.get(suffix) : unit);
+ return unit.convertFrom(val, suffix != null ? Optional.ofNullable(BYTE_SUFFIXES.get(suffix)).orElse(unit) : unit);
} else if (fractionMatcher.matches()) {
throw new NumberFormatException("Fractional values are not supported. Input was: " +
fractionMatcher.group(1));