You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2024/07/12 13:09:40 UTC
(dubbo) branch 3.2 updated: Fix null key in QoS (#14419)
This is an automated email from the ASF dual-hosted git repository.
crazyhzm 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 6f4fcf41f7 Fix null key in QoS (#14419)
6f4fcf41f7 is described below
commit 6f4fcf41f79124cd3b72166fa0c6a9e1bbbc9946
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Fri Jul 12 21:09:33 2024 +0800
Fix null key in QoS (#14419)
* Fix null key
* Fix style
---
.../org/apache/dubbo/qos/command/impl/GetConfig.java | 4 ++++
.../apache/dubbo/qos/command/impl/GetConfigTest.java | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/GetConfig.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/GetConfig.java
index a3025147df..8804d2adc8 100644
--- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/GetConfig.java
+++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/GetConfig.java
@@ -175,6 +175,8 @@ public class GetConfig implements BaseCommand {
return;
}
+ id = id == null ? "(empty)" : id;
+
plainOutput
.append(type)
.append(": ")
@@ -194,6 +196,8 @@ public class GetConfig implements BaseCommand {
return;
}
+ id = id == null ? "(empty)" : id;
+
plainOutput
.append(type)
.append(": ")
diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/GetConfigTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/GetConfigTest.java
index 0d1c2edd19..aea20fdc42 100644
--- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/GetConfigTest.java
+++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/GetConfigTest.java
@@ -74,6 +74,24 @@ class GetConfigTest {
Assertions.assertNotNull(new GetConfig(frameworkModel).execute(commandContext, null));
}
+ @Test
+ void testEmptyId() {
+ FrameworkModel frameworkModel = new FrameworkModel();
+ ApplicationModel applicationModel1 = frameworkModel.newApplication();
+
+ applicationModel1.getApplicationConfigManager().setApplication(new ApplicationConfig("app1"));
+
+ ModuleModel moduleModel = applicationModel1.newModule();
+ ProviderConfig providerConfig1 = new ProviderConfig();
+ providerConfig1.setThreadname("test");
+ moduleModel.getConfigManager().addProvider(providerConfig1);
+
+ CommandContext commandContext = new CommandContext("getConfig");
+ commandContext.setHttp(true);
+
+ Assertions.assertNotNull(new GetConfig(frameworkModel).execute(commandContext, null));
+ }
+
@Test
void testFilter1() {
FrameworkModel frameworkModel = new FrameworkModel();