You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/06/24 06:21:23 UTC
[incubator-linkis] 01/03: fix: fix #2314 and format some code
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
commit 45e7c01bcd5bcba992c4861b2498a3b039f6c007
Author: Jack Xu <xu...@126.com>
AuthorDate: Tue Jun 21 18:31:16 2022 +0800
fix: fix #2314 and format some code
---
.gitignore | 5 +-
.../org/apache/linkis/common/ServiceInstance.scala | 15 +--
.../org/apache/linkis/common/utils/LDAPUtils.scala | 6 +-
.../org/apache/linkis/common/utils/Logging.scala | 2 +-
.../apache/linkis/common/utils/RefreshUtils.scala | 4 +-
.../org/apache/linkis/common/utils/Utils.scala | 108 +++++++++++----------
.../apache/linkis/common/utils/VariableUtils.scala | 8 +-
.../linkis/common/utils/ArrayUtilsTest.scala | 1 +
.../linkis/hadoop/common/conf/HadoopConf.scala | 2 +-
.../linkis/hadoop/common/utils/HDFSUtils.scala | 23 ++---
.../AbstractAuthenticationStrategy.scala | 5 +-
.../linkis/httpclient/config/ClientConfig.scala | 26 ++---
.../httpclient/discovery/AbstractDiscovery.scala | 33 +++----
.../linkis/httpclient/request/GetAction.scala | 8 +-
.../linkis/httpclient/request/HttpAction.scala | 8 --
.../linkis/httpclient/request/POSTAction.scala | 7 +-
.../httpclient/response/HashMapHttpResult.scala | 2 +-
.../apache/linkis/DataWorkCloudApplication.java | 1 +
.../org/apache/linkis/proxy/ProxyUserEntity.java | 2 +-
.../apache/linkis/server/utils/AopTargetUtils.java | 3 +-
.../linkis/server/BDPJettyServerHelper.scala | 16 +--
.../scala/org/apache/linkis/server/Message.scala | 45 +++++----
.../conf/DataWorkCloudCustomExcludeFilter.scala | 2 +-
.../linkis/server/conf/ServerConfiguration.scala | 18 ++--
.../scala/org/apache/linkis/server/package.scala | 28 +++---
.../apache/linkis/server/security/SSOUtils.scala | 12 +--
.../linkis/server/security/SecurityFilter.scala | 4 +-
.../linkis/entrance/job/EntranceExecutionJob.java | 17 +++-
.../manager/common/entity/resource/Resource.scala | 4 +-
.../hive/executor/HiveEngineConnExecutor.scala | 6 +-
.../jdbc/src/main/resources/log4j2.xml | 2 +-
.../linkis-configuration/src/test/rpcTest.scala | 2 +-
.../dws/discovery/DefaultConfigDiscovery.scala | 3 +-
33 files changed, 225 insertions(+), 203 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6bbdb3426..a0dae0888 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,4 +26,7 @@ node_modules/
.mvn/wrapper/maven-wrapper.jar
dist/
out/
-target/
\ No newline at end of file
+target/
+
+# log folder
+logs/
\ No newline at end of file
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/ServiceInstance.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/ServiceInstance.scala
index 841ec4b76..311cdeb97 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/ServiceInstance.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/ServiceInstance.scala
@@ -21,10 +21,10 @@ package org.apache.linkis.common
class ServiceInstance {
private var applicationName: String = _
private var instance: String = _
- def setApplicationName(applicationName: String) = this.applicationName = applicationName
- def getApplicationName = applicationName
- def setInstance(instance: String) = this.instance = instance
- def getInstance = instance
+ def setApplicationName(applicationName: String): Unit = this.applicationName = applicationName
+ def getApplicationName: String = applicationName
+ def setInstance(instance: String): Unit = this.instance = instance
+ def getInstance: String = instance
def canEqual(other: Any): Boolean = other.isInstanceOf[ServiceInstance]
@@ -46,7 +46,7 @@ class ServiceInstance {
}
- override def toString = s"ServiceInstance($applicationName, $instance)"
+ override def toString: String = s"ServiceInstance($applicationName, $instance)"
}
object ServiceInstance {
def apply(applicationName: String, instance: String): ServiceInstance = {
@@ -56,6 +56,7 @@ object ServiceInstance {
serviceInstance
}
- def unapply(serviceInstance: ServiceInstance): Option[(String, String)] = if(serviceInstance != null)
- Some(serviceInstance.applicationName, serviceInstance.instance) else None
+ def unapply(serviceInstance: ServiceInstance): Option[(String, String)] = if (serviceInstance != null) {
+ Some(serviceInstance.applicationName, serviceInstance.instance)
+ } else None
}
\ No newline at end of file
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/LDAPUtils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/LDAPUtils.scala
index 39a661c62..c76730262 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/LDAPUtils.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/LDAPUtils.scala
@@ -22,13 +22,11 @@ import java.util.Hashtable
import org.apache.linkis.common.conf.CommonVars
import javax.naming.Context
import javax.naming.ldap.InitialLdapContext
-import org.apache.commons.lang.StringUtils
-
-
+import org.apache.commons.lang3.StringUtils
object LDAPUtils extends Logging {
- val url = CommonVars("wds.linkis.ldap.proxy.url", "").getValue
+ val url = CommonVars("wds.linkis.ldap.proxy.url", "").getValue
val baseDN = CommonVars("wds.linkis.ldap.proxy.baseDN", "").getValue
val userNameFormat = CommonVars("wds.linkis.ldap.proxy.userNameFormat", "").getValue
def login(userID: String, password: String): Unit = {
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Logging.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Logging.scala
index e01e89420..a761df81b 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Logging.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Logging.scala
@@ -24,7 +24,7 @@ trait Logging {
protected lazy implicit val logger = LoggerFactory.getLogger(getClass)
- def trace(message: => String) = {
+ def trace(message: => String): Unit = {
if (logger.isTraceEnabled) {
logger.trace(message)
}
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/RefreshUtils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/RefreshUtils.scala
index f257f8595..0d1e39cbe 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/RefreshUtils.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/RefreshUtils.scala
@@ -29,9 +29,9 @@ object RefreshUtils {
def registerFileRefresh(period: Long, file: String, deal: java.util.List[String] => Unit): Unit = {
Utils.defaultScheduler.scheduleAtFixedRate(new Runnable {
val f = new File(file)
- var fileModifiedTime = if(f.exists()) f.lastModified() else 0
+ var fileModifiedTime = if (f.exists()) f.lastModified() else 0
override def run(): Unit = {
- if(!f.exists()) return
+ if (!f.exists()) return
if(f.lastModified() > fileModifiedTime) {
deal(FileUtils.readLines(f, Configuration.BDP_ENCODING.getValue))
fileModifiedTime = f.lastModified()
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Utils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Utils.scala
index 6e13ef90b..7c073010c 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Utils.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/Utils.scala
@@ -14,18 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.utils
-import java.io.{BufferedReader, InputStreamReader}
-import java.net.InetAddress
-import java.util.concurrent.atomic.AtomicInteger
-import java.util.concurrent.{ScheduledThreadPoolExecutor, _}
+package org.apache.linkis.common.utils
-import org.apache.linkis.common.exception.{ErrorException, FatalException, LinkisCommonErrorException, WarnException}
import org.apache.commons.io.IOUtils
+import org.apache.linkis.common.exception.{ErrorException, FatalException, LinkisCommonErrorException, WarnException}
import org.slf4j.Logger
+import java.io.{BufferedReader, InputStreamReader}
+import java.net.InetAddress
+import java.util.concurrent.atomic.AtomicInteger
+import java.util.concurrent._
import scala.annotation.tailrec
import scala.collection.JavaConversions._
import scala.concurrent.duration.Duration
@@ -54,19 +53,19 @@ object Utils extends Logging {
}
}
- def tryThrow[T](tryOp: => T)(exception: Throwable => Throwable): T = tryCatch(tryOp){
+ def tryThrow[T](tryOp: => T)(exception: Throwable => Throwable): T = tryCatch(tryOp) {
t: Throwable => throw exception(t)
}
def tryFinally[T](tryOp: => T)(finallyOp: => Unit): T = try tryOp finally finallyOp
- def tryQuietly[T](tryOp: => T, catchOp: Throwable => Unit): T = tryCatch(tryOp){
+ def tryQuietly[T](tryOp: => T, catchOp: Throwable => Unit): T = tryCatch(tryOp) {
t =>
catchOp(t)
null.asInstanceOf[T]
}
- def tryAndWarn[T](tryOp: => T)(implicit log: Logger): T = tryCatch(tryOp){
+ def tryAndWarn[T](tryOp: => T)(implicit log: Logger): T = tryCatch(tryOp) {
case error: ErrorException =>
val errorMsg = s"error code(错误码): ${error.getErrCode}, Error message(错误信息): ${error.getDesc}."
log.error(errorMsg, error)
@@ -80,7 +79,7 @@ object Utils extends Logging {
null.asInstanceOf[T]
}
- def tryAndWarnMsg[T](tryOp: => T)(message: String)(implicit log: Logger): T = tryCatch(tryOp){
+ def tryAndWarnMsg[T](tryOp: => T)(message: String)(implicit log: Logger): T = tryCatch(tryOp) {
case error: ErrorException =>
log.warn(s"error code(错误码): ${error.getErrCode}, Error message(错误信息): ${error.getDesc}.")
log.warn(message, error)
@@ -94,7 +93,7 @@ object Utils extends Logging {
null.asInstanceOf[T]
}
- def tryAndError[T](tryOp: => T)(implicit log: Logger): T = tryCatch(tryOp){
+ def tryAndError[T](tryOp: => T)(implicit log: Logger): T = tryCatch(tryOp) {
case error: ErrorException =>
val errorMsg = s"error code(错误码): ${error.getErrCode}, Error message(错误信息): ${error.getDesc}."
log.error(errorMsg, error)
@@ -108,7 +107,7 @@ object Utils extends Logging {
null.asInstanceOf[T]
}
- def tryAndErrorMsg[T](tryOp: => T)(message: String)(implicit log: Logger): T = tryCatch(tryOp){
+ def tryAndErrorMsg[T](tryOp: => T)(message: String)(implicit log: Logger): T = tryCatch(tryOp) {
case error: ErrorException =>
log.error(s"error code(错误码): ${error.getErrCode}, Error message(错误信息): ${error.getDesc}.")
log.error(message, error)
@@ -121,12 +120,13 @@ object Utils extends Logging {
log.error(message, t)
null.asInstanceOf[T]
}
-
+
def sleepQuietly(mills: Long): Unit = tryQuietly(Thread.sleep(mills))
def threadFactory(threadName: String, isDaemon: Boolean = true): ThreadFactory = {
new ThreadFactory {
val num = new AtomicInteger(0)
+
override def newThread(r: Runnable): Thread = {
val t = new Thread(r)
t.setDaemon(isDaemon)
@@ -167,19 +167,21 @@ object Utils extends Logging {
def getComputerName: String = Utils.tryCatch(InetAddress.getLocalHost.getCanonicalHostName)(t => sys.env("COMPUTERNAME"))
/**
- * Checks if event has occurred during some time period. This performs an exponential backoff
- * to limit the poll calls.
- *
- * @param checkForEvent event to check, until it is true
- * @param atMost most wait time
- * @throws java.util.concurrent.TimeoutException throws this exception when it is timeout
- * @throws java.lang.InterruptedException throws this exception when it is interrupted
- * @return
- */
+ * Checks if event has occurred during some time period. This performs an exponential backoff
+ * to limit the poll calls.
+ *
+ * @param checkForEvent event to check, until it is true
+ * @param atMost most wait time
+ * @throws java.util.concurrent.TimeoutException throws this exception when it is timeout
+ * @throws java.lang.InterruptedException throws this exception when it is interrupted
+ * @return
+ */
@throws(classOf[TimeoutException])
@throws(classOf[InterruptedException])
final def waitUntil(checkForEvent: () => Boolean, atMost: Duration, radix: Int, maxPeriod: Long): Unit = {
- val endTime = try System.currentTimeMillis() + atMost.toMillis catch { case _: IllegalArgumentException => 0l }
+ val endTime = try System.currentTimeMillis() + atMost.toMillis catch {
+ case _: IllegalArgumentException => 0L
+ }
@tailrec
def aux(count: Int): Unit = {
@@ -202,67 +204,75 @@ object Utils extends Logging {
final def waitUntil(checkForEvent: () => Boolean, atMost: Duration): Unit = waitUntil(checkForEvent, atMost, 100, 2000)
/**
- * do not exec complex shell command with lots of output, may cause io blocking
- * @param commandLine shell command
- * @return
- */
+ * do not exec complex shell command with lots of output, may cause io blocking
+ *
+ * @param commandLine shell command
+ * @return
+ */
def exec(commandLine: Array[String]): String = exec(commandLine, -1)
/**
- * do not exec complex shell command with lots of output, may cause io blocking
- * @param commandLine shell command
- * @return
- */
+ * do not exec complex shell command with lots of output, may cause io blocking
+ *
+ * @param commandLine shell command
+ * @return
+ */
def exec(commandLine: List[String]): String = exec(commandLine, -1)
/**
- * do not exec complex shell command with lots of output, may cause io blocking
- * @param commandLine shell command
- * @param maxWaitTime max wait time
- * @return
- */
+ * do not exec complex shell command with lots of output, may cause io blocking
+ *
+ * @param commandLine shell command
+ * @param maxWaitTime max wait time
+ * @return
+ */
def exec(commandLine: Array[String], maxWaitTime: Long): String = exec(commandLine.toList, maxWaitTime)
/**
- * do not exec complex shell command with lots of output, may cause io blocking
- * @param commandLine shell command
- * @param maxWaitTime max wait time
- * @return
- */
+ * do not exec complex shell command with lots of output, may cause io blocking
+ *
+ * @param commandLine shell command
+ * @param maxWaitTime max wait time
+ * @return
+ */
def exec(commandLine: List[String], maxWaitTime: Long): String = {
val pb = new ProcessBuilder(commandLine)
pb.redirectErrorStream(true)
pb.redirectInput(ProcessBuilder.Redirect.PIPE)
val process = pb.start
val log = new BufferedReader(new InputStreamReader(process.getInputStream))
- val exitCode = if(maxWaitTime > 0) {
+ val exitCode = if (maxWaitTime > 0) {
val completed = process.waitFor(maxWaitTime, TimeUnit.MILLISECONDS)
- if(!completed) {
+ if (!completed) {
IOUtils.closeQuietly(log)
process.destroy()
throw new TimeoutException(s"exec timeout with ${ByteTimeUtils.msDurationToString(maxWaitTime)}!")
}
process.exitValue
- } else
- tryThrow(process.waitFor)(t => {process.destroy();IOUtils.closeQuietly(log);t})
+ } else {
+ tryThrow(process.waitFor)(t => {
+ process.destroy(); IOUtils.closeQuietly(log); t
+ })
+ }
val lines = log.lines().toArray
IOUtils.closeQuietly(log)
if (exitCode != 0) {
throw new LinkisCommonErrorException(0, s"exec failed with exit code: $exitCode, ${lines.mkString(". ")}")
}
- lines.mkString("\n")
+ lines.mkString("\n")
}
def addShutdownHook(hook: => Unit): Unit = ShutdownUtils.addShutdownHook(hook)
- def getClassInstance[T](className: String): T ={
+ def getClassInstance[T](className: String): T = {
Utils.tryThrow(
- Thread.currentThread.getContextClassLoader.loadClass(className).asInstanceOf[Class[T]].newInstance()) (t =>{
+ Thread.currentThread.getContextClassLoader.loadClass(className).asInstanceOf[Class[T]].newInstance())(t => {
error(s"Failed to instance: $className ", t)
throw t
})
}
+ @deprecated("use ByteTimeUtils.msDurationToString method")
def msDurationToString(ms: Long): String = {
val second = 1000
val minute = 60 * second
diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/VariableUtils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/VariableUtils.scala
index f57637c24..926ecc796 100644
--- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/VariableUtils.scala
+++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/utils/VariableUtils.scala
@@ -222,7 +222,7 @@ object VariableUtils extends Logging {
var expression = name.trim
val varType = nameAndType.get(name.trim).orNull
if (varType == null) {
- logger.warn(s"Use undefined variables or use the set method: [$str](使用了未定义的变量或者使用了set方式:[$str])")
+ warn(s"Use undefined variables or use the set method: [$str](使用了未定义的变量或者使用了set方式:[$str])")
parseCode ++= codes(i - 1) ++ str
} else {
var res: String = varType.getValue
@@ -241,7 +241,7 @@ object VariableUtils extends Logging {
}
}
if (!expressionCache.contains(expression)) {
- logger.info(s"Variable expression [$str] = $res(变量表达式[$str] = $res)")
+ info(s"Variable expression [$str] = $res(变量表达式[$str] = $res)")
expressionCache += expression
}
parseCode ++= codes(i - 1) ++ res
@@ -302,13 +302,11 @@ object VariableUtils extends Logging {
}
}
case errRegex() =>
- logger.warn(s"The variable definition is incorrect:$str,if it is not used, it will not run the error, but it is recommended to use the correct specification to define")
+ warn(s"The variable definition is incorrect:$str,if it is not used, it will not run the error, but it is recommended to use the correct specification to define")
case _ =>
}
}
}
nameAndValue
}
-
-
}
diff --git a/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/utils/ArrayUtilsTest.scala b/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/utils/ArrayUtilsTest.scala
index 4fc3069d2..c2e69c3af 100644
--- a/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/utils/ArrayUtilsTest.scala
+++ b/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/utils/ArrayUtilsTest.scala
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Assertions._
import org.junit.jupiter.api.Test
class ArrayUtilsTest {
+
@Test private[utils] def testCopyArray() = {
val array = ArrayUtils.newArray[scala.Int](2, Array.emptyIntArray.getClass)
array(0) = 123
diff --git a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala
index 40ffb9eaf..ed8538bb2 100644
--- a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala
+++ b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala
@@ -44,5 +44,5 @@ object HadoopConf {
val HDFS_ENABLE_CACHE_IDLE_TIME = CommonVars("wds.linkis.hadoop.hdfs.cache.idle.time", 3*60*1000).getValue
- val HDFS_ENABLE_CACHE_MAX_TIME = CommonVars("wds.linkis.hadoop.hdfs.cache.max.time", new TimeType("12h")).getValue.toLong
+ val HDFS_ENABLE_CACHE_MAX_TIME = CommonVars("wds.linkis.hadoop.hdfs.cache.max.time", new TimeType("12h")).getValue.toLong
}
diff --git a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala
index 0fa2f2f27..bd75919e2 100644
--- a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala
+++ b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala
@@ -17,21 +17,20 @@
package org.apache.linkis.hadoop.common.utils
-import java.io.File
-import java.nio.file.Paths
-import java.security.PrivilegedExceptionAction
-import java.util.concurrent.{ConcurrentHashMap, TimeUnit}
-
-import org.apache.linkis.common.utils.{Logging, Utils}
-import org.apache.linkis.hadoop.common.conf.HadoopConf
-import org.apache.linkis.hadoop.common.conf.HadoopConf.{hadoopConfDir, _}
-import org.apache.linkis.hadoop.common.entity.HDFSFileSystemContainer
import org.apache.commons.io.IOUtils
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, Path}
import org.apache.hadoop.security.UserGroupInformation
+import org.apache.linkis.common.utils.{Logging, Utils}
+import org.apache.linkis.hadoop.common.conf.HadoopConf
+import org.apache.linkis.hadoop.common.conf.HadoopConf._
+import org.apache.linkis.hadoop.common.entity.HDFSFileSystemContainer
+import java.io.File
+import java.nio.file.Paths
+import java.security.PrivilegedExceptionAction
+import java.util.concurrent.TimeUnit
import scala.collection.JavaConverters._
object HDFSUtils extends Logging {
@@ -119,7 +118,9 @@ object HDFSUtils extends Logging {
def createFileSystem(userName: String, conf: org.apache.hadoop.conf.Configuration): FileSystem =
getUserGroupInformation(userName)
.doAs(new PrivilegedExceptionAction[FileSystem] {
- def run = FileSystem.get(conf)
+ // scalastyle:off FileSystemGet
+ def run: FileSystem = FileSystem.get(conf)
+ // scalastyle:on FileSystemGet
})
def closeHDFSFIleSystem(fileSystem: FileSystem, userName: String): Unit = if (null != fileSystem && StringUtils.isNotBlank(userName)) {
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/authentication/AbstractAuthenticationStrategy.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/authentication/AbstractAuthenticationStrategy.scala
index b7e9082ec..a5abc7a13 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/authentication/AbstractAuthenticationStrategy.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/authentication/AbstractAuthenticationStrategy.scala
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap
import org.apache.linkis.httpclient.Client
import org.apache.linkis.httpclient.config.ClientConfig
import org.apache.linkis.httpclient.request.{Action, UserAction}
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
import org.apache.linkis.common.utils.Logging
@@ -41,8 +41,7 @@ abstract class AbstractAuthenticationStrategy extends AuthenticationStrategy wit
protected def getUser(requestAction: Action): String = requestAction match {
case _: AuthenticationAction => null
case authAction: UserAction => authAction.getUser
- case _ if StringUtils.isNotBlank(clientConfig.getAuthTokenKey) => clientConfig.getAuthTokenKey
- case _ => null
+ case _ => if (StringUtils.isNotBlank(clientConfig.getAuthTokenKey)) clientConfig.getAuthTokenKey else null
}
protected def getKey(requestAction: Action, serverUrl: String): String = {
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfig.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfig.scala
index f117d1bb1..2e8540fb0 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfig.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfig.scala
@@ -17,7 +17,7 @@
package org.apache.linkis.httpclient.config
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.linkis.common.utils.RetryHandler
import org.apache.linkis.httpclient.authentication.{AbstractAuthenticationStrategy, AuthenticationStrategy}
import org.apache.linkis.httpclient.loadbalancer.LoadBalancerStrategy
@@ -69,7 +69,7 @@ class ClientConfig private() {
}
}
- def getServerUrl = serverUrl
+ def getServerUrl: String = serverUrl
def getDefaultServerUrl: String = {
if (StringUtils.isNotBlank(serverUrl) && serverUrl.contains(HttpClientConstant.URL_SPLIT_TOKEN)) {
@@ -79,30 +79,30 @@ class ClientConfig private() {
}
}
- def isDiscoveryEnabled = discoveryEnabled
+ def isDiscoveryEnabled: Boolean = discoveryEnabled
- def getDiscoveryPeriod = discoveryPeriod
+ def getDiscoveryPeriod: Long = discoveryPeriod
- def getDiscoveryTimeUnit = discoveryTimeUnit
+ def getDiscoveryTimeUnit: TimeUnit = discoveryTimeUnit
- def isLoadbalancerEnabled = loadbalancerEnabled
+ def isLoadbalancerEnabled: Boolean = loadbalancerEnabled
- def getLoadbalancerStrategy = loadbalancerStrategy
+ def getLoadbalancerStrategy: LoadBalancerStrategy = loadbalancerStrategy
- def getAuthenticationStrategy = authenticationStrategy
+ def getAuthenticationStrategy: AuthenticationStrategy = authenticationStrategy
def getAuthTokenKey: String = authTokenKey
def getAuthTokenValue: String = authTokenValue
- def getConnectTimeout = connectTimeout
+ def getConnectTimeout: Long = connectTimeout
- def getReadTimeout = readTimeout
+ def getReadTimeout: Long = readTimeout
- def getMaxConnection = maxConnection
+ def getMaxConnection: Int = maxConnection
- def isRetryEnabled = retryEnabled
+ def isRetryEnabled: Boolean = retryEnabled
- def getRetryHandler = retryHandler
+ def getRetryHandler: RetryHandler = retryHandler
}
\ No newline at end of file
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/discovery/AbstractDiscovery.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/discovery/AbstractDiscovery.scala
index 19a32156e..414e72789 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/discovery/AbstractDiscovery.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/discovery/AbstractDiscovery.scala
@@ -21,15 +21,14 @@ import java.io.Closeable
import java.net.ConnectException
import java.util
import java.util.concurrent.ScheduledFuture
-
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.httpclient.Client
import org.apache.linkis.httpclient.exception.DiscoveryException
import org.apache.http.HttpResponse
import org.apache.linkis.httpclient.config.HttpClientConstant
-import scala.collection.JavaConversions._
+import scala.collection.JavaConverters._
import scala.concurrent.duration.TimeUnit
@@ -64,19 +63,19 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
def getClient: Client = client
override def start(): Unit = {
- val delayTime = timeUnit.convert(timeUnit.toMillis(period) / 5, timeUnit)
+ val delayTime = if (period < 10) 1 else period / 5
discoveryFuture = startDiscovery()
heartbeatFuture = startHealthyCheck(delayTime)
unhealthyHeartbeatFuture = startUnHealthyCheck(delayTime)
}
def startHealthyCheck(delayTime: Long): ScheduledFuture[_] = {
- logger.info("start HealthyCheck thread")
+ info("start HealthyCheck thread")
Utils.defaultScheduler.scheduleAtFixedRate(new Runnable {
override def run(): Unit = {
- serverInstances.toList.foreach { serverUrl =>
+ serverInstances.asScala.foreach { serverUrl =>
val action = getHeartbeatAction(serverUrl)
- logger.info("heartbeat to healthy gateway " + serverUrl)
+ info("heartbeat to healthy gateway " + serverUrl)
Utils.tryCatch(client.execute(action, 3000) match {
case heartbeat: HeartbeatResult =>
if (!heartbeat.isHealthy) {
@@ -92,15 +91,15 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
}
def startDiscovery(): ScheduledFuture[_] = {
- logger.info("start Discovery thread")
+ info("start Discovery thread")
client.execute(getHeartbeatAction(serverUrl), 3000) match {
case heartbeat: HeartbeatResult => if (!heartbeat.isHealthy) throw new DiscoveryException(s"connect to serverUrl $serverUrl failed! Reason: gateway server is unhealthy!")
- else discoveryListeners.foreach(_.onServerDiscovered(serverUrl))
+ else discoveryListeners.asScala.foreach(_.onServerDiscovered(serverUrl))
}
Utils.defaultScheduler.scheduleAtFixedRate(new Runnable {
override def run(): Unit = Utils.tryAndWarn {
- logger.info("to discovery gateway" + serverUrl)
+ info("to discovery gateway" + serverUrl)
val serverUrls = discovery()
addServerInstances(serverUrls)
}
@@ -111,21 +110,21 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
logger.info("start UnHealthyCheck thread")
Utils.defaultScheduler.scheduleAtFixedRate(new Runnable {
override def run(): Unit = {
- unhealthyServerInstances.toList.foreach { serverUrl =>
+ unhealthyServerInstances.asScala.foreach { serverUrl =>
val action = getHeartbeatAction(serverUrl)
logger.info("heartbeat to unhealthy gateway " + serverUrl)
Utils.tryCatch(client.execute(action, 3000) match {
case heartbeat: HeartbeatResult =>
if (heartbeat.isHealthy) {
unhealthyServerInstances synchronized unhealthyServerInstances.remove(serverUrl)
- discoveryListeners.foreach(_.onServerHealthy(serverUrl))
+ discoveryListeners.asScala.foreach(_.onServerHealthy(serverUrl))
serverInstances synchronized serverInstances.add(serverUrl)
} else if (serverInstances.contains(serverUrl)) serverInstances synchronized serverInstances.remove(serverUrl)
}) {
case _: ConnectException =>
unhealthyServerInstances synchronized unhealthyServerInstances.remove(serverUrl)
serverInstances synchronized serverInstances.remove(serverUrl)
- discoveryListeners.foreach(_.onServerUnconnected(serverUrl))
+ discoveryListeners.asScala.foreach(_.onServerUnconnected(serverUrl))
}
}
}
@@ -150,7 +149,7 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
}
def addUnhealthyServerInstances(unhealthyUrl: String): Unit = {
- logger.info(s"add ${unhealthyUrl} to unhealthy list ")
+ info(s"add ${unhealthyUrl} to unhealthy list ")
val updateUnhealthyUrl = if (serverInstances.contains(unhealthyUrl)) {
unhealthyUrl
} else if (serverInstances.contains(unhealthyUrl + HttpClientConstant.PATH_SPLIT_TOKEN)) {
@@ -159,10 +158,10 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
""
}
if (StringUtils.isBlank(updateUnhealthyUrl)) {
- logger.info(s"${unhealthyUrl} unhealthy url not exists")
+ info(s"${unhealthyUrl} unhealthy url not exists")
} else {
unhealthyServerInstances synchronized unhealthyServerInstances.add(updateUnhealthyUrl)
- discoveryListeners.foreach(_.onServerUnhealthy(updateUnhealthyUrl))
+ discoveryListeners.asScala.foreach(_.onServerUnhealthy(updateUnhealthyUrl))
serverInstances synchronized serverInstances.remove(updateUnhealthyUrl)
}
}
@@ -173,7 +172,7 @@ abstract class AbstractDiscovery extends Discovery with Closeable with Logging {
val parsedUrl = if (url.endsWith(HttpClientConstant.PATH_SPLIT_TOKEN)) url.substring(0, url.length - 1)
else url
serverInstances.add(parsedUrl)
- discoveryListeners.foreach(_.onServerDiscovered(parsedUrl))
+ discoveryListeners.asScala.foreach(_.onServerDiscovered(parsedUrl))
}
}
}
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
index 231dd2599..58e160e9f 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/GetAction.scala
@@ -19,19 +19,21 @@ package org.apache.linkis.httpclient.request
import java.net.URLEncoder
import java.util
-
import org.apache.linkis.common.conf.Configuration
-import scala.collection.JavaConversions
+import scala.collection.JavaConverters._
abstract class GetAction extends HttpAction {
private val queryParams: util.Map[String, Any] = new util.HashMap[String, Any]
+
def setParameter(key: String, value: Any): Unit = this.queryParams.put(key, value)
+
def getParameters: util.Map[String, Any] = queryParams
+
override def getRequestBody: String = {
val queryString = new StringBuilder
- JavaConversions.mapAsScalaMap(queryParams).foreach { case (k, v) =>
+ queryParams.asScala.foreach { case (k, v) =>
queryString.append(URLEncoder.encode(k, Configuration.BDP_ENCODING.getValue)).append("=")
.append(URLEncoder.encode(v.toString, Configuration.BDP_ENCODING.getValue)).append("&")
}
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/HttpAction.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/HttpAction.scala
index 07ed91aef..4678420fb 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/HttpAction.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/HttpAction.scala
@@ -34,14 +34,6 @@ trait HttpAction extends Action {
def getCookies: Array[Cookie] = cookies.toArray(new Array[Cookie](cookies.size()))
- /*def addCookie(cookie: javax.servlet.http.Cookie): Unit = {
- val newCookie: BasicClientCookie = new BasicClientCookie(cookie.getName, cookie.getValue)
- newCookie.setDomain(cookie.getDomain)
- newCookie.setPath(cookie.getPath)
- newCookie.setSecure(true)
- cookies.add(newCookie)
- }*/
-
def addCookie(cookie: Cookie): Unit = cookies.add(cookie)
def getURL: String
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/POSTAction.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/POSTAction.scala
index 84064a5da..32dc4dda4 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/POSTAction.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/request/POSTAction.scala
@@ -21,14 +21,15 @@ import java.util
abstract class POSTAction extends GetAction {
+
private val formParams: util.Map[String, String] = new util.HashMap[String, String]
private val payload: util.Map[String, Any] = new util.HashMap[String, Any]
- def setFormParam(key: String, value: Any): Unit = if(value != null) this.formParams.put(key, value.toString)
+ def setFormParam(key: String, value: Any): Unit = if (value != null) this.formParams.put(key, value.toString)
def getFormParams: util.Map[String, String] = formParams
- def addRequestPayload(key: String, value: Any): Unit = if(value != null) this.payload.put(key, value)
- def getRequestPayloads = payload
+ def addRequestPayload(key: String, value: Any): Unit = if (value != null) this.payload.put(key, value)
+ def getRequestPayloads: util.Map[String, Any] = payload
def getRequestPayload: String
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/response/HashMapHttpResult.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/response/HashMapHttpResult.scala
index 2b6492b86..f1fad7f05 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/response/HashMapHttpResult.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/response/HashMapHttpResult.scala
@@ -40,7 +40,7 @@ class HashMapHttpResult extends HttpResult {
def getResultMap: util.Map[String, Object] = resultMap
override def set(responseBody: String, statusCode: Int, url: String, contentType: String): Unit = {
- if(statusCode != 200) throw new HttpClientResultException(s"URL $url request failed! ResponseBody is $responseBody." )
+ if (statusCode != 200) throw new HttpClientResultException(s"URL $url request failed! ResponseBody is $responseBody." )
resultMap = JsonUtils.jackson.readValue(responseBody, classOf[util.Map[String, Object]])
this.responseBody = responseBody
this.statusCode = statusCode
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
index 43847cb9c..b6cf4263a 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
@@ -103,6 +103,7 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
});
application.addListeners(
new ApplicationListener<RefreshScopeRefreshedEvent>() {
+ @Override
public void onApplicationEvent(RefreshScopeRefreshedEvent applicationEvent) {
logger.info("refresh config from config server...");
updateRemoteConfig();
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/proxy/ProxyUserEntity.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/proxy/ProxyUserEntity.java
index a4e0a50f7..93296c13f 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/proxy/ProxyUserEntity.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/proxy/ProxyUserEntity.java
@@ -17,7 +17,7 @@
package org.apache.linkis.proxy;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
public class ProxyUserEntity {
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
index e3a8e5c6d..d6f50737c 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
@@ -35,7 +35,8 @@ public class AopTargetUtils {
public static Object getTarget(Object proxy) throws Exception {
if (!AopUtils.isAopProxy(proxy)) {
- return proxy; // Not a proxy object(不是代理对象)
+ // Not a proxy object(不是代理对象)
+ return proxy;
}
if (AopUtils.isJdkDynamicProxy(proxy)) {
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/BDPJettyServerHelper.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/BDPJettyServerHelper.scala
index 725de15c6..1fbec4745 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/BDPJettyServerHelper.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/BDPJettyServerHelper.scala
@@ -60,7 +60,7 @@ private[linkis] object BDPJettyServerHelper extends Logging {
}
def addServerEventService(serverEventService: ServerEventService): Unit = {
- if(serverListenerEventBus != null) serverListenerEventBus.addListener(serverEventService)
+ if (serverListenerEventBus != null) serverListenerEventBus.addListener(serverEventService)
else services += serverEventService
}
@@ -84,8 +84,8 @@ private[linkis] object BDPJettyServerHelper extends Logging {
servletHolder.getRegistration.setMultipartConfig(multipartConfigElement)
val p = BDP_SERVER_RESTFUL_URI.getValue
- val restfulPath = if(p.endsWith("/*")) p
- else if(p.endsWith("/")) p + "*"
+ val restfulPath = if (p.endsWith("/*")) p
+ else if (p.endsWith("/")) p + "*"
else p + "/*"
webApp.addServlet(servletHolder, restfulPath)
@@ -95,17 +95,17 @@ private[linkis] object BDPJettyServerHelper extends Logging {
}
def setupControllerServer(webApp: ServletContextHandler): ControllerServer = {
- if(controllerServer != null) return controllerServer
+ if (controllerServer != null) return controllerServer
synchronized {
- if(controllerServer != null) return controllerServer
+ if (controllerServer != null) return controllerServer
createServerListenerEventBus()
controllerServer = new ControllerServer(serverListenerEventBus)
val maxTextMessageSize = BDP_SERVER_SOCKET_TEXT_MESSAGE_SIZE_MAX.getValue
val servletHolder = new ServletHolder(controllerServer)
servletHolder.setInitParameter("maxTextMessageSize", maxTextMessageSize)
val p = BDP_SERVER_SOCKET_URI.getValue
- val socketPath = if(p.endsWith("/*")) p
- else if(p.endsWith("/")) p + "*"
+ val socketPath = if (p.endsWith("/*")) p
+ else if (p.endsWith("/")) p + "*"
else p + "/*"
webApp.addServlet(servletHolder, socketPath)
controllerServer
@@ -144,7 +144,7 @@ private[linkis] object BDPJettyServerHelper extends Logging {
implicit val gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").serializeNulls
.registerTypeAdapter(classOf[java.lang.Double], new JsonSerializer[java.lang.Double] {
override def serialize(t: lang.Double, `type`: Type, jsonSerializationContext: JsonSerializationContext): JsonElement =
- if(t == t.longValue()) new JsonPrimitive(t.longValue()) else new JsonPrimitive(t)
+ if (t == t.longValue()) new JsonPrimitive(t.longValue()) else new JsonPrimitive(t)
}).create
implicit val jacksonJson = new ObjectMapper().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"))
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/Message.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/Message.scala
index 5ea0d4ae5..c1f8686af 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/Message.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/Message.scala
@@ -18,11 +18,11 @@
package org.apache.linkis.server
import java.util
-
import javax.servlet.http.HttpServletRequest
-import org.apache.commons.lang.StringUtils
-import org.apache.commons.lang.exception.ExceptionUtils
-import org.slf4j.LoggerFactory
+import org.apache.commons.lang3.StringUtils
+import org.apache.commons.lang3.exception.ExceptionUtils
+import org.apache.linkis.common.utils.Logging
+
import org.springframework.web.context.request.{RequestContextHolder, ServletRequestAttributes}
@@ -47,40 +47,39 @@ class Message(private var method: String,
this.method = method
this
}
- def setMessage(message: String) = {
+ def setMessage(message: String): Message = {
this.message = message
this
}
- def getMessage = message
+ def getMessage: String = message
def setMethod(method: String): Unit = this.method = method
- def getMethod = method
+ def getMethod: String = method
def setStatus(status: Int): Unit = this.status = status
- def getStatus = status
+ def getStatus: Int = status
def setData(data: util.HashMap[String, Object]): Unit = this.data = data
- def getData = data
+ def getData: util.HashMap[String, Object] = data
// def isSuccess = status == 0
// def isError = status != 0
- override def toString = s"Message($getMethod, $getStatus, $getData)"
+ override def toString: String = s"Message($getMethod, $getStatus, $getData)"
}
-object Message {
- private val logger = LoggerFactory.getLogger(getClass)
+object Message extends Logging {
def apply(method: String = null, status: Int = 0, message: String = null,
data: util.HashMap[String, Object] = new util.HashMap[String, Object]): Message = {
if (StringUtils.isEmpty(method)) {
Thread.currentThread().getStackTrace.find(_.getClassName.toLowerCase.endsWith("restfulapi")).foreach {
stack => {
- val httpRequest:HttpServletRequest=getCurrentHttpRequest
- if(httpRequest!=null){
- val pathInfo=httpRequest.getPathInfo;
- if(pathInfo!=null) {
- val method = if (pathInfo.startsWith("/")) "/api"+ pathInfo else "/api" + "/" + pathInfo
+ val httpRequest: HttpServletRequest = getCurrentHttpRequest
+ if (httpRequest!=null) {
+ val pathInfo = httpRequest.getPathInfo;
+ if (pathInfo!=null) {
+ val method = if (pathInfo.startsWith("/")) "/api" + pathInfo else "/api/" + pathInfo
return new Message(method, status, message, data)
- }else{
- logger.warn("get HttpServletRequest pathInfo is null,please check it!")
+ } else {
+ warn("get HttpServletRequest pathInfo is null,please check it!")
}
}
}
@@ -95,13 +94,13 @@ object Message {
}
def error(msg: String): Message = error(msg, null)
implicit def error(t: Throwable): Message = {
- Message(status = 1).setMessage(ExceptionUtils.getRootCauseMessage(t)) << ("stack", ExceptionUtils.getFullStackTrace(t))
+ Message(status = 1).setMessage(ExceptionUtils.getRootCauseMessage(t)) << ("stack", ExceptionUtils.getStackTrace(t))
}
implicit def error(e: (String, Throwable)): Message = error(e._1, e._2)
implicit def error(msg: String, t: Throwable): Message = {
- val message = Message(status = 1)
+ val message = Message(status = 1)
message.setMessage(msg)
- if(t != null) message << ("stack", ExceptionUtils.getFullStackTrace(t))
+ if(t != null) message << ("stack", ExceptionUtils.getStackTrace(t))
message
}
implicit def warn(msg: String): Message = {
@@ -124,7 +123,7 @@ object Message {
def noLogin(msg: String, t: Throwable): Message = {
val message = Message(status = -1)
message.setMessage(msg)
- if(t != null) message << ("stack", ExceptionUtils.getFullStackTrace(t))
+ if(t != null) message << ("stack", ExceptionUtils.getStackTrace(t))
message
}
def noLogin(msg: String): Message = noLogin(msg, null)
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/DataWorkCloudCustomExcludeFilter.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/DataWorkCloudCustomExcludeFilter.scala
index 9de27e214..9c7b74cda 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/DataWorkCloudCustomExcludeFilter.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/DataWorkCloudCustomExcludeFilter.scala
@@ -17,7 +17,7 @@
package org.apache.linkis.server.conf
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.springframework.core.`type`.classreading.{MetadataReader, MetadataReaderFactory}
import org.springframework.core.`type`.filter.TypeFilter
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/ServerConfiguration.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/ServerConfiguration.scala
index 75df6d9f9..f600a6292 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/ServerConfiguration.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/ServerConfiguration.scala
@@ -17,15 +17,15 @@
package org.apache.linkis.server.conf
-import java.io.File
-import java.lang.Boolean
-
+import org.apache.commons.lang3.StringUtils
import org.apache.linkis.common.conf.{CommonVars, Configuration, TimeType}
import org.apache.linkis.common.utils.{DESUtil, Logging, Utils}
import org.apache.linkis.server.exception.BDPInitServerException
-import org.apache.commons.lang3.StringUtils
import sun.misc.BASE64Encoder
+import java.io.File
+import java.lang
+
object ServerConfiguration extends Logging{
val BDP_SERVER_EXCLUDE_PACKAGES = CommonVars("wds.linkis.server.component.exclude.packages", "")
@@ -33,7 +33,7 @@ object ServerConfiguration extends Logging{
val BDP_SERVER_EXCLUDE_ANNOTATION = CommonVars("wds.linkis.server.component.exclude.annotation", "")
val BDP_SERVER_SPRING_APPLICATION_LISTENERS = CommonVars("wds.linkis.server.spring.application.listeners", "")
- val BDP_SERVER_VERSION = CommonVars("wds.linkis.server.version", "").getValue
+ val BDP_SERVER_VERSION: String = CommonVars("wds.linkis.server.version", "").getValue
if(StringUtils.isBlank(BDP_SERVER_VERSION)) {
throw new BDPInitServerException(10010, "DataWorkCloud service must set the version, please add property [[wds.linkis.server.version]] to properties file.")
}
@@ -65,19 +65,19 @@ object ServerConfiguration extends Logging{
val BDP_TEST_USER = CommonVars("wds.linkis.test.user", "")
val BDP_SERVER_HOME = CommonVars("wds.linkis.server.home", CommonVars("LINKIS_HOME", "").getValue)
- val BDP_SERVER_DISTINCT_MODE = CommonVars("wds.linkis.server.distinct.mode", new Boolean(true))
+ val BDP_SERVER_DISTINCT_MODE: CommonVars[lang.Boolean] = CommonVars("wds.linkis.server.distinct.mode", lang.Boolean.TRUE)
if (!BDP_SERVER_DISTINCT_MODE.getValue && StringUtils.isEmpty(BDP_SERVER_HOME.getValue)) {
throw new BDPInitServerException(11000, "wds.linkis.server.home或BDP_SERVER_HOME haven't set!")
}
- val BDP_SERVER_SOCKET_MODE = CommonVars("wds.linkis.server.socket.mode", new Boolean(false))
+ val BDP_SERVER_SOCKET_MODE: CommonVars[lang.Boolean] = CommonVars("wds.linkis.server.socket.mode", lang.Boolean.FALSE)
val BDP_SERVER_IDENT_STRING = CommonVars("wds.linkis.server.ident.string", "true")
val BDP_SERVER_SERVER_JETTY_NAME = CommonVars("wds.linkis.server.jetty.name", "")
val BDP_SERVER_ADDRESS = CommonVars("wds.linkis.server.address", Utils.getLocalHostname)
val BDP_SERVER_PORT = CommonVars("wds.linkis.server.port", 20303)
val BDP_SERVER_SECURITY_FILTER = CommonVars("wds.linkis.server.security.filter", "org.apache.linkis.server.security.SecurityFilter")
val BDP_SERVER_SECURITY_REFERER_VALIDATE = CommonVars("wds.linkis.server.security.referer.validate", false)
- val BDP_SERVER_SECURITY_SSL = CommonVars("wds.linkis.server.security.ssl", false)
+ val BDP_SERVER_SECURITY_SSL: CommonVars[Boolean] = CommonVars("wds.linkis.server.security.ssl", false)
val BDP_SERVER_SECURITY_SSL_EXCLUDE_PROTOCOLS = CommonVars("wds.linkis.server.security.ssl.excludeProtocols", "SSLv2,SSLv3")
val BDP_SERVER_SECURITY_SSL_KEYSTORE_PATH = CommonVars("wds.linkis.server.security.ssl.keystore.path",
new File(BDP_SERVER_HOME.getValue, "keystore").getPath)
@@ -88,7 +88,7 @@ object ServerConfiguration extends Logging{
"")
val BDP_SERVER_SERVER_CONTEXT_PATH = CommonVars("wds.linkis.server.context.path", "/")
- val BDP_SERVER_RESTFUL_URI = CommonVars("wds.linkis.server.restful.uri", "/api/rest_j/" + BDP_SERVER_VERSION)
+ val BDP_SERVER_RESTFUL_URI: CommonVars[String] = CommonVars("wds.linkis.server.restful.uri", "/api/rest_j/" + BDP_SERVER_VERSION)
val BDP_SERVER_USER_URI = CommonVars("wds.linkis.server.user.restful.uri", "/api/rest_j/" + BDP_SERVER_VERSION + "/user")
val BDP_SERVER_RESTFUL_LOGIN_URI = CommonVars("wds.linkis.server.user.restful.login.uri", new File(BDP_SERVER_USER_URI.getValue, "login").getPath)
val BDP_SERVER_RESTFUL_PASS_AUTH_REQUEST_URI = CommonVars("wds.linkis.server.user.restful.uri.pass.auth", "").getValue.split(",")
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/package.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/package.scala
index 858b7e950..8abdad880 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/package.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/package.scala
@@ -18,17 +18,18 @@
package org.apache.linkis
import java.util
-
import org.apache.linkis.common.exception.{ErrorException, ExceptionManager, FatalException, WarnException}
import org.apache.linkis.common.utils.Utils
import org.apache.linkis.server.exception.{BDPServerErrorException, NonLoginException}
import org.apache.linkis.server.security.SecurityFilter
+
import javax.servlet.http.HttpServletRequest
-import org.apache.commons.lang.StringUtils
-import org.apache.commons.lang.exception.ExceptionUtils
+import org.apache.commons.lang3.StringUtils
+import org.apache.commons.lang3.exception.ExceptionUtils
import org.slf4j.Logger
-import scala.collection.{JavaConversions, mutable}
+import scala.collection.JavaConverters._
+import scala.collection.mutable
package object server {
@@ -40,8 +41,9 @@ package object server {
def validateFailed(message: String): Message = Message(status = 2).setMessage(message)
def validate[T](json: util.Map[String, T], keys: String*): Unit = {
- keys.foreach(k => if(!json.contains(k) || json.get(k) == null || StringUtils.isEmpty(json.get(k).toString))
- throw new BDPServerErrorException(11001, s"Verification failed, $k cannot be empty!(验证失败,$k 不能为空!)"))
+ keys.foreach(k => if (!json.contains(k) || json.get(k) == null || StringUtils.isEmpty(json.get(k).toString)) {
+ throw new BDPServerErrorException(11001, s"Verification failed, $k cannot be empty!(验证失败,$k 不能为空!)")
+ })
}
def error(message: String): Message = Message.error(message)
implicit def ok(msg: String): Message = Message.ok(msg)
@@ -53,7 +55,7 @@ package object server {
// case nonLogin: NonLoginException => Message.noLogin(msg = nonLogin.getMessage)
// case t => catchOp(t)
// }
- def catchMsg(tryOp: => Message)(msg: String)(implicit log: Logger): Message = Utils.tryCatch(tryOp){
+ def catchMsg(tryOp: => Message)(msg: String)(implicit log: Logger): Message = Utils.tryCatch(tryOp) {
case fatal: FatalException =>
log.error("Fatal Error, system exit...", fatal)
System.exit(fatal.getErrCode)
@@ -81,13 +83,15 @@ package object server {
case t =>
log.error(msg, t)
val errorMsg = ExceptionUtils.getRootCauseMessage(t)
- val message = if(StringUtils.isNotEmpty(errorMsg) && "operation failed(操作失败)" != msg) error(msg + "!the reason(原因):" + errorMsg)
- else if(StringUtils.isNotEmpty(errorMsg)) error(errorMsg) else error(msg)
+ val message = if (StringUtils.isNotEmpty(errorMsg) && "operation failed(操作失败)" != msg) error(msg + "!the reason(原因):" + errorMsg)
+ else if (StringUtils.isNotEmpty(errorMsg)) error(errorMsg) else error(msg)
message.data(EXCEPTION_MSG, ExceptionManager.unknownException(message.getMessage))
}
+
def catchIt(tryOp: => Message)(implicit log: Logger): Message = catchMsg(tryOp)("operation failed(操作失败)s")
- implicit def toScalaBuffer[T](list: util.List[T]): mutable.Buffer[T] = JavaConversions.asScalaBuffer(list)
- implicit def toScalaMap[K, V](map: util.Map[K, V]): mutable.Map[K, V] = JavaConversions.mapAsScalaMap(map)
+
+ implicit def toScalaBuffer[T](list: util.List[T]): mutable.Buffer[T] = list.asScala
+ implicit def toScalaMap[K, V](map: util.Map[K, V]): mutable.Map[K, V] = map.asScala
implicit def toJavaList[T](list: mutable.Buffer[T]): util.List[T] = {
val arrayList = new util.ArrayList[T]
list.foreach(arrayList.add)
@@ -98,11 +102,13 @@ package object server {
map.foreach(m => hashMap.put(m._1, m._2))
hashMap
}
+
implicit def toJavaMap[K, V](map: Map[K, V]): JMap[K, V] = {
val hashMap = new util.HashMap[K, V]()
map.foreach(m => hashMap.put(m._1, m._2))
hashMap
}
+
implicit def asString(mapWithKey: (util.Map[String, Object], String)): String = mapWithKey._1.get(mapWithKey._2).asInstanceOf[String]
implicit def getString(mapWithKey: (util.Map[String, String], String)): String = mapWithKey._1.get(mapWithKey._2)
implicit def asInt(map: util.Map[String, Object], key: String): Int = map.get(key).asInstanceOf[Int]
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SSOUtils.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SSOUtils.scala
index 605f633fe..ae897bddf 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SSOUtils.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SSOUtils.scala
@@ -24,7 +24,7 @@ import org.apache.linkis.common.utils.{Logging, RSAUtils, Utils}
import org.apache.linkis.server.conf.ServerConfiguration
import org.apache.linkis.server.exception.{IllegalUserTicketException, LoginExpireException, NonLoginException}
import javax.servlet.http.Cookie
-import org.apache.commons.lang.time.DateFormatUtils
+import org.apache.commons.lang3.time.DateFormatUtils
import scala.collection.JavaConverters._
object SSOUtils extends Logging {
@@ -58,11 +58,12 @@ object SSOUtils extends Logging {
)
private[security] def getUserAndLoginTime(userTicketId: String): Option[(String, Long)] = {
- ServerConfiguration.getUsernameByTicket(userTicketId).map { userAndLoginTime =>
- if(userAndLoginTime.indexOf(",") < 0) throw new IllegalUserTicketException(s"Illegal user token information(非法的用户token信息).")
+ ServerConfiguration.getUsernameByTicket(userTicketId).map { userAndLoginTime => {
+ if (userAndLoginTime.indexOf(",") < 0) throw new IllegalUserTicketException(s"Illegal user token information(非法的用户token信息).")
val index = userAndLoginTime.lastIndexOf(",")
(userAndLoginTime.substring(0, index), userAndLoginTime.substring(index + 1).toLong)
}
+ }
}
//Determine the unique ID by username and timestamp(通过用户名和时间戳,确定唯一ID)
@@ -127,7 +128,7 @@ object SSOUtils extends Logging {
def getLoginUser(getUserTicketId: String => Option[String]): Option[String] = getUserTicketId(USER_TICKET_ID_STRING).map { t =>
isTimeoutOrNot(t)
- getUserAndLoginTime(t).getOrElse(throw new IllegalUserTicketException( s"Illegal user token information(非法的用户token信息)."))._1
+ getUserAndLoginTime(t).getOrElse(throw new IllegalUserTicketException(s"Illegal user token information(非法的用户token信息)."))._1
}
def getLoginUsername(getUserTicketId: String => Option[String]): String = getLoginUser(getUserTicketId).getOrElse(throw new NonLoginException(s"You are not logged in, please login first(您尚未登录,请先登录!)"))
@@ -139,6 +140,7 @@ object SSOUtils extends Logging {
def updateLastAccessTime(getUserTicketId: String => Option[String]): Unit = getUserTicketId(USER_TICKET_ID_STRING).foreach(isTimeoutOrNot)
+ @throws(classOf[LoginExpireException])
private def isTimeoutOrNot(userTicketId: String): Unit = if (!userTicketIdToLastAccessTime.containsKey(userTicketId)) {
throw new LoginExpireException("You are not logged in, please login first!(您尚未登录,请先登录!)")
} else {
@@ -155,6 +157,4 @@ object SSOUtils extends Logging {
def getSessionTimeOut(): Long = sessionTimeout
-
-
}
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SecurityFilter.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SecurityFilter.scala
index 4588cca5b..169edb39f 100644
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SecurityFilter.scala
+++ b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/security/SecurityFilter.scala
@@ -28,7 +28,7 @@ import org.apache.linkis.server.security.SSOUtils.sslEnable
import org.apache.linkis.server.{Message, _}
import javax.servlet._
import javax.servlet.http.{Cookie, HttpServletRequest, HttpServletResponse}
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
class SecurityFilter extends Filter {
@@ -120,8 +120,10 @@ class SecurityFilter extends Filter {
object SecurityFilter extends Logging {
private[linkis] val OTHER_SYSTEM_IGNORE_UM_USER = "dataworkcloud_rpc_user"
private[linkis] val ALLOW_ACCESS_WITHOUT_TIMEOUT = "dataworkcloud_inner_request"
+
def getLoginUserThrowsExceptionWhenTimeout(req: HttpServletRequest): Option[String] = Option(req.getCookies).flatMap(cs => SSOUtils.getLoginUser(cs))
.orElse(SSOUtils.getLoginUserIgnoreTimeout(key => Option(req.getHeader(key))).filter(_ == OTHER_SYSTEM_IGNORE_UM_USER))
+
def getLoginUser(req: HttpServletRequest): Option[String] = Utils.tryCatch(getLoginUserThrowsExceptionWhenTimeout(req)) {
case _: LoginExpireException =>
SSOUtils.getLoginUserIgnoreTimeout(key => Option(req.getCookies).flatMap(_.find(_.getName == key).map(_.getValue))).filter(user => user != OTHER_SYSTEM_IGNORE_UM_USER &&
diff --git a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
index 3133f6280..bd3d681a3 100644
--- a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
+++ b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
@@ -18,11 +18,15 @@
package org.apache.linkis.entrance.job;
import org.apache.linkis.common.log.LogUtils;
-import org.apache.linkis.common.utils.Utils;
+import org.apache.linkis.common.utils.ByteTimeUtils;
import org.apache.linkis.entrance.exception.EntranceErrorCode;
import org.apache.linkis.entrance.exception.EntranceErrorException;
import org.apache.linkis.entrance.execute.EntranceJob;
-import org.apache.linkis.entrance.log.*;
+import org.apache.linkis.entrance.log.LogHandler;
+import org.apache.linkis.entrance.log.LogReader;
+import org.apache.linkis.entrance.log.LogWriter;
+import org.apache.linkis.entrance.log.WebSocketCacheLogReader;
+import org.apache.linkis.entrance.log.WebSocketLogWriter;
import org.apache.linkis.entrance.persistence.PersistenceManager;
import org.apache.linkis.governance.common.conf.GovernanceCommonConf;
import org.apache.linkis.governance.common.constant.job.JobRequestConstants;
@@ -47,7 +51,12 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import scala.Option;
@@ -313,7 +322,7 @@ public class EntranceExecutionJob extends EntranceJob implements LogHandler {
String runTime;
if (metricsMap.containsKey(TaskConstant.ENTRANCEJOB_COMPLETE_TIME)) {
runTime =
- Utils.msDurationToString(
+ ByteTimeUtils.msDurationToString(
(((Date) metricsMap.get(TaskConstant.ENTRANCEJOB_COMPLETE_TIME)))
.getTime()
- (((Date)
diff --git a/linkis-computation-governance/linkis-manager/linkis-manager-common/src/main/scala/org/apache/linkis/manager/common/entity/resource/Resource.scala b/linkis-computation-governance/linkis-manager/linkis-manager-common/src/main/scala/org/apache/linkis/manager/common/entity/resource/Resource.scala
index 4642828b8..627924c82 100644
--- a/linkis-computation-governance/linkis-manager/linkis-manager-common/src/main/scala/org/apache/linkis/manager/common/entity/resource/Resource.scala
+++ b/linkis-computation-governance/linkis-manager/linkis-manager-common/src/main/scala/org/apache/linkis/manager/common/entity/resource/Resource.scala
@@ -242,7 +242,7 @@ class LoadInstanceResource(val memory: Long, val cores: Int, val instances: Int)
case l: LoadResource => new LoadInstanceResource(l.memory, l.cores, 0)
case m: MemoryResource => new LoadInstanceResource(m.memory, 0, 0)
case c: CPUResource => new LoadInstanceResource(0, c.cores, 0)
- case d: DriverAndYarnResource => d.loadInstanceResource // yarn resource has special logic
+ case d: DriverAndYarnResource => d.loadInstanceResource // yarn resource has special logic
case _ => new LoadInstanceResource(Long.MaxValue, Integer.MAX_VALUE, Integer.MAX_VALUE)
}
@@ -285,7 +285,7 @@ class LoadInstanceResource(val memory: Long, val cores: Int, val instances: Int)
class InstanceResource(val instances: Int) extends CPUResource(instances) {
override protected def toResource(cores: Int): Resource = new InstanceResource(cores)
- override def toJson: String = s"Instance:$instances"
+ override def toJson: String = s"Instance: $instances"
override def toString: String = toJson
}
diff --git a/linkis-engineconn-plugins/engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala b/linkis-engineconn-plugins/engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
index 53bf60169..f7af9cc24 100644
--- a/linkis-engineconn-plugins/engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
+++ b/linkis-engineconn-plugins/engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
@@ -18,7 +18,7 @@
package org.apache.linkis.engineplugin.hive.executor
import org.apache.linkis.common.exception.ErrorException
-import org.apache.linkis.common.utils.{Logging, Utils}
+import org.apache.linkis.common.utils.{ByteTimeUtils, Logging, Utils}
import org.apache.linkis.engineconn.computation.executor.execute.{ComputationExecutor, EngineExecutionContext}
import org.apache.linkis.engineconn.core.EngineConnObject
import org.apache.linkis.engineplugin.hive.cs.CSHiveHelper
@@ -198,8 +198,8 @@ class HiveEngineConnExecutor(id: Int,
// todo check uncleared context ?
return ErrorExecuteResponse(hiveResponse.getErrorMessage, hiveResponse.getException)
}
- engineExecutorContext.appendStdout(s"Time taken: ${Utils.msDurationToString(System.currentTimeMillis() - startTime)}, begin to fetch results.")
- LOG.info(s"$getId >> Time taken: ${Utils.msDurationToString(System.currentTimeMillis() - startTime)}, begin to fetch results.")
+ engineExecutorContext.appendStdout(s"Time taken: ${ByteTimeUtils.msDurationToString(System.currentTimeMillis() - startTime)}, begin to fetch results.")
+ LOG.info(s"$getId >> Time taken: ${ByteTimeUtils.msDurationToString(System.currentTimeMillis() - startTime)}, begin to fetch results.")
val fieldSchemas = if (hiveResponse.getSchema != null) hiveResponse.getSchema.getFieldSchemas
else if (driver.getSchema != null) driver.getSchema.getFieldSchemas
diff --git a/linkis-engineconn-plugins/engineconn-plugins/jdbc/src/main/resources/log4j2.xml b/linkis-engineconn-plugins/engineconn-plugins/jdbc/src/main/resources/log4j2.xml
index b1a39f3ab..83186732f 100644
--- a/linkis-engineconn-plugins/engineconn-plugins/jdbc/src/main/resources/log4j2.xml
+++ b/linkis-engineconn-plugins/engineconn-plugins/jdbc/src/main/resources/log4j2.xml
@@ -18,7 +18,7 @@
<configuration status="error" monitorInterval="30">
<appenders>
- <RollingFile name="RollingFile" append="true" fileName="${env:LOG_DIRS}/stdout"
+ <RollingFile name="RollingFile" append="true" fileName="${env:LOG_DIRS:-logs}/stdout"
filePattern="${env:LOG_DIRS}/$${date:yyyy-MM}/linkis-log-%d{yyyy-MM-dd-hh}-%i.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%-40t] %c{1.} (%L) [%M] - %msg%xEx%n"/>
<Policies>
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-configuration/src/test/rpcTest.scala b/linkis-public-enhancements/linkis-publicservice/linkis-configuration/src/test/rpcTest.scala
index df4eb9ceb..36845f176 100644
--- a/linkis-public-enhancements/linkis-publicservice/linkis-configuration/src/test/rpcTest.scala
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-configuration/src/test/rpcTest.scala
@@ -21,7 +21,7 @@ import org.apache.linkis.configuration.service.CategoryService
object rpcTest {
def main(args: Array[String]): Unit = {
val categoryService = new CategoryService
- categoryService.createFirstCategory("easyide","null")
+ categoryService.createFirstCategory("easyide", "null")
}
}
diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-httpclient-support/src/main/scala/org/apache/linkis/httpclient/dws/discovery/DefaultConfigDiscovery.scala b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-httpclient-support/src/main/scala/org/apache/linkis/httpclient/dws/discovery/DefaultConfigDiscovery.scala
index 6b3fdd3e4..6ab8f532d 100644
--- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-httpclient-support/src/main/scala/org/apache/linkis/httpclient/dws/discovery/DefaultConfigDiscovery.scala
+++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-httpclient-support/src/main/scala/org/apache/linkis/httpclient/dws/discovery/DefaultConfigDiscovery.scala
@@ -23,7 +23,7 @@ import org.apache.linkis.httpclient.config.HttpClientConstant
import org.apache.linkis.httpclient.discovery.{AbstractDiscovery, HeartbeatAction, HeartbeatResult}
import org.apache.linkis.httpclient.dws.request.DWSHeartbeatAction
import org.apache.linkis.httpclient.dws.response.DWSHeartbeatResult
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
class DefaultConfigDiscovery extends AbstractDiscovery {
@@ -49,5 +49,4 @@ class DefaultConfigDiscovery extends AbstractDiscovery {
case h: DWSHeartbeatAction => new DWSHeartbeatResult(response, h.serverUrl)
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org