diff --git a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/KyuubiServerException.scala b/kyuubi-server/src/main/scala/yaooqinn/kyuubi/KyuubiServerException.scala deleted file mode 100644 index 9f359d167..000000000 --- a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/KyuubiServerException.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package yaooqinn.kyuubi - -class KyuubiServerException(message: String, cause: Throwable) extends Exception(message, cause) { - def this(message: String) = this(message, null) - def this(cause: Throwable) = this(null, cause) -} diff --git a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/package.scala b/kyuubi-server/src/main/scala/yaooqinn/kyuubi/package.scala index c1c5b9cf9..2757aad74 100644 --- a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/package.scala +++ b/kyuubi-server/src/main/scala/yaooqinn/kyuubi/package.scala @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -19,6 +19,8 @@ package yaooqinn import java.util.Properties +import yaooqinn.kyuubi.service.ServiceException + package object kyuubi { private object BuildInfo extends Logging { @@ -50,16 +52,16 @@ package object kyuubi { props.getProperty("date", unknown) ) } catch { - case e: Exception => throw new KyuubiServerException(e) + case e: Exception => throw new ServiceException(e) } finally { try { res.close() } catch { - case e: Exception => throw new KyuubiServerException(e) + case e: Exception => throw new ServiceException(e) } } - case _ => throw new KyuubiServerException(s"Could not find $buildFile") + case _ => throw new ServiceException(s"Could not find $buildFile") } } } diff --git a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/server/KyuubiServer.scala b/kyuubi-server/src/main/scala/yaooqinn/kyuubi/server/KyuubiServer.scala index 01b6c2518..c1afae2c3 100644 --- a/kyuubi-server/src/main/scala/yaooqinn/kyuubi/server/KyuubiServer.scala +++ b/kyuubi-server/src/main/scala/yaooqinn/kyuubi/server/KyuubiServer.scala @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,7 +25,7 @@ import org.apache.spark.{KyuubiConf, KyuubiSparkUtil, SparkConf} import yaooqinn.kyuubi._ import yaooqinn.kyuubi.ha.HighAvailabilityUtils -import yaooqinn.kyuubi.service.CompositeService +import yaooqinn.kyuubi.service.{CompositeService, ServiceException} import yaooqinn.kyuubi.utils.HadoopUtils /** @@ -131,12 +131,12 @@ object KyuubiServer extends Logging { private[kyuubi] def validate(): Unit = { if (KyuubiSparkUtil.majorVersion(KyuubiSparkUtil.SPARK_VERSION) < 2) { - throw new KyuubiServerException(s"${KyuubiSparkUtil.SPARK_VERSION} is too old for Kyuubi" + + throw new ServiceException(s"${KyuubiSparkUtil.SPARK_VERSION} is too old for Kyuubi" + s" Server.") } - info(s"Starting Kyuubi Server version ${KYUUBI_VERSION} compiled with Spark version:" + - s" ${SPARK_COMPILE_VERSION}, and run with Spark Version ${KyuubiSparkUtil.SPARK_VERSION}") + info(s"Starting Kyuubi Server version $KYUUBI_VERSION compiled with Spark version:" + + s" $SPARK_COMPILE_VERSION, and run with Spark Version ${KyuubiSparkUtil.SPARK_VERSION}") if (SPARK_COMPILE_VERSION != KyuubiSparkUtil.SPARK_VERSION) { warn(s"Running Kyuubi with Spark ${KyuubiSparkUtil.SPARK_VERSION}, which is compiled by" + s" $SPARK_COMPILE_VERSION. PLEASE be aware of possible incompatibility issues") diff --git a/kyuubi-server/src/test/scala/org/apache/spark/KyuubiSparkUtilSuite.scala b/kyuubi-server/src/test/scala/org/apache/spark/KyuubiSparkUtilSuite.scala index 6028c8b33..bd3e9f7a3 100644 --- a/kyuubi-server/src/test/scala/org/apache/spark/KyuubiSparkUtilSuite.scala +++ b/kyuubi-server/src/test/scala/org/apache/spark/KyuubiSparkUtilSuite.scala @@ -25,7 +25,8 @@ import scala.reflect.internal.util.ScalaClassLoader.URLClassLoader import org.apache.hadoop.security.UserGroupInformation import org.apache.spark.util.SignalUtils -import yaooqinn.kyuubi.{KyuubiServerException, Logging, SPARK_COMPILE_VERSION} +import yaooqinn.kyuubi.{Logging, SPARK_COMPILE_VERSION} +import yaooqinn.kyuubi.service.ServiceException import yaooqinn.kyuubi.utils.ReflectUtils class KyuubiSparkUtilSuite extends SparkFunSuite with Logging { @@ -117,7 +118,7 @@ class KyuubiSparkUtilSuite extends SparkFunSuite with Logging { val e1: Throwable = null assert(KyuubiSparkUtil.exceptionString(e1) === "") val msg = "test exception" - val e2 = new KyuubiServerException(msg, e1) + val e2 = new ServiceException(msg, e1) assert(KyuubiSparkUtil.exceptionString(e2).contains(msg)) } diff --git a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/server/KyuubiServerSuite.scala b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/server/KyuubiServerSuite.scala index b5147d21b..b4247c9e2 100644 --- a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/server/KyuubiServerSuite.scala +++ b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/server/KyuubiServerSuite.scala @@ -25,7 +25,7 @@ import org.apache.hadoop.security.UserGroupInformation import org.apache.spark.{KyuubiSparkUtil, SparkConf, SparkFunSuite} import org.apache.spark.deploy.SparkHadoopUtil -import yaooqinn.kyuubi.KyuubiServerException +import yaooqinn.kyuubi.service.ServiceException import yaooqinn.kyuubi.utils.ReflectUtils class KyuubiServerSuite extends SparkFunSuite { @@ -65,7 +65,7 @@ class KyuubiServerSuite extends SparkFunSuite { val version = "1.6.3" ReflectUtils.setFieldValue(KyuubiSparkUtil, "SPARK_VERSION", version) assert(KyuubiSparkUtil.SPARK_VERSION === version) - val e = intercept[KyuubiServerException](KyuubiServer.validate()) + val e = intercept[ServiceException](KyuubiServer.validate()) assert(e.getMessage.startsWith(version)) ReflectUtils.setFieldValue(KyuubiSparkUtil, "SPARK_VERSION", oldVersion) assert(KyuubiSparkUtil.SPARK_VERSION === oldVersion)