This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new f956463f fix(credentials): parse vendor with root locale (#1468)
f956463f is described below
commit f956463f1a996eb6e3a63f31358fcfdbc493033a
Author: 0 <[email protected]>
AuthorDate: Mon Aug 10 21:12:02 2026 +0800
fix(credentials): parse vendor with root locale (#1468)
---
.../credential/CreateCloudCredentialDTO.java | 4 ++-
.../credential/CreateCloudCredentialDTOTest.java | 42 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTO.java
b/server/src/main/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTO.java
index 92ad4ac4..077349e8 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTO.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTO.java
@@ -20,6 +20,8 @@ import jakarta.validation.constraints.NotBlank;
import org.apache.rocketmq.studio.common.domain.enums.InstanceVendor;
import lombok.Data;
+import java.util.Locale;
+
@Data
public class CreateCloudCredentialDTO {
@@ -52,7 +54,7 @@ public class CreateCloudCredentialDTO {
return null;
}
try {
- return InstanceVendor.valueOf(vendor.trim().toUpperCase());
+ return
InstanceVendor.valueOf(vendor.trim().toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException ex) {
return null;
}
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTOTest.java
b/server/src/test/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTOTest.java
new file mode 100644
index 00000000..25dc3fc6
--- /dev/null
+++
b/server/src/test/java/org/apache/rocketmq/studio/provider/credential/CreateCloudCredentialDTOTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.apache.rocketmq.studio.provider.credential;
+
+import org.apache.rocketmq.studio.common.domain.enums.InstanceVendor;
+import org.junit.jupiter.api.Test;
+
+import java.util.Locale;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class CreateCloudCredentialDTOTest {
+
+ @Test
+ void parseVendorShouldBeIndependentOfDefaultLocale() {
+ Locale originalLocale = Locale.getDefault();
+
+ InstanceVendor vendor;
+ try {
+ Locale.setDefault(Locale.forLanguageTag("tr-TR"));
+ vendor = CreateCloudCredentialDTO.parseVendor("aliyun");
+ } finally {
+ Locale.setDefault(originalLocale);
+ }
+
+ assertThat(vendor).isEqualTo(InstanceVendor.ALIYUN);
+ }
+}