You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2023/10/13 09:43:37 UTC

[dubbo] branch 3.2 updated: Fix #13135 for testing (#13139)

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

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 4782142980 Fix #13135 for testing (#13139)
4782142980 is described below

commit 47821429807654b14010a672d20eca3d00243ffe
Author: andotorg <an...@outlook.com>
AuthorDate: Fri Oct 13 17:43:30 2023 +0800

    Fix #13135 for testing (#13139)
    
    * fix https://github.com/apache/dubbo/issues/13135
    
    * fix Using the '.*' form of import should be avoided build error
    
    * nashorn-core jar scope is test
---
 dubbo-cluster/pom.xml                                             | 7 +++++++
 .../main/java/org/apache/dubbo/metrics/model/MetricsSupport.java  | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml
index 130b7e3f7e..2013b81c99 100644
--- a/dubbo-cluster/pom.xml
+++ b/dubbo-cluster/pom.xml
@@ -29,6 +29,7 @@
     <description>The cluster module of dubbo project</description>
     <properties>
         <skip_maven_deploy>false</skip_maven_deploy>
+        <nashorn-core.version>15.4</nashorn-core.version>
     </properties>
     <dependencies>
         <dependency>
@@ -91,5 +92,11 @@
             <artifactId>micrometer-tracing-integration-test</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.openjdk.nashorn</groupId>
+            <artifactId>nashorn-core</artifactId>
+            <version>${nashorn-core.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java
index d6510a503f..ed723192e5 100644
--- a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java
+++ b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java
@@ -20,6 +20,7 @@ package org.apache.dubbo.metrics.model;
 import org.apache.dubbo.common.Version;
 import org.apache.dubbo.common.lang.Nullable;
 import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.metrics.collector.MethodMetricsCollector;
 import org.apache.dubbo.metrics.collector.ServiceMetricsCollector;
 import org.apache.dubbo.metrics.event.MetricsEvent;
@@ -32,10 +33,10 @@ import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.RpcException;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
-import java.util.HashMap;
 import java.util.Map;
-import java.util.Optional;
+import java.util.HashMap;
 import java.util.Set;
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 
@@ -162,6 +163,9 @@ public class MetricsSupport {
         } else {
             String serviceUniqueName = invocation.getTargetServiceUniqueName();
             String interfaceAndVersion;
+            if (StringUtils.isBlank(serviceUniqueName)) {
+                return "";
+            }
             String[] arr = serviceUniqueName.split(PATH_SEPARATOR);
             if (arr.length == 2) {
                 interfaceAndVersion = arr[1];