Merged in revision 465987 from trunk

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@465990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-10-20 04:47:48 +00:00
parent ef8320b2e9
commit c0454ac325
2 changed files with 12 additions and 4 deletions

View File

@ -570,6 +570,7 @@ public class ProtocolConverter {
} else if( message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE ) { } else if( message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE ) {
ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy(); ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy();
msg.setReadOnlyBody(true);
byte[] data = new byte[(int)msg.getBodyLength()]; byte[] data = new byte[(int)msg.getBodyLength()];
msg.readBytes(data); msg.readBytes(data);

View File

@ -20,6 +20,8 @@ package org.apache.activemq.transport.stomp;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -91,18 +93,23 @@ public class StompSubscription {
ack.setConsumerId(consumerInfo.getConsumerId()); ack.setConsumerId(consumerInfo.getConsumerId());
int count=0; int count=0;
for (Iterator iter = dispatchedMessage.keySet().iterator(); iter.hasNext();) { for (Iterator iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Entry) iter.next();
String id = (String) entry.getKey();
MessageId msgid = (MessageId) entry.getValue();
String id = (String) iter.next();
if( ack.getFirstMessageId()==null ) if( ack.getFirstMessageId()==null )
ack.setFirstMessageId((MessageId) dispatchedMessage.get(id)); ack.setFirstMessageId(msgid);
iter.remove(); iter.remove();
count++; count++;
if( id.equals(messageId) ) { if( id.equals(messageId) ) {
ack.setLastMessageId((MessageId) dispatchedMessage.get(id)); ack.setLastMessageId(msgid);
break; break;
} }
} }
ack.setMessageCount(count); ack.setMessageCount(count);