You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ya...@apache.org on 2023/10/23 05:15:31 UTC
[kyuubi] 01/01: [AuthZ] Simplify debug message for missing field/methond in ReflectUtils
This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch debug
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
commit 78a66a33c85118e536bfae288a402eb2c68a9e75
Author: Kent Yao <ya...@apache.org>
AuthorDate: Mon Oct 23 13:15:17 2023 +0800
[AuthZ] Simplify debug message for missing field/methond in ReflectUtils
---
.../kyuubi-spark-authz/src/test/resources/log4j2-test.xml | 2 +-
.../org/apache/kyuubi/util/reflect/ReflectUtils.scala | 15 ++-------------
2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/extensions/spark/kyuubi-spark-authz/src/test/resources/log4j2-test.xml b/extensions/spark/kyuubi-spark-authz/src/test/resources/log4j2-test.xml
index 7aaf820ad..709407281 100644
--- a/extensions/spark/kyuubi-spark-authz/src/test/resources/log4j2-test.xml
+++ b/extensions/spark/kyuubi-spark-authz/src/test/resources/log4j2-test.xml
@@ -35,7 +35,7 @@
</File>
</Appenders>
<Loggers>
- <Root level="INFO">
+ <Root level="DEBUG">
<AppenderRef ref="stdout"/>
<AppenderRef ref="file"/>
</Root>
diff --git a/kyuubi-util-scala/src/main/scala/org/apache/kyuubi/util/reflect/ReflectUtils.scala b/kyuubi-util-scala/src/main/scala/org/apache/kyuubi/util/reflect/ReflectUtils.scala
index 08916b8d1..bb7dc91f1 100644
--- a/kyuubi-util-scala/src/main/scala/org/apache/kyuubi/util/reflect/ReflectUtils.scala
+++ b/kyuubi-util-scala/src/main/scala/org/apache/kyuubi/util/reflect/ReflectUtils.scala
@@ -60,11 +60,7 @@ object ReflectUtils {
}
} catch {
case e: Exception =>
- val candidates =
- (clz.getDeclaredFields ++ clz.getFields).map(_.getName).distinct.sorted
- throw new RuntimeException(
- s"Field $fieldName not in $clz [${candidates.mkString(",")}]",
- e)
+ throw new RuntimeException(s"$clz does not have $fieldName field", e)
}
}
@@ -92,15 +88,8 @@ object ReflectUtils {
}
} catch {
case e: Exception =>
- val candidates =
- (clz.getDeclaredMethods ++ clz.getMethods)
- .map(m => s"${m.getName}(${m.getParameterTypes.map(_.getName).mkString(", ")})")
- .distinct.sorted
- val argClassesNames = argClasses.map(_.getName)
throw new RuntimeException(
- s"Method $methodName(${argClassesNames.mkString(", ")})" +
- s" not found in $clz [${candidates.mkString(", ")}]",
- e)
+ s"$clz does not have $methodName method or incorrect arguments", e)
}
}