Skip to content

Commit 129521c

Browse files
yanghuayaooqinn
authored andcommitted
[KYUUBI apache#820] [KYUUBI 817] Fix KyuubiDriverSuite UT failure because of NPE
### _Why are the changes needed?_ See issue apache#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 apache#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 apache#820 from yanghua/KYUUBI-817. Closes apache#820 9464d07 [yanghua] [KYUUBI 817] Fix KyuubiDriverSuite UT failure because of missing kyuubi-version-info.properties Authored-by: yanghua <yanghua1127@gmail.com> Signed-off-by: Kent Yao <yao@apache.org>
1 parent 5b49061 commit 129521c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ package object kyuubi {
2626
private val buildFile = "kyuubi-version-info.properties"
2727
private val buildFileStream =
2828
Thread.currentThread().getContextClassLoader.getResourceAsStream(buildFile)
29+
30+
if (buildFileStream == null) {
31+
throw new KyuubiException(s"Can not load the core build file: $buildFile, if you meet " +
32+
s"this exception when running unit tests " +
33+
s"please make sure you have run the `mvn package` or `mvn generate-resources` command.")
34+
}
35+
2936
private val unknown = "<unknown>"
3037
private val props = new Properties()
3138

0 commit comments

Comments
 (0)