This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 129521c [KYUUBI #820] [KYUUBI 817] Fix KyuubiDriverSuite UT failure
because of NPE
129521c is described below
commit 129521c9a96ca0d449723215ab639d5bf07fe8f4
Author: yanghua <[email protected]>
AuthorDate: Sat Jul 17 11:56:12 2021 +0800
[KYUUBI #820] [KYUUBI 817] Fix KyuubiDriverSuite UT failure because of NPE
### _Why are the changes needed?_
See issue #817 , when we pull the project and do not invoke any build
action, e.g. `mvn package` or `mvn generate-resources`, we would miss the
`kyuubi-version-info.properties` file, it caused the NPE.
As discussed under issue #817 , this PR tries to check it and enhance the
exception message to make it more friendly to newbie developers.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run
test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests)
locally before make a pull request
- [ ] Verified in the local env and no need to add test cases.
Closes #820 from yanghua/KYUUBI-817.
Closes #820
9464d07b [yanghua] [KYUUBI 817] Fix KyuubiDriverSuite UT failure because of
missing kyuubi-version-info.properties
Authored-by: yanghua <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
---
kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
b/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
index 8babf01..5e4233e 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
@@ -26,6 +26,13 @@ package object kyuubi {
private val buildFile = "kyuubi-version-info.properties"
private val buildFileStream =
Thread.currentThread().getContextClassLoader.getResourceAsStream(buildFile)
+
+ if (buildFileStream == null) {
+ throw new KyuubiException(s"Can not load the core build file:
$buildFile, if you meet " +
+ s"this exception when running unit tests " +
+ s"please make sure you have run the `mvn package` or `mvn
generate-resources` command.")
+ }
+
private val unknown = "<unknown>"
private val props = new Properties()