zhouyifan279 commented on code in PR #3699:
URL: https://github.com/apache/incubator-kyuubi/pull/3699#discussion_r1008792737
##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/util/AuthZUtils.scala:
##########
@@ -46,6 +46,18 @@ private[authz] object AuthZUtils {
def getFieldValOpt[T](o: Any, name: String): Option[T] =
Try(getFieldVal[T](o, name)).toOption
+ def setFieldVal(o: Any, name: String, value: Any): Unit = {
+ Try {
+ val field = o.getClass.getDeclaredField(name)
+ field.setAccessible(true)
+ field.set(o, value)
+ } match {
+ case Success(_) =>
+ case Failure(e) =>
+ throw new RuntimeException(s"Failed to set ${o.getClass} field $name
with value $value", e)
Review Comment:
Added a match case to handle NoSuchFieldException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]