This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new d58d966ba fix: DefaultGatewayRouter init NPE (#1235) (#3609)
d58d966ba is described below

commit d58d966ba378eb9eac3d2988b6ee24a0a487129d
Author: dingsheng339 <[email protected]>
AuthorDate: Tue Oct 11 18:45:56 2022 +0800

    fix: DefaultGatewayRouter init NPE (#1235) (#3609)
    
    * fix: DefaultGatewayRouter init NPE (#1235)
---
 .../scala/org/apache/linkis/gateway/route/GatewayRouter.scala    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/route/GatewayRouter.scala
 
b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/route/GatewayRouter.scala
index 78123b836..0952b08ab 100644
--- 
a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/route/GatewayRouter.scala
+++ 
b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/route/GatewayRouter.scala
@@ -130,9 +130,12 @@ abstract class AbstractGatewayRouter extends GatewayRouter 
with Logging {
 
 class DefaultGatewayRouter(var gatewayRouters: Array[GatewayRouter]) extends 
AbstractGatewayRouter {
 
-  gatewayRouters = gatewayRouters.sortWith((left, right) => {
-    left.order() < right.order()
-  })
+  if (gatewayRouters != null && gatewayRouters.nonEmpty) {
+    val notNullRouters = gatewayRouters.filter(x => x != null)
+    gatewayRouters = notNullRouters.sortWith((left, right) => {
+      left.order() < right.order()
+    })
+  }
 
   private def findCommonService(parsedServiceId: String) = findService(
     parsedServiceId,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to