delete kyuubi server exception

This commit is contained in:
Kent Yao 2018-06-22 14:50:02 +08:00
parent 6676ebfc01
commit d7b0b83c85
5 changed files with 16 additions and 36 deletions

View File

@ -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)
}

View File

@ -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")
}
}
}

View File

@ -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")

View File

@ -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))
}

View File

@ -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)