Skip to content

Commit 3bec939

Browse files
authored
[ATK-4416]: update guava version (#3906)
1. update guava version to 32.1.2-jre 2. fix npe warning
1 parent 61c7d47 commit 3bec939

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<dependency>
7979
<groupId>com.google.guava</groupId>
8080
<artifactId>guava</artifactId>
81-
<version>29.0-jre</version>
81+
<version>32.1.2-jre</version>
8282
</dependency>
8383
<dependency>
8484
<groupId>com.alibaba</groupId>

src/main/java/com/actiontech/dble/memory/unsafe/utils/JavaUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.io.File;
2626
import java.io.IOException;
27+
import java.util.Optional;
2728
import java.util.concurrent.TimeUnit;
2829
import java.util.regex.Matcher;
2930
import java.util.regex.Pattern;
@@ -150,7 +151,7 @@ public static long timeStringAs(String str, TimeUnit unit) {
150151
}
151152

152153
// If suffix is valid use that, otherwise none was provided and use the default passed
153-
return unit.convert(val, suffix != null ? TIME_SUFFIXES.get(suffix) : unit);
154+
return unit.convert(val, suffix != null ? Optional.ofNullable(TIME_SUFFIXES.get(suffix)).orElse(unit) : unit);
154155
} catch (NumberFormatException e) {
155156
String timeError = "Time must be specified as seconds (s), " +
156157
"milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). " +
@@ -228,7 +229,7 @@ public static long byteStringAs(String str, ByteUnit unit) {
228229
}
229230

230231
// If suffix is valid use that, otherwise none was provided and use the default passed
231-
return unit.convertFrom(val, suffix != null ? BYTE_SUFFIXES.get(suffix) : unit);
232+
return unit.convertFrom(val, suffix != null ? Optional.ofNullable(BYTE_SUFFIXES.get(suffix)).orElse(unit) : unit);
232233
} else if (fractionMatcher.matches()) {
233234
throw new NumberFormatException("Fractional values are not supported. Input was: " +
234235
fractionMatcher.group(1));

0 commit comments

Comments
 (0)