Skip to content

Commit

Permalink
[SPARK-46479][CORE] Change Utils.isJavaVersionAtLeast21 to use the …
Browse files Browse the repository at this point in the history
…utility method from `commons-lang3`

### What changes were proposed in this pull request?
Apache commons-lang3 added support for checking `JAVA_21` after version 3.13.0, so this pr change `Utils.isJavaVersionAtLeast21` to use the utility method from commons-lang3.

### Why are the changes needed?
Use commons-lang3 utility method.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass GitHub Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #44444 from LuciferYang/SPARK-46479.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: yangjie01 <yangjie01@baidu.com>
  • Loading branch information
LuciferYang committed Dec 23, 2023
1 parent 0ad2bf6 commit 0c29593
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import com.google.common.io.{ByteStreams, Files => GFiles}
import com.google.common.net.InetAddresses
import org.apache.commons.codec.binary.Hex
import org.apache.commons.io.IOUtils
import org.apache.commons.lang3.SystemUtils
import org.apache.commons.lang3.{JavaVersion, SystemUtils}
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, FileUtil, Path}
import org.apache.hadoop.io.compress.{CompressionCodecFactory, SplittableCompressionCodec}
Expand Down Expand Up @@ -1774,8 +1774,7 @@ private[spark] object Utils
/**
* Whether the underlying Java version is at least 21.
*/
val isJavaVersionAtLeast21 =
System.getProperty("java.version").split("[+.\\-]+", 3)(0).toInt >= 21
val isJavaVersionAtLeast21 = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_21)

/**
* Whether the underlying operating system is Mac OS X and processor is Apple Silicon.
Expand Down

0 comments on commit 0c29593

Please sign in to comment.