ARTEMIS-4209 avoid double 'ID:' for 'User ID' when browsing AMQP msgs

This commit is contained in:
Justin Bertram 2023-03-16 10:39:31 -05:00
parent d2e5ddfe86
commit 448a6dee02
2 changed files with 14 additions and 1 deletions

View File

@ -127,7 +127,8 @@ public class MessageOpenTypeFactory<M extends Message> {
rc.put(CompositeDataConstants.MESSAGE_ID, "" + m.getMessageID());
rc.put(CompositeDataConstants.PROTOCOL, m.getProtocolName());
if (m.getUserID() != null) {
rc.put(CompositeDataConstants.USER_ID, "ID:" + m.getUserID().toString());
String userID = m.getUserID().toString();
rc.put(CompositeDataConstants.USER_ID, userID.startsWith("ID:") ? userID : "ID:" + userID);
} else {
rc.put(CompositeDataConstants.USER_ID, "");
}

View File

@ -4090,12 +4090,24 @@ public class QueueControlTest extends ManagementTestBase {
Assert.assertEquals(2, browse.length);
String userID = (String) browse[0].get("userID");
Assert.assertTrue(userID.startsWith("ID:"));
Assert.assertFalse(userID.startsWith("ID:ID:"));
String body = (String) browse[0].get("text");
Assert.assertNotNull(body);
Assert.assertEquals("theAMQPBody", body);
userID = (String) browse[1].get("userID");
Assert.assertTrue(userID.startsWith("ID:"));
Assert.assertFalse(userID.startsWith("ID:ID:"));
body = (String) browse[1].get("text");
Assert.assertNotNull(body);