You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/10/18 17:49:43 UTC
[activemq-artemis] 02/02: ARTEMIS-4056 Fixing compatibility with getFirstMessage()
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 51c50d8546adef7132728f65e785dff4f0d4e3bf
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Oct 18 13:42:12 2022 -0400
ARTEMIS-4056 Fixing compatibility with getFirstMessage()
if Empty the previous method was returning new Map[1] and the JSON output would be slightly different and I am playing safe here just in case.
---
.../activemq/artemis/core/management/impl/QueueControlImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
index 5e31da5aeb..1fbefc3847 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
@@ -888,7 +888,6 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
clearIO();
try {
- List<Map<String, Object>> messages = new ArrayList<>();
final int attributeSizeLimit = addressSettingsRepository.getMatch(address).getManagementMessageAttributeSizeLimit();
MessageReference firstMessage = queue.peekFirstMessage();
if (firstMessage != null) {
@@ -908,7 +907,9 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
AuditLogger.getFirstMessageAsJSON(queue);
}
Map<String, Object> message = getFirstMessage();
- return toJSON(message == null ? new Map[0] : new Map[]{message});
+ // I"m returning a new Map[1] in case of no first message, because older versions used to return that when null
+ // and I'm playing safe with the compatibility here.
+ return toJSON(message == null ? new Map[1] : new Map[]{message});
}
@Override