From d8b51500def62842f54e4fc1b012b1e9423e8271 Mon Sep 17 00:00:00 2001 From: Emilio Date: Thu, 10 Oct 2024 11:37:49 -0400 Subject: [PATCH] GEOMESA-3402 CLI - Fix required Hadoop dependency (#3214) --- .../org/locationtech/geomesa/utils/io/PathUtils.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/geomesa-utils-parent/geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/io/PathUtils.scala b/geomesa-utils-parent/geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/io/PathUtils.scala index dd5a9c9e340e..58e11f093822 100644 --- a/geomesa-utils-parent/geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/io/PathUtils.scala +++ b/geomesa-utils-parent/geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/io/PathUtils.scala @@ -28,9 +28,12 @@ object PathUtils extends FileSystemDelegate with LazyLogging { // delegate allows us to avoid a runtime dependency on hadoop private val hadoopDelegate: FileSystemDelegate = - Try(Class.forName("org.locationtech.geomesa.utils.hadoop.HadoopDelegate").newInstance()) - .getOrElse(null) - .asInstanceOf[FileSystemDelegate] + try { + Class.forName("org.locationtech.geomesa.utils.hadoop.HadoopDelegate") + .getDeclaredConstructor().newInstance().asInstanceOf[FileSystemDelegate] + } catch { + case _: Throwable => null + } override def interpretPath(path: String): Seq[FileHandle] = chooseDelegate(path).interpretPath(path)