You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2015/06/02 22:53:50 UTC
svn commit: r1683186 [3/5] - in /qpid/java/trunk:
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/
bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/
bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upg...
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java Tue Jun 2 20:53:49 2015
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.client;
+import java.util.Map;
+
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
@@ -40,7 +42,6 @@ import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicCancelBody;
import org.apache.qpid.framing.BasicCancelOkBody;
-import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.jms.ConnectionURL;
public class BasicMessageConsumer_0_8 extends BasicMessageConsumer<UnprocessedMessage_0_8>
@@ -53,13 +54,13 @@ public class BasicMessageConsumer_0_8 ex
protected BasicMessageConsumer_0_8(int channelId, AMQConnection connection, AMQDestination destination,
String messageSelector, boolean noLocal, MessageFactoryRegistry messageFactory, AMQSession_0_8 session,
- FieldTable rawSelector, int prefetchHigh, int prefetchLow, boolean exclusive,
+ Map<String,Object> rawSelector, int prefetchHigh, int prefetchLow, boolean exclusive,
int acknowledgeMode, boolean browseOnly, boolean autoClose) throws JMSException
{
super(channelId, connection, destination,messageSelector,noLocal,messageFactory,session,
rawSelector, prefetchHigh, prefetchLow, exclusive, acknowledgeMode,
browseOnly, autoClose);
- final FieldTable consumerArguments = getArguments();
+ final Map<String,Object> consumerArguments = getArguments();
if (isAutoClose())
{
consumerArguments.put(AMQPFilterTypes.AUTO_CLOSE.getValue(), Boolean.TRUE);
@@ -148,13 +149,20 @@ public class BasicMessageConsumer_0_8 ex
}
}
+
public AbstractJMSMessage createJMSMessageFromUnprocessedMessage(AMQMessageDelegateFactory delegateFactory, UnprocessedMessage_0_8 messageFrame)throws Exception
{
return getMessageFactory().createMessage(messageFrame.getDeliveryTag(),
- messageFrame.isRedelivered(), messageFrame.getExchange() == null ? AMQShortString.EMPTY_STRING : messageFrame.getExchange(),
- messageFrame.getRoutingKey(), messageFrame.getContentHeader(), messageFrame.getBodies(),
- _queueDestinationCache, _topicDestinationCache, getAddressType());
+ messageFrame.isRedelivered(),
+ messageFrame.getExchange() == null ? "" : AMQShortString.toString(
+ messageFrame.getExchange()),
+ AMQShortString.toString(messageFrame.getRoutingKey()),
+ messageFrame.getContentHeader(),
+ messageFrame.getBodies(),
+ _queueDestinationCache,
+ _topicDestinationCache,
+ getAddressType());
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java Tue Jun 2 20:53:49 2015
@@ -42,7 +42,6 @@ import org.apache.qpid.client.util.JMSEx
import org.apache.qpid.configuration.ClientProperties;
import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicAckBody;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.BasicNackBody;
@@ -86,7 +85,6 @@ public class BasicMessageProducer_0_8 ex
destination.getExchangeName(),
destination.getExchangeClass(),
destination.getExchangeName()
- .toString()
.startsWith("amq."),
destination.isExchangeDurable(),
destination.isExchangeAutoDelete(),
@@ -110,7 +108,7 @@ public class BasicMessageProducer_0_8 ex
AMQMessageDelegate_0_8 delegate = (AMQMessageDelegate_0_8) message.getDelegate();
BasicContentHeaderProperties contentHeaderProperties = delegate.getContentHeaderProperties();
- AMQShortString routingKey = destination.getRoutingKey();
+ String routingKey = destination.getRoutingKey();
FieldTable headers = delegate.getContentHeaderProperties().getHeaders();
@@ -127,7 +125,7 @@ public class BasicMessageProducer_0_8 ex
if (destination.getAddressType() == AMQDestination.TOPIC_TYPE)
{
- routingKey = AMQShortString.valueOf(headers.getString(QpidMessageProperties.QPID_SUBJECT));
+ routingKey = headers.getString(QpidMessageProperties.QPID_SUBJECT);
}
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java Tue Jun 2 20:53:49 2015
@@ -33,9 +33,9 @@ import javax.jms.JMSException;
interface TemporaryDestination extends Destination
{
- public AMQShortString getAMQQueueName();
- public void delete() throws JMSException;
- public AMQSession getSession();
- public boolean isDeleted();
+ String getAMQQueueName();
+ void delete() throws JMSException;
+ AMQSession getSession();
+ boolean isDeleted();
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java Tue Jun 2 20:53:49 2015
@@ -64,7 +64,7 @@ public class ClientMethodDispatcherImpl
static
{
- _dispatcherFactories.put(ProtocolVersion.v8_0,
+ _dispatcherFactories.put(ProtocolVersion.v0_8,
new DispatcherFactory()
{
public ClientMethodDispatcherImpl createMethodDispatcher(AMQProtocolSession session)
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java Tue Jun 2 20:53:49 2015
@@ -70,7 +70,7 @@ public class ConnectionStartMethodHandle
_log.debug("public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, "
+ "AMQMethodEvent evt): called");
- ProtocolVersion pv = new ProtocolVersion((byte) body.getVersionMajor(), (byte) body.getVersionMinor());
+ ProtocolVersion pv = ProtocolVersion.get((byte) body.getVersionMajor(), (byte) body.getVersionMinor());
// 0-9-1 is indistinguishable from 0-9 using only major and minor ... if we established the connection as 0-9-1
// and now get back major = 0 , minor = 9 then we can assume it means 0-9-1
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java Tue Jun 2 20:53:49 2015
@@ -118,8 +118,8 @@ public class AMQMessageDelegate_0_10 ext
if (destSyntax == AMQDestination.DestSyntax.BURL)
{
- dest = generateDestination(new AMQShortString(_deliveryProps.getExchange()),
- new AMQShortString(_deliveryProps.getRoutingKey()));
+ dest = generateDestination(_deliveryProps.getExchange(),
+ _deliveryProps.getRoutingKey());
}
else
{
@@ -277,7 +277,7 @@ public class AMQMessageDelegate_0_10 ext
if (AMQDestination.getDefaultDestSyntax() == AMQDestination.DestSyntax.BURL)
{
- dest = generateDestination(new AMQShortString(exchange), new AMQShortString(routingKey));
+ dest = generateDestination(exchange, routingKey);
}
else
{
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_8.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_8.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_8.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_8.java Tue Jun 2 20:53:49 2015
@@ -97,8 +97,8 @@ public class AMQMessageDelegate_0_8 exte
}
// Used when generating a received message object
- protected AMQMessageDelegate_0_8(long deliveryTag, BasicContentHeaderProperties contentHeader, AMQShortString exchange,
- AMQShortString routingKey, AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
+ protected AMQMessageDelegate_0_8(long deliveryTag, BasicContentHeaderProperties contentHeader, String exchange,
+ String routingKey, AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
AMQSession_0_8.DestinationCache<AMQTopic> topicDestinationCache,
int addressType)
{
@@ -144,8 +144,8 @@ public class AMQMessageDelegate_0_8 exte
{
type = addressType;
}
- dest = (AMQDestination) convertToAddressBasedDestination(AMQShortString.toString(exchange),
- AMQShortString.toString(routingKey), subject,
+ dest = (AMQDestination) convertToAddressBasedDestination(exchange,
+ routingKey, subject,
true, type);
}
setJMSDestination(dest);
@@ -228,7 +228,7 @@ public class AMQMessageDelegate_0_8 exte
messageIdBytes[37] = HEX_DIGITS[(int)((lsb >> 4) & 0xFl)];
messageIdBytes[38] = HEX_DIGITS[(int)(lsb & 0xFl)];
- return new AMQShortString(messageIdBytes,0,39);
+ return new AMQShortString(messageIdBytes);
}
public long getJMSTimestamp() throws JMSException
@@ -293,7 +293,7 @@ public class AMQMessageDelegate_0_8 exte
}
else
{
- if(getAMQSession().isQueueBound(AMQShortString.valueOf(replyToEncoding), null, null))
+ if(getAMQSession().isQueueBound(replyToEncoding, null, null))
{
dest = new NonBURLReplyToDestination(replyToEncoding, "");
}
@@ -329,7 +329,7 @@ public class AMQMessageDelegate_0_8 exte
final AMQDestination amqd = (AMQDestination) destination;
final AMQShortString encodedDestination = amqd.getEncodedName();
- _destinationCache.put(encodedDestination.asString(), destination);
+ _destinationCache.put(encodedDestination.toString(), destination);
getContentHeaderProperties().setReplyTo(encodedDestination);
}
@@ -637,10 +637,10 @@ public class AMQMessageDelegate_0_8 exte
public DefaultRouterDestination(final String replyToEncoding)
{
- super(AMQShortString.EMPTY_STRING,
- AMQShortString.valueOf("direct"),
- AMQShortString.valueOf(replyToEncoding),
- AMQShortString.valueOf(replyToEncoding));
+ super("",
+ "direct",
+ replyToEncoding,
+ replyToEncoding);
}
@Override
@@ -662,10 +662,10 @@ public class AMQMessageDelegate_0_8 exte
public NonBURLReplyToDestination(final String exchange, final String routingKey)
{
- super(AMQShortString.valueOf(exchange),
+ super(exchange,
null,
- AMQShortString.valueOf(routingKey),
- AMQShortString.valueOf(routingKey));
+ routingKey,
+ routingKey);
}
@Override
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java Tue Jun 2 20:53:49 2015
@@ -53,7 +53,7 @@ public abstract class AbstractAMQMessage
private static final Logger _logger = LoggerFactory.getLogger(AMQMessageDelegate.class);
private static Map<String, Integer> _exchangeTypeToDestinationType = new ConcurrentHashMap<String, Integer>();
- private static Map<String,ExchangeInfo> _exchangeMap = new ConcurrentHashMap<String, ExchangeInfo>();
+ private static Map<String,ExchangeInfo> _exchangeMap = new ConcurrentHashMap<>();
/**
* Add default Mappings for the Direct, Default, Topic and Fanout exchanges.
@@ -120,14 +120,22 @@ public abstract class AbstractAMQMessage
* @param routingKey The routing key to be used for the Destination
* @return AMQDestination of the correct subtype
*/
- protected AMQDestination generateDestination(AMQShortString exchange, AMQShortString routingKey)
+ protected AMQDestination generateDestination(String exchange, String routingKey)
{
AMQDestination dest;
- ExchangeInfo exchangeInfo = _exchangeMap.get(exchange.asString());
+ if(exchange == null)
+ {
+ exchange = ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
+ }
+ if(routingKey == null)
+ {
+ routingKey = "";
+ }
+ ExchangeInfo exchangeInfo = _exchangeMap.get(exchange);
if (exchangeInfo == null)
{
- exchangeInfo = new ExchangeInfo(exchange.asString(),"",AMQDestination.UNKNOWN_TYPE);
+ exchangeInfo = new ExchangeInfo(exchange,"",AMQDestination.UNKNOWN_TYPE);
}
if ("topic".equals(exchangeInfo.getExchangeType()))
@@ -141,13 +149,13 @@ public abstract class AbstractAMQMessage
else
{
dest = new AMQAnyDestination(exchange,
- new AMQShortString(exchangeInfo.getExchangeType()),
+ exchangeInfo.getExchangeType(),
routingKey,
false,
false,
routingKey,
false,
- new AMQShortString[] {routingKey});
+ new String[] {routingKey});
}
return dest;
@@ -276,14 +284,14 @@ public abstract class AbstractAMQMessage
useNodeTypeForDestinationType);
if (isQueue)
{
- dest.setQueueName(new AMQShortString(routingKey));
- dest.setRoutingKey(new AMQShortString(routingKey));
- dest.setExchangeName(new AMQShortString(""));
+ dest.setQueueName(routingKey);
+ dest.setRoutingKey(routingKey);
+ dest.setExchangeName("");
}
else
{
- dest.setRoutingKey(new AMQShortString(routingKey));
- dest.setExchangeName(new AMQShortString(exchange));
+ dest.setRoutingKey(routingKey);
+ dest.setExchangeName(exchange);
}
return dest;
}
@@ -295,7 +303,7 @@ public abstract class AbstractAMQMessage
_logger.error("Exception when constructing an address string from the ReplyTo struct");
// falling back to the old way of doing it to ensure the application continues.
- return generateDestination(new AMQShortString(exchange), new AMQShortString(routingKey));
+ return generateDestination(exchange, routingKey);
}
}
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java Tue Jun 2 20:53:49 2015
@@ -49,8 +49,8 @@ public abstract class AbstractJMSMessage
protected AbstractJMSMessage create08MessageWithBody(long messageNbr,
ContentHeaderBody contentHeader,
- AMQShortString exchange,
- AMQShortString routingKey,
+ String exchange,
+ String routingKey,
List bodies,
AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
AMQSession_0_8.DestinationCache<AMQTopic> topicDestinationCache,
@@ -168,7 +168,7 @@ public abstract class AbstractJMSMessage
@Override
public AbstractJMSMessage createMessage(long messageNbr, boolean redelivered, ContentHeaderBody contentHeader,
- AMQShortString exchange, AMQShortString routingKey, List bodies,
+ String exchange, String routingKey, List bodies,
AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
AMQSession_0_8.DestinationCache<AMQTopic> topicDestinationCache,
int addressType)
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactory.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactory.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactory.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactory.java Tue Jun 2 20:53:49 2015
@@ -39,8 +39,8 @@ public interface MessageFactory
AbstractJMSMessage createMessage(long deliveryTag,
boolean redelivered,
ContentHeaderBody contentHeader,
- AMQShortString exchange,
- AMQShortString routingKey,
+ String exchange,
+ String routingKey,
List bodies,
AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
AMQSession_0_8.DestinationCache<AMQTopic> topicDestinationCache,
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java Tue Jun 2 20:53:49 2015
@@ -107,8 +107,8 @@ public class MessageFactoryRegistry
*/
public AbstractJMSMessage createMessage(long deliveryTag,
boolean redelivered,
- AMQShortString exchange,
- AMQShortString routingKey,
+ String exchange,
+ String routingKey,
ContentHeaderBody contentHeader,
List bodies,
AMQSession_0_8.DestinationCache<AMQQueue> queueDestinationCache,
@@ -121,8 +121,7 @@ public class MessageFactoryRegistry
// Get the message content type. This may be null for pure AMQP messages, but will always be set for JMS over
// AMQP. When the type is null, it can only be assumed that the message is a byte message.
AMQShortString contentTypeShortString = properties.getContentType();
- contentTypeShortString = (contentTypeShortString == null) ? new AMQShortString(
- JMSBytesMessage.MIME_TYPE) : contentTypeShortString;
+ contentTypeShortString = (contentTypeShortString == null) ? new AMQShortString(JMSBytesMessage.MIME_TYPE) : contentTypeShortString;
MessageFactory mf = _mimeShortStringToFactoryMap.get(contentTypeShortString);
if (mf == null)
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java Tue Jun 2 20:53:49 2015
@@ -813,7 +813,7 @@ public class AMQProtocolHandler implemen
}
}
- public AMQShortString generateQueueName()
+ public String generateQueueName()
{
return _protocolSession.generateQueueName();
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java Tue Jun 2 20:53:49 2015
@@ -386,7 +386,7 @@ public class AMQProtocolSession implemen
return _protocolHandler.getSender();
}
- protected AMQShortString generateQueueName()
+ protected String generateQueueName()
{
int id;
synchronized (_queueIdLock)
@@ -396,7 +396,7 @@ public class AMQProtocolSession implemen
// convert '.', '/', ':' and ';' to single '_', for spec compliance and readability
String localAddress = _protocolHandler.getLocalAddress().toString().replaceAll("[./:;]", "_");
String queueName = "tmp_" + localAddress + "_" + id;
- return new AMQShortString(queueName.replaceAll("_+", "_"));
+ return queueName.replaceAll("_+", "_");
}
public void confirmConsumerCancelled(int channelId, AMQShortString consumerTag)
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/client/url/URLParser.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/client/url/URLParser.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/client/url/URLParser.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/client/url/URLParser.java Tue Jun 2 20:53:49 2015
@@ -227,22 +227,22 @@ public class URLParser
if (_url.getOptions().containsKey(AMQConnectionURL.OPTIONS_DEFAULT_TOPIC_EXCHANGE))
{
- _url.setDefaultTopicExchangeName(new AMQShortString(_url.getOptions().get(AMQConnectionURL.OPTIONS_DEFAULT_TOPIC_EXCHANGE)));
+ _url.setDefaultTopicExchangeName(_url.getOptions().get(AMQConnectionURL.OPTIONS_DEFAULT_TOPIC_EXCHANGE));
}
if (_url.getOptions().containsKey(AMQConnectionURL.OPTIONS_DEFAULT_QUEUE_EXCHANGE))
{
- _url.setDefaultQueueExchangeName(new AMQShortString(_url.getOptions().get(AMQConnectionURL.OPTIONS_DEFAULT_QUEUE_EXCHANGE)));
+ _url.setDefaultQueueExchangeName(_url.getOptions().get(AMQConnectionURL.OPTIONS_DEFAULT_QUEUE_EXCHANGE));
}
if (_url.getOptions().containsKey(AMQConnectionURL.OPTIONS_TEMPORARY_QUEUE_EXCHANGE))
{
- _url.setTemporaryQueueExchangeName(new AMQShortString(_url.getOptions().get(AMQConnectionURL.OPTIONS_TEMPORARY_QUEUE_EXCHANGE)));
+ _url.setTemporaryQueueExchangeName(_url.getOptions().get(AMQConnectionURL.OPTIONS_TEMPORARY_QUEUE_EXCHANGE));
}
if (_url.getOptions().containsKey(AMQConnectionURL.OPTIONS_TEMPORARY_TOPIC_EXCHANGE))
{
- _url.setTemporaryTopicExchangeName(new AMQShortString(_url.getOptions().get(AMQConnectionURL.OPTIONS_TEMPORARY_TOPIC_EXCHANGE)));
+ _url.setTemporaryTopicExchangeName(_url.getOptions().get(AMQConnectionURL.OPTIONS_TEMPORARY_TOPIC_EXCHANGE));
}
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/ConnectionURL.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/ConnectionURL.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/ConnectionURL.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/ConnectionURL.java Tue Jun 2 20:53:49 2015
@@ -21,7 +21,6 @@
package org.apache.qpid.jms;
import java.util.List;
-import org.apache.qpid.framing.AMQShortString;
/**
Connection URL format
@@ -31,23 +30,23 @@ import org.apache.qpid.framing.AMQShortS
*/
public interface ConnectionURL
{
- public static final String AMQ_PROTOCOL = "amqp";
- public static final String OPTIONS_SYNC_PERSISTENCE = "sync_persistence";
- public static final String OPTIONS_MAXPREFETCH = "maxprefetch";
- public static final String OPTIONS_SYNC_ACK = "sync_ack";
- public static final String OPTIONS_SYNC_PUBLISH = "sync_publish";
- public static final String OPTIONS_USE_LEGACY_MAP_MESSAGE_FORMAT = "use_legacy_map_msg_format";
- public static final String OPTIONS_USE_LEGACY_STREAM_MESSAGE_FORMAT = "use_legacy_stream_msg_format";
- public static final String OPTIONS_BROKERLIST = "brokerlist";
- public static final String OPTIONS_FAILOVER = "failover";
- public static final String OPTIONS_FAILOVER_CYCLE = "cyclecount";
+ String AMQ_PROTOCOL = "amqp";
+ String OPTIONS_SYNC_PERSISTENCE = "sync_persistence";
+ String OPTIONS_MAXPREFETCH = "maxprefetch";
+ String OPTIONS_SYNC_ACK = "sync_ack";
+ String OPTIONS_SYNC_PUBLISH = "sync_publish";
+ String OPTIONS_USE_LEGACY_MAP_MESSAGE_FORMAT = "use_legacy_map_msg_format";
+ String OPTIONS_USE_LEGACY_STREAM_MESSAGE_FORMAT = "use_legacy_stream_msg_format";
+ String OPTIONS_BROKERLIST = "brokerlist";
+ String OPTIONS_FAILOVER = "failover";
+ String OPTIONS_FAILOVER_CYCLE = "cyclecount";
/**
* This option is used to apply a connection level override of
* the {@value BrokerDetails#OPTIONS_SSL} option values in the
* {@value ConnectionURL#OPTIONS_BROKERLIST};
*/
- public static final String OPTIONS_SSL = "ssl";
+ String OPTIONS_SSL = "ssl";
/**
* This option is only applicable for 0-8/0-9/0-9-1 protocols connection
@@ -56,7 +55,7 @@ public interface ConnectionURL
* server .If this option is not specified, the messages won't be moved to
* the DLQ (or dropped) when delivery count exceeds the maximum.
*/
- public static final String OPTIONS_REJECT_BEHAVIOUR = "rejectbehaviour";
+ String OPTIONS_REJECT_BEHAVIOUR = "rejectbehaviour";
/**
* <p>
@@ -68,21 +67,21 @@ public interface ConnectionURL
* the message to the client as it normally would.
* </p>
*/
- public static final String OPTIONS_CLOSE_WHEN_NO_ROUTE = "closeWhenNoRoute";
+ String OPTIONS_CLOSE_WHEN_NO_ROUTE = "closeWhenNoRoute";
- public static final String OPTIONS_COMPRESS_MESSAGES = "compressMessages";
- public static final String OPTIONS_MESSAGES_COMPRESSION_THRESHOLD_SIZE = "messageCompressionThresholdSize";
+ String OPTIONS_COMPRESS_MESSAGES = "compressMessages";
+ String OPTIONS_MESSAGES_COMPRESSION_THRESHOLD_SIZE = "messageCompressionThresholdSize";
- public static final String OPTIONS_DEFAULT_TOPIC_EXCHANGE = "defaultTopicExchange";
- public static final String OPTIONS_DEFAULT_QUEUE_EXCHANGE = "defaultQueueExchange";
- public static final String OPTIONS_TEMPORARY_TOPIC_EXCHANGE = "temporaryTopicExchange";
- public static final String OPTIONS_TEMPORARY_QUEUE_EXCHANGE = "temporaryQueueExchange";
- public static final String OPTIONS_VERIFY_QUEUE_ON_SEND = "verifyQueueOnSend";
+ String OPTIONS_DEFAULT_TOPIC_EXCHANGE = "defaultTopicExchange";
+ String OPTIONS_DEFAULT_QUEUE_EXCHANGE = "defaultQueueExchange";
+ String OPTIONS_TEMPORARY_TOPIC_EXCHANGE = "temporaryTopicExchange";
+ String OPTIONS_TEMPORARY_QUEUE_EXCHANGE = "temporaryQueueExchange";
+ String OPTIONS_VERIFY_QUEUE_ON_SEND = "verifyQueueOnSend";
- public static final byte URL_0_8 = 1;
- public static final byte URL_0_10 = 2;
+ byte URL_0_8 = 1;
+ byte URL_0_10 = 2;
String getURL();
@@ -120,12 +119,12 @@ public interface ConnectionURL
void setOption(String key, String value);
- AMQShortString getDefaultQueueExchangeName();
+ String getDefaultQueueExchangeName();
- AMQShortString getDefaultTopicExchangeName();
+ String getDefaultTopicExchangeName();
- AMQShortString getTemporaryQueueExchangeName();
+ String getTemporaryQueueExchangeName();
- AMQShortString getTemporaryTopicExchangeName();
+ String getTemporaryTopicExchangeName();
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/Session.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/Session.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/Session.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/Session.java Tue Jun 2 20:53:49 2015
@@ -94,13 +94,13 @@ public interface Session extends TopicSe
MessageProducer createProducer(Destination destination, boolean immediate)
throws JMSException;
- AMQShortString getTemporaryTopicExchangeName();
+ String getTemporaryTopicExchangeName();
- AMQShortString getDefaultQueueExchangeName();
+ String getDefaultQueueExchangeName();
- AMQShortString getDefaultTopicExchangeName();
+ String getDefaultTopicExchangeName();
- AMQShortString getTemporaryQueueExchangeName();
+ String getTemporaryQueueExchangeName();
ListMessage createListMessage() throws JMSException;
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java Tue Jun 2 20:53:49 2015
@@ -97,11 +97,11 @@ public class FailoverExchangeMethod impl
{
_ssn = _conn.createSession(false,Session.AUTO_ACKNOWLEDGE);
MessageConsumer cons = _ssn.createConsumer(
- new AMQAnyDestination(new AMQShortString("amq.failover"),
- new AMQShortString("amq.failover"),
- new AMQShortString(""),
+ new AMQAnyDestination("amq.failover",
+ "amq.failover",
+ "",
true,true,null,false,
- new AMQShortString[0]));
+ new String[0]));
cons.setMessageListener(this);
}
}
Modified: qpid/java/trunk/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java (original)
+++ qpid/java/trunk/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java Tue Jun 2 20:53:49 2015
@@ -198,9 +198,9 @@ public class PropertiesFileInitialContex
{
StringBuffer b = new StringBuffer();
b.append("Creating the topic: " + jndiName + " with the following binding keys ");
- for (AMQShortString binding:((AMQTopic)t).getBindingKeys())
+ for (String binding:((AMQTopic)t).getBindingKeys())
{
- b.append(binding.toString()).append(",");
+ b.append(binding).append(",");
}
_logger.debug(b.toString());
@@ -254,13 +254,9 @@ public class PropertiesFileInitialContex
*/
protected Queue createQueue(Object value)
{
- if (value instanceof AMQShortString)
+ if (value instanceof String)
{
- return new AMQQueue(AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_NAME), (AMQShortString) value);
- }
- else if (value instanceof String)
- {
- return new AMQQueue(AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_NAME), new AMQShortString((String) value));
+ return new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, (String) value);
}
else if (value instanceof BindingURL)
{
@@ -275,23 +271,16 @@ public class PropertiesFileInitialContex
*/
protected Topic createTopic(Object value)
{
- if (value instanceof AMQShortString)
- {
- return new AMQTopic(AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_NAME), (AMQShortString) value);
- }
- else if (value instanceof String)
+ if (value instanceof String)
{
- String[] keys = ((String)value).split(",");
- AMQShortString[] bindings = new AMQShortString[keys.length];
- int i = 0;
- for (String key:keys)
+ String[] bindings = ((String)value).split(",");
+ for (int i = 0; i < bindings.length; i++)
{
- bindings[i] = new AMQShortString(key.trim());
- i++;
+ bindings[i] = bindings[i].trim();
}
// The Destination has a dual nature. If this was used for a producer the key is used
// for the routing key. If it was used for the consumer it becomes the bindingKey
- return new AMQTopic(AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_NAME),bindings[0],null,bindings);
+ return new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME,bindings[0],null,bindings);
}
else if (value instanceof BindingURL)
{
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java Tue Jun 2 20:53:49 2015
@@ -22,20 +22,12 @@ package org.apache.qpid.client;
import junit.framework.TestCase;
-import org.apache.qpid.framing.AMQShortString;
-
public class AMQQueueTest extends TestCase
{
- private AMQShortString exchange = new AMQShortString("test.exchange");
- private AMQShortString routingkey = new AMQShortString("test-route");
- private AMQShortString qname = new AMQShortString("test-queue");
- private AMQShortString[] oneBinding = new AMQShortString[]{new AMQShortString("bindingA")};
- private AMQShortString[] bindings = new AMQShortString[]{new AMQShortString("bindingB"),
- new AMQShortString("bindingC")};
public void testToURLNoBindings()
{
- AMQQueue dest = new AMQQueue(exchange, routingkey, qname);
+ AMQQueue dest = new AMQQueue("test.exchange", "test-route", "test-queue");
String url = dest.toURL();
assertEquals("direct://test.exchange/test-route/test-queue?routingkey='test-route'", url);
}
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java Tue Jun 2 20:53:49 2015
@@ -260,7 +260,7 @@ public class AMQSession_0_10Test extends
AMQSession_0_10 session = createAMQSession_0_10();
try
{
- session.sendQueueDelete(new AMQShortString("test"));
+ session.sendQueueDelete("test");
}
catch (Exception e)
{
@@ -279,7 +279,7 @@ public class AMQSession_0_10Test extends
{
BasicMessageConsumer_0_10 consumer = session.createMessageConsumer(createDestination(), 1, 1, true, false,
null, null, false, true);
- session.sendConsume(consumer, new AMQShortString("test"), true, 1);
+ session.sendConsume(consumer, "test", true, 1);
}
catch (Exception e)
{
@@ -462,8 +462,8 @@ public class AMQSession_0_10Test extends
AMQAnyDestination destination = null;
try
{
- destination = new AMQAnyDestination(new AMQShortString("amq.direct"), new AMQShortString("direct"),
- new AMQShortString("test"), false, true, new AMQShortString("test"), true, null);
+ destination = new AMQAnyDestination("amq.direct", "direct",
+ "test", false, true, "test", true, null);
}
catch (Exception e)
{
@@ -477,12 +477,11 @@ public class AMQSession_0_10Test extends
AMQQueue destination = null;
try
{
- destination = new AMQQueue(new AMQShortString("amq.direct"), new AMQShortString("test"),
- new AMQShortString("test"));
+ destination = new AMQQueue("amq.direct", "test", "test");
}
catch (Exception e)
{
- fail("Failued to create destination:" + e.getMessage());
+ fail("Failed to create destination:" + e.getMessage());
}
return destination;
}
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_8Test.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_8Test.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_8Test.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/client/AMQSession_0_8Test.java Tue Jun 2 20:53:49 2015
@@ -41,7 +41,7 @@ public class AMQSession_0_8Test extends
public void testQueueNameIsGeneratedOnDeclareQueueWithEmptyQueueName() throws Exception
{
- final AMQShortString testQueueName = AMQShortString.valueOf("tmp_127_0_0_1_1_1");
+ final String testQueueName = "tmp_127_0_0_1_1_1";
_connection.setConnectionListener(new ConnectionListenerSupport()
{
@@ -50,7 +50,7 @@ public class AMQSession_0_8Test extends
{
try
{
- _connection.getProtocolHandler().methodBodyReceived(1, new QueueDeclareOkBody(testQueueName, 0, 0));
+ _connection.getProtocolHandler().methodBodyReceived(1, new QueueDeclareOkBody(AMQShortString.valueOf(testQueueName), 0, 0));
}
catch (AMQException e)
{
@@ -64,7 +64,7 @@ public class AMQSession_0_8Test extends
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic//?routingkey='testTopic'");
AMQQueue queue = new AMQQueue(bindingURL);
- assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, queue.getAMQQueueName());
+ assertEquals("Unexpected queue name", "", queue.getAMQQueueName());
session.declareQueue(queue, true);
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java Tue Jun 2 20:53:49 2015
@@ -76,7 +76,7 @@ public class AMQProtocolHandlerTest exte
//Create a new ProtocolHandler with a fake connection.
_handler = new AMQProtocolHandler(new MockAMQConnection("amqp://guest:guest@client/test?brokerlist='tcp://localhost:1'"));
_handler.setNetworkConnection(new TestNetworkConnection());
- AMQBody body = new BasicRecoverSyncOkBody(ProtocolVersion.v8_0);
+ AMQBody body = new BasicRecoverSyncOkBody(ProtocolVersion.v0_8);
_blockFrame = new AMQFrame(0, body);
_handleCountDown = new CountDownLatch(1);
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java Tue Jun 2 20:53:49 2015
@@ -65,10 +65,10 @@ public class PropertiesFileInitialContex
Context ctx = prepareContext();
Topic topic = (Topic)ctx.lookup("MultipleTopicNamesWithSpace");
int i = 0;
- for (AMQShortString bindingKey: ((AMQDestination)topic).getBindingKeys())
+ for (String bindingKey: ((AMQDestination)topic).getBindingKeys())
{
i++;
- assertEquals("Topic" + i + "WithSpace",bindingKey.asString());
+ assertEquals("Topic" + i + "WithSpace", bindingKey);
}
}
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java Tue Jun 2 20:53:49 2015
@@ -453,13 +453,13 @@ public class ConnectionURLTest extends T
AMQConnectionURL conn = new AMQConnectionURL(url);
- assertEquals(conn.getDefaultQueueExchangeName().asString(),"test.direct");
+ assertEquals(conn.getDefaultQueueExchangeName().toString(),"test.direct");
- assertEquals(conn.getDefaultTopicExchangeName().asString(),"test.topic");
+ assertEquals(conn.getDefaultTopicExchangeName().toString(),"test.topic");
- assertEquals(conn.getTemporaryQueueExchangeName().asString(),"tmp.direct");
+ assertEquals(conn.getTemporaryQueueExchangeName().toString(),"tmp.direct");
- assertEquals(conn.getTemporaryTopicExchangeName().asString(),"tmp.topic");
+ assertEquals(conn.getTemporaryTopicExchangeName().toString(),"tmp.topic");
}
Modified: qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java (original)
+++ qpid/java/trunk/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java Tue Jun 2 20:53:49 2015
@@ -46,10 +46,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(dest.toString()));
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchange.Class"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(dest.getQueueName().equalsCharSequence("Queue"));
+ assertTrue(dest.getExchangeClass().toString().equals("exchange.Class"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(dest.getQueueName().toString().equals("Queue"));
}
public void testQueue() throws URISyntaxException
@@ -61,10 +64,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(dest.toString()));
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence(""));
- assertTrue(dest.getQueueName().equalsCharSequence("Queue"));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals(""));
+
+ assertTrue(dest.getQueueName().toString().equals("Queue"));
}
public void testQueueWithOption() throws URISyntaxException
@@ -76,10 +82,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(dest.toString()));
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence(""));
- assertTrue(dest.getQueueName().equalsCharSequence("Queue"));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals(""));
+
+ assertTrue(dest.getQueueName().toString().equals("Queue"));
assertTrue(dest.getOption("option").equals("value"));
}
@@ -93,10 +102,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(dest.toString()));
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(dest.getQueueName().equalsCharSequence(""));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(dest.getQueueName().toString().equals(""));
}
public void testDestinationWithOption() throws URISyntaxException
@@ -108,10 +120,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(dest.toString()));
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(dest.getQueueName().equalsCharSequence(""));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(dest.getQueueName().toString().equals(""));
assertTrue(dest.getOption("option").equals("value"));
}
@@ -123,10 +138,13 @@ public class DestinationURLTest extends
AMQBindingURL dest = new AMQBindingURL(url);
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(dest.getQueueName().equalsCharSequence(""));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(dest.getQueueName().toString().equals(""));
assertTrue(dest.getOption("option").equals("value"));
assertTrue(dest.getOption("option2").equals("value2"));
@@ -139,10 +157,13 @@ public class DestinationURLTest extends
AMQBindingURL dest = new AMQBindingURL(url);
- assertTrue(dest.getExchangeClass().equals(AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_CLASS)));
- assertTrue(dest.getExchangeName().equalsCharSequence(""));
- assertTrue(dest.getDestinationName().equalsCharSequence(""));
- assertTrue(dest.getQueueName().equalsCharSequence("IBMPerfQueue1"));
+ assertTrue(dest.getExchangeClass().equals(ExchangeDefaults.DIRECT_EXCHANGE_CLASS));
+
+ assertTrue(dest.getExchangeName().toString().equals(""));
+
+ assertTrue(dest.getDestinationName().toString().equals(""));
+
+ assertTrue(dest.getQueueName().toString().equals("IBMPerfQueue1"));
assertTrue(dest.getOption("durable").equals("true"));
}
@@ -154,10 +175,13 @@ public class DestinationURLTest extends
AMQBindingURL dest = new AMQBindingURL(url);
- assertTrue(dest.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(dest.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(dest.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(dest.getQueueName().equalsCharSequence(""));
+ assertTrue(dest.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(dest.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(dest.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(dest.getQueueName().toString().equals(""));
assertTrue(dest.getBindingKeys().length == 2);
}
@@ -309,10 +333,14 @@ public class DestinationURLTest extends
AMQBindingURL burl = new AMQBindingURL(url);
assertTrue(url.equals(burl.toString()));
- assertTrue(burl.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(burl.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(burl.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(burl.getQueueName().equalsCharSequence("Queue"));
+
+ assertTrue(burl.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(burl.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(burl.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(burl.getQueueName().toString().equals("Queue"));
//check that the MaxDeliveryCount property has the right value
assertEquals("server",burl.getOption(BindingURL.OPTION_REJECT_BEHAVIOUR));
@@ -342,10 +370,13 @@ public class DestinationURLTest extends
assertTrue(url.equals(burl.toString()));
- assertTrue(burl.getExchangeClass().equalsCharSequence("exchangeClass"));
- assertTrue(burl.getExchangeName().equalsCharSequence("exchangeName"));
- assertTrue(burl.getDestinationName().equalsCharSequence("Destination"));
- assertTrue(burl.getQueueName().equalsCharSequence("Queue"));
+ assertTrue(burl.getExchangeClass().toString().equals("exchangeClass"));
+
+ assertTrue(burl.getExchangeName().toString().equals("exchangeName"));
+
+ assertTrue(burl.getDestinationName().toString().equals("Destination"));
+
+ assertTrue(burl.getQueueName().toString().equals("Queue"));
class MyTestAMQDestination extends AMQDestination
{
@@ -366,41 +397,41 @@ public class DestinationURLTest extends
public void testBindingUrlWithoutDestinationAndQueueName() throws Exception
{
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic//?routingkey='testTopic'");
- assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName());
- assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName());
- assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey());
+ assertEquals("Unexpected queue name", "", bindingURL.getQueueName());
+ assertEquals("Unexpected destination", "", bindingURL.getDestinationName());
+ assertEquals("Unexpected routing key", "testTopic", bindingURL.getRoutingKey());
}
public void testBindingUrlWithoutDestinationAndMissedQueueName() throws Exception
{
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/?routingkey='testTopic'");
- assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName());
- assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName());
- assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey());
+ assertEquals("Unexpected queue name", "", bindingURL.getQueueName());
+ assertEquals("Unexpected destination", "", bindingURL.getDestinationName());
+ assertEquals("Unexpected routing key", "testTopic", bindingURL.getRoutingKey());
}
public void testBindingUrlWithoutQueueName() throws Exception
{
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/destination/?routingkey='testTopic'");
- assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName());
- assertEquals("Unexpected destination", AMQShortString.valueOf("destination"), bindingURL.getDestinationName());
- assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey());
+ assertEquals("Unexpected queue name", "", bindingURL.getQueueName());
+ assertEquals("Unexpected destination", "destination", bindingURL.getDestinationName());
+ assertEquals("Unexpected routing key", "testTopic", bindingURL.getRoutingKey());
}
public void testBindingUrlWithQueueNameWithoutDestination() throws Exception
{
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic//queueName?routingkey='testTopic'");
- assertEquals("Unexpected queue name", AMQShortString.valueOf("queueName"), bindingURL.getQueueName());
- assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName());
- assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey());
+ assertEquals("Unexpected queue name", "queueName", bindingURL.getQueueName());
+ assertEquals("Unexpected destination", "", bindingURL.getDestinationName());
+ assertEquals("Unexpected routing key", "testTopic", bindingURL.getRoutingKey());
}
public void testBindingUrlWithQueueNameAndDestination() throws Exception
{
AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/destination/queueName?routingkey='testTopic'");
- assertEquals("Unexpected queue name", AMQShortString.valueOf("queueName"), bindingURL.getQueueName());
- assertEquals("Unexpected destination", AMQShortString.valueOf("destination"), bindingURL.getDestinationName());
- assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey());
+ assertEquals("Unexpected queue name", "queueName", bindingURL.getQueueName());
+ assertEquals("Unexpected destination", "destination", bindingURL.getDestinationName());
+ assertEquals("Unexpected routing key", "testTopic", bindingURL.getRoutingKey());
}
public static junit.framework.Test suite()
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java Tue Jun 2 20:53:49 2015
@@ -69,7 +69,7 @@ public class ClientDecoder extends AMQDe
ConnectionRedirectBody.process(in, methodProcessor);
break;
case 0x000a0032:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
ConnectionRedirectBody.process(in, methodProcessor);
}
@@ -79,7 +79,7 @@ public class ClientDecoder extends AMQDe
}
break;
case 0x000a0033:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
throw newUnknownMethodException(classId, methodId,
methodProcessor.getProtocolVersion());
@@ -90,7 +90,7 @@ public class ClientDecoder extends AMQDe
}
break;
case 0x000a003c:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
ConnectionCloseBody.process(in, methodProcessor);
}
@@ -101,7 +101,7 @@ public class ClientDecoder extends AMQDe
}
break;
case 0x000a003d:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
methodProcessor.receiveConnectionCloseOk();
}
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java Tue Jun 2 20:53:49 2015
@@ -64,7 +64,7 @@ public class ServerDecoder extends AMQDe
ConnectionOpenBody.process(in, methodProcessor);
break;
case 0x000a0032:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
throw newUnknownMethodException(classId, methodId,
methodProcessor.getProtocolVersion());
@@ -75,7 +75,7 @@ public class ServerDecoder extends AMQDe
}
break;
case 0x000a0033:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
throw newUnknownMethodException(classId, methodId,
methodProcessor.getProtocolVersion());
@@ -86,7 +86,7 @@ public class ServerDecoder extends AMQDe
}
break;
case 0x000a003c:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
ConnectionCloseBody.process(in, methodProcessor);
}
@@ -97,7 +97,7 @@ public class ServerDecoder extends AMQDe
}
break;
case 0x000a003d:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
+ if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v0_8))
{
methodProcessor.receiveConnectionCloseOk();
}
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java Tue Jun 2 20:53:49 2015
@@ -34,7 +34,7 @@ public enum AMQPFilterTypes
REPLAY_PERIOD("x-qpid-replay-period");
/** The identifying string for the filter type. */
- private final AMQShortString _value;
+ private final String _value;
/**
* Creates a new filter type from its identifying string.
@@ -43,7 +43,7 @@ public enum AMQPFilterTypes
*/
AMQPFilterTypes(String value)
{
- _value = new AMQShortString(value);
+ _value = value;
}
/**
@@ -51,7 +51,7 @@ public enum AMQPFilterTypes
*
* @return The identifying string of the filter type.
*/
- public AMQShortString getValue()
+ public String getValue()
{
return _value;
}
@@ -59,6 +59,6 @@ public enum AMQPFilterTypes
@Override
public String toString()
{
- return _value.asString();
+ return _value;
}
}
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQShortString.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQShortString.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQShortString.java Tue Jun 2 20:53:49 2015
@@ -24,8 +24,8 @@ package org.apache.qpid.framing;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
-import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
* and thus can be held more effectively in a byte buffer.
*
*/
-public final class AMQShortString implements CharSequence, Comparable<AMQShortString>
+public final class AMQShortString implements Comparable<AMQShortString>
{
/**
* The maximum number of octets in AMQ short string as defined in AMQP specification
@@ -47,57 +47,6 @@ public final class AMQShortString implem
private static final byte MINUS = (byte)'-';
private static final byte ZERO = (byte) '0';
- private final class TokenizerImpl implements AMQShortStringTokenizer
- {
- private final byte _delim;
- private int _count = -1;
- private int _pos = 0;
-
- public TokenizerImpl(final byte delim)
- {
- _delim = delim;
- }
-
- public int countTokens()
- {
- if(_count == -1)
- {
- _count = 1 + AMQShortString.this.occurrences(_delim);
- }
- return _count;
- }
-
- public AMQShortString nextToken()
- {
- if(_pos <= AMQShortString.this.length())
- {
- int nextDelim = AMQShortString.this.indexOf(_delim, _pos);
- if(nextDelim == -1)
- {
- nextDelim = AMQShortString.this.length();
- }
-
- AMQShortString nextToken = AMQShortString.this.substring(_pos, nextDelim++);
- _pos = nextDelim;
- return nextToken;
- }
- else
- {
- return null;
- }
- }
-
- public boolean hasMoreTokens()
- {
- return _pos <= AMQShortString.this.length();
- }
- }
-
- private AMQShortString substring(final int from, final int to)
- {
- return new AMQShortString(_data, from+_offset, to-from);
- }
-
private static final ConcurrentMap<AMQShortString, AMQShortString> _globalInternMap =
new ConcurrentHashMap<AMQShortString, AMQShortString>();
@@ -128,68 +77,28 @@ public final class AMQShortString implem
_offset = 0;
}
- public AMQShortString(String data)
+ public AMQShortString(String string)
{
- this((data == null) ? EMPTY_CHAR_ARRAY : data.toCharArray());
- _asString = data;
- }
-
- public AMQShortString(char[] data)
- {
- if (data == null)
- {
- throw new NullPointerException("Cannot create AMQShortString with null char[]");
- }
- // the current implementation of 0.8/0.9.x short string encoding
- // supports only ASCII characters
+ final byte[] data = EncodingUtils.asUTF8Bytes(string);
+ final int length = data.length;
if (data.length> MAX_LENGTH)
{
throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
}
- final int length = data.length;
- final byte[] stringBytes = new byte[length];
- int hash = 0;
- for (int i = 0; i < length; i++)
- {
- stringBytes[i] = (byte) (0xFF & data[i]);
- hash = (31 * hash) + stringBytes[i];
- }
- _hashCode = hash;
- _data = stringBytes;
-
- _length = length;
- _offset = 0;
- }
-
- public AMQShortString(CharSequence charSequence)
- {
- if (charSequence == null)
- {
- // it should be possible to create short string for null data
- charSequence = "";
- }
- // the current implementation of 0.8/0.9.x short string encoding
- // supports only ASCII characters
- if (charSequence.length() > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- final int length = charSequence.length();
- final byte[] stringBytes = new byte[length];
int hash = 0;
for (int i = 0; i < length; i++)
{
- stringBytes[i] = ((byte) (0xFF & charSequence.charAt(i)));
- hash = (31 * hash) + stringBytes[i];
-
+ data[i] = (byte) (0xFF & data[i]);
+ hash = (31 * hash) + data[i];
}
-
- _data = stringBytes;
_hashCode = hash;
+ _data = data;
+
_length = length;
_offset = 0;
+ _asString = string == null ? "" : string;
}
private AMQShortString(DataInput data, final int length) throws IOException
@@ -222,18 +131,6 @@ public final class AMQShortString implem
_data = data;
}
- public AMQShortString shrink()
- {
- if(_data.length != _length)
- {
- return copy();
- }
- else
- {
- return this;
- }
- }
-
/**
* Get the length of the short string
* @return length of the underlying byte array
@@ -250,11 +147,6 @@ public final class AMQShortString implem
}
- public CharSequence subSequence(int start, int end)
- {
- return new CharSubSequence(start, end);
- }
-
public static AMQShortString readFromBuffer(DataInput buffer) throws IOException
{
final int length = buffer.readUnsignedByte();
@@ -292,148 +184,6 @@ public final class AMQShortString implem
}
- public boolean endsWith(String s)
- {
- return endsWith(new AMQShortString(s));
- }
-
-
- public boolean endsWith(AMQShortString otherString)
- {
-
- if (otherString.length() > length())
- {
- return false;
- }
-
-
- int thisLength = length();
- int otherLength = otherString.length();
-
- for (int i = 1; i <= otherLength; i++)
- {
- if (charAt(thisLength - i) != otherString.charAt(otherLength - i))
- {
- return false;
- }
- }
- return true;
- }
-
- public boolean startsWith(String s)
- {
- return startsWith(new AMQShortString(s));
- }
-
- public boolean startsWith(AMQShortString otherString)
- {
-
- if (otherString.length() > length())
- {
- return false;
- }
-
- for (int i = 0; i < otherString.length(); i++)
- {
- if (charAt(i) != otherString.charAt(i))
- {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean startsWith(CharSequence otherString)
- {
- if (otherString.length() > length())
- {
- return false;
- }
-
- for (int i = 0; i < otherString.length(); i++)
- {
- if (charAt(i) != otherString.charAt(i))
- {
- return false;
- }
- }
-
- return true;
- }
-
-
- private final class CharSubSequence implements CharSequence
- {
- private final int _sequenceOffset;
- private final int _end;
-
- public CharSubSequence(final int offset, final int end)
- {
- _sequenceOffset = offset;
- _end = end;
- }
-
- public int length()
- {
- return _end - _sequenceOffset;
- }
-
- public char charAt(int index)
- {
- return AMQShortString.this.charAt(index + _sequenceOffset);
- }
-
- public CharSequence subSequence(int start, int end)
- {
- return new CharSubSequence(start + _sequenceOffset, end + _sequenceOffset);
- }
-
- @Override
- public String toString()
- {
- char[] chars = new char[length()];
- for(int i = 0; i < length(); i++)
- {
- chars[i] = charAt(i);
- }
- return new String(chars);
- }
- }
-
- public char[] asChars()
- {
- final int size = length();
- final char[] chars = new char[size];
-
- for (int i = 0; i < size; i++)
- {
- chars[i] = (char) _data[i + _offset];
- }
-
- return chars;
- }
-
-
- public String asString()
- {
- if (_asString == null)
- {
- AMQShortString intern = intern(false);
-
- if(intern == this)
- {
- _asString = new String(asChars());
- }
- else
- {
- _asString = intern.asString();
- }
-
- }
- return _asString;
- }
public boolean equals(Object o)
{
@@ -510,34 +260,6 @@ public final class AMQShortString implem
}
- public boolean equalsCharSequence(CharSequence s)
- {
- if(s instanceof AMQShortString)
- {
- return equals((AMQShortString) s);
- }
-
- if (s == null)
- {
- return false;
- }
-
- if (s.length() != length())
- {
- return false;
- }
-
- for (int i = 0; i < length(); i++)
- {
- if (charAt(i) != s.charAt(i))
- {
- return false;
- }
- }
-
- return true;
- }
-
public int hashCode()
{
int hash = _hashCode;
@@ -556,14 +278,23 @@ public final class AMQShortString implem
return hash;
}
- public void setDirty()
- {
- _hashCode = 0;
- }
-
public String toString()
{
- return asString();
+ if (_asString == null)
+ {
+ AMQShortString intern = intern(false);
+
+ if(intern == this)
+ {
+ _asString = new String(_data, _offset, _length, StandardCharsets.UTF_8);
+ }
+ else
+ {
+ _asString = intern.toString();
+ }
+
+ }
+ return _asString;
}
public int compareTo(AMQShortString name)
@@ -603,13 +334,6 @@ public final class AMQShortString implem
}
}
-
- public AMQShortStringTokenizer tokenize(byte delim)
- {
- return new TokenizerImpl(delim);
- }
-
-
public AMQShortString intern()
{
return intern(true);
@@ -624,83 +348,6 @@ public final class AMQShortString implem
}
- private AMQShortString copy()
- {
- byte[] dataBytes = new byte[_length];
- System.arraycopy(_data,_offset,dataBytes,0,_length);
- return new AMQShortString(dataBytes,0,_length);
- }
-
- private int occurrences(final byte delim)
- {
- int count = 0;
- final int end = _offset + _length;
- for(int i = _offset ; i < end ; i++ )
- {
- if(_data[i] == delim)
- {
- count++;
- }
- }
- return count;
- }
-
- private int indexOf(final byte val, final int pos)
- {
-
- for(int i = pos; i < length(); i++)
- {
- if(_data[_offset+i] == val)
- {
- return i;
- }
- }
- return -1;
- }
-
-
- public static AMQShortString join(final Collection<AMQShortString> terms,
- final AMQShortString delim)
- {
- if(terms.size() == 0)
- {
- return EMPTY_STRING;
- }
-
- int size = delim.length() * (terms.size() - 1);
- for(AMQShortString term : terms)
- {
- size += term.length();
- }
-
- if (size > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- byte[] data = new byte[size];
- int pos = 0;
- final byte[] delimData = delim._data;
- final int delimOffset = delim._offset;
- final int delimLength = delim._length;
-
-
- for(AMQShortString term : terms)
- {
-
- if(pos!=0)
- {
- System.arraycopy(delimData, delimOffset,data,pos, delimLength);
- pos+=delimLength;
- }
- System.arraycopy(term._data,term._offset,data,pos,term._length);
- pos+=term._length;
- }
-
-
-
- return new AMQShortString(data,0,size);
- }
-
public int toIntValue()
{
int pos = _offset;
@@ -742,7 +389,7 @@ public final class AMQShortString implem
return true;
}
}
- return false; //To change body of created methods use File | Settings | File Templates.
+ return false;
}
public static AMQShortString validValueOf(Object obj)
@@ -763,11 +410,19 @@ public final class AMQShortString implem
else
{
String value = String.valueOf(obj);
- if (truncate && value.length() > AMQShortString.MAX_LENGTH)
+ int strLength = Math.min(value.length(), AMQShortString.MAX_LENGTH);
+
+ byte[] bytes = EncodingUtils.asUTF8Bytes(value);
+ if(truncate)
{
- value = value.substring(0, AMQShortString.MAX_LENGTH - 3) + "...";
+ while (bytes.length > AMQShortString.MAX_LENGTH)
+ {
+ value = value.substring(0, strLength-- - 3) + "...";
+ bytes = EncodingUtils.asUTF8Bytes(value);
+ }
+
}
- return valueOf(value);
+ return new AMQShortString(bytes);
}
}
@@ -791,7 +446,7 @@ public final class AMQShortString implem
public static String toString(AMQShortString amqShortString)
{
- return amqShortString == null ? null : amqShortString.asString();
+ return amqShortString == null ? null : amqShortString.toString();
}
}
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java Tue Jun 2 20:53:49 2015
@@ -307,7 +307,7 @@ public abstract class AMQTypedValue
}
else if(val instanceof Map)
{
- return AMQType.FIELD_TABLE.asTypedValue(FieldTable.convertToFieldTable((Map)val));
+ return AMQType.FIELD_TABLE.asTypedValue(FieldTable.convertToFieldTable((Map<String,Object>)val));
}
else if(klass == FieldTable.class)
{
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java Tue Jun 2 20:53:49 2015
@@ -282,7 +282,7 @@ public class BasicContentHeaderPropertie
}
else
{
- EncodingUtils.writeShortStringBytes(buffer, String.valueOf(_expiration));
+ EncodingUtils.writeLongAsShortString(buffer, _expiration);
}
}
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java Tue Jun 2 20:53:49 2015
@@ -105,7 +105,7 @@ public class BasicRecoverBody extends AM
final ServerChannelMethodProcessor dispatcher) throws IOException
{
boolean requeue = (in.readByte() & 0x01) == 0x01;
- boolean sync = (ProtocolVersion.v8_0.equals(protocolVersion));
+ boolean sync = (ProtocolVersion.v0_8.equals(protocolVersion));
if(!dispatcher.ignoreAllButCloseOk())
{
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java?rev=1683186&r1=1683185&r2=1683186&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java Tue Jun 2 20:53:49 2015
@@ -45,7 +45,7 @@ public class ChannelOpenOkBody extends A
public static ChannelOpenOkBody getInstance(ProtocolVersion protocolVersion, MarkableDataInput input)
throws IOException
{
- final boolean isAMQP08 = ProtocolVersion.v8_0.equals(protocolVersion);
+ final boolean isAMQP08 = ProtocolVersion.v0_8.equals(protocolVersion);
ChannelOpenOkBody instance = isAMQP08 ? INSTANCE_0_8 : INSTANCE_0_9;
if(!isAMQP08)
{
@@ -100,7 +100,7 @@ public class ChannelOpenOkBody extends A
final ProtocolVersion protocolVersion,
final ClientChannelMethodProcessor dispatcher) throws IOException
{
- if(!ProtocolVersion.v8_0.equals(protocolVersion))
+ if(!ProtocolVersion.v0_8.equals(protocolVersion))
{
EncodingUtils.readBytes(in);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org