[ https://issues.apache.org/jira/browse/AMQ-7309?focusedWorklogId=845943&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-845943 ]
ASF GitHub Bot logged work on AMQ-7309: --------------------------------------- Author: ASF GitHub Bot Created on: 16/Feb/23 16:37 Start Date: 16/Feb/23 16:37 Worklog Time Spent: 10m Work Description: cshannon commented on code in PR #979: URL: https://github.com/apache/activemq/pull/979#discussion_r1108739978 ########## activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java: ########## @@ -956,4 +956,22 @@ protected void doCompress() throws IOException { } } } + + @Override + @SuppressWarnings("unchecked") + public boolean isBodyAssignableTo(Class c) { + return getContent() == null || c.isAssignableFrom(byte[].class); + } + + @SuppressWarnings("unchecked") + protected <T> T doGetBody(Class<T> asType) { + //Make sure the bytes are stored before trying to copy and return + if (dataOut != null && getContent() == null) { + storeContent(); + } + + final ByteSequence content = getContent(); + return content != null ? (T) new ByteSequence(content.getData(), content.getOffset(), + content.getLength()).getData() : null; Review Comment: I'm going to add a copy method to ByteSequence, that seems simplest. Issue Time Tracking ------------------- Worklog Id: (was: 845943) Time Spent: 19h (was: 18h 50m) > Add JMS 2.0 API support > ----------------------- > > Key: AMQ-7309 > URL: https://issues.apache.org/jira/browse/AMQ-7309 > Project: ActiveMQ > Issue Type: New Feature > Components: Broker, JMS client > Reporter: Jean-Baptiste Onofré > Assignee: Jean-Baptiste Onofré > Priority: Major > Labels: #jms2 > Fix For: 5.18.0 > > Time Spent: 19h > Remaining Estimate: 0h > > * API-only inclusion > * JMS 2.0 objects throw UnsupportedOperationException -- This message was sent by Atlassian Jira (v8.20.10#820010)