diff --git a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala index 718efc4f3bd5e..2573f9f65c4e6 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala @@ -674,8 +674,16 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) } val action = actionClass.getField("SAFEMODE_GET").get(null) - val method = dfs.getClass().getMethod("setSafeMode", action.getClass()) - method.invoke(dfs, action).asInstanceOf[Boolean] + + try { + val method = dfs.getClass().getMethod("setSafeMode", action.getClass(), + java.lang.Boolean.TYPE) + method.invoke(dfs, action, true: java.lang.Boolean).asInstanceOf[Boolean] + } catch { + case _: NoSuchMethodException => + val method = dfs.getClass().getMethod("setSafeMode", action.getClass()) + method.invoke(dfs, action).asInstanceOf[Boolean] + } } }