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 8460c0f83 fix(aliyun): relabel topic and group timestamps into the
server zone (#5732)
8460c0f83 is described below
commit 8460c0f83c9f5981692fdcc146559c0222314a25
Author: 0 <[email protected]>
AuthorDate: Mon Oct 19 18:13:43 2026 +0800
fix(aliyun): relabel topic and group timestamps into the server zone (#5732)
Verified against `rocketmq-studio` at 86aa49c34 before merging: 缺陷仍在。主干
`server/src/main/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConverters.java:386-395`
merge-tree clean against the current trunk and no outstanding must-fix
items; merged as-is (squash) per the maintainer review of 2026-10-19.
---
.../studio/provider/alibaba/AliyunConverters.java | 9 +++++-
.../provider/alibaba/AliyunConvertersTest.java | 35 ++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConverters.java
b/server/src/main/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConverters.java
index a5eded738..96406534b 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConverters.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConverters.java
@@ -388,7 +388,14 @@ final class AliyunConverters {
return null;
}
try {
- return java.time.LocalDateTime.parse(value, TIME_FORMATTER);
+ // The string is Aliyun's UTC+8 wall clock (see ALIYUN_TIME_ZONE),
so relabeling it
+ // as-is would hand the caller a zone-less value in a zone nobody
else uses: the
+ // gmtCreate/gmtModified columns would drift from every timestamp
Studio itself
+ // writes, and from the epoch-based message/trace times of the
same instance.
+ // Convert into the server zone, the same relabeling the Tencent
provider applies.
+ java.time.LocalDateTime aliyunWallClock =
java.time.LocalDateTime.parse(value, TIME_FORMATTER);
+ return java.time.LocalDateTime.ofInstant(
+ aliyunWallClock.atZone(ALIYUN_TIME_ZONE).toInstant(),
ZoneId.systemDefault());
} catch (RuntimeException ex) {
return null;
}
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConvertersTest.java
b/server/src/test/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConvertersTest.java
index 4629bf38e..a685df05d 100644
---
a/server/src/test/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConvertersTest.java
+++
b/server/src/test/java/org/apache/rocketmq/studio/provider/alibaba/AliyunConvertersTest.java
@@ -26,6 +26,9 @@ import org.apache.rocketmq.studio.instance.topic.TopicVO;
import org.apache.rocketmq.studio.instance.group.SubscriptionEntryVO;
import org.junit.jupiter.api.Test;
+import java.time.LocalDateTime;
+import java.util.TimeZone;
+
import static org.assertj.core.api.Assertions.assertThat;
class AliyunConvertersTest {
@@ -151,4 +154,36 @@ class AliyunConvertersTest {
.consistency(consistency)
.build();
}
+
+ @Test
+ void parseDateTimeShouldRelabelAliyunWallClockIntoTheServerZoneTest() {
+ TimeZone original = TimeZone.getDefault();
+ try {
+ // 2026-10-08 10:00:00 in Asia/Shanghai is 02:00:00 UTC.
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ assertThat(AliyunConverters.parseDateTime("2026-10-08 10:00:00"))
+ .isEqualTo(LocalDateTime.of(2026, 10, 8, 2, 0, 0));
+ } finally {
+ TimeZone.setDefault(original);
+ }
+ }
+
+ @Test
+ void
parseDateTimeShouldKeepAliyunWallClockWhenServerRunsTheAliyunZoneTest() {
+ TimeZone original = TimeZone.getDefault();
+ try {
+ TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
+ assertThat(AliyunConverters.parseDateTime("2026-10-08 10:00:00"))
+ .isEqualTo(LocalDateTime.of(2026, 10, 8, 10, 0, 0));
+ } finally {
+ TimeZone.setDefault(original);
+ }
+ }
+
+ @Test
+ void parseDateTimeShouldReturnNullForUnusableValuesTest() {
+ assertThat(AliyunConverters.parseDateTime(null)).isNull();
+ assertThat(AliyunConverters.parseDateTime(" ")).isNull();
+ assertThat(AliyunConverters.parseDateTime("not a date")).isNull();
+ }
}