[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-commits
Subject: svn commit: r1344894 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/sto
From: tabish () apache ! org
Date: 2012-05-31 20:26:29
Message-ID: 20120531202629.48F0223889BF () eris ! apache ! org
[Download RAW message or body]
Author: tabish
Date: Thu May 31 20:26:28 2012
New Revision: 1344894
URL: http://svn.apache.org/viewvc?rev=1344894&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3836
Make a best effort to find the correct destination name even if space padded before \
falling back to the fallback conversion config.
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apach \
e/activemq/transport/stomp/LegacyFrameTranslator.java?rev=1344894&r1=1344893&r2=1344894&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java \
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java \
Thu May 31 20:26:28 2012 @@ -54,7 +54,6 @@ public class LegacyFrameTranslator imple
if(intendedType.equalsIgnoreCase("text")){
ActiveMQTextMessage text = new ActiveMQTextMessage();
try {
- //text.setText(new String(command.getContent(), "UTF-8"));
ByteArrayOutputStream bytes = new \
ByteArrayOutputStream(command.getContent().length + 4); DataOutputStream data = new \
DataOutputStream(bytes); data.writeInt(command.getContent().length);
@@ -79,7 +78,6 @@ public class LegacyFrameTranslator imple
} else {
ActiveMQTextMessage text = new ActiveMQTextMessage();
try {
- //text.setText(new String(command.getContent(), "UTF-8"));
ByteArrayOutputStream bytes = new \
ByteArrayOutputStream(command.getContent().length + 4); DataOutputStream data = new \
DataOutputStream(bytes); data.writeInt(command.getContent().length);
@@ -173,7 +171,14 @@ public class LegacyFrameTranslator imple
public ActiveMQDestination convertDestination(ProtocolConverter converter, \
String name, boolean forceFallback) throws ProtocolException { if (name == null) {
return null;
- } else if (name.startsWith("/queue/")) {
+ }
+
+ // in case of space padding by a client we trim for the initial detection, \
on fallback use + // the un-trimmed value.
+ String originalName = name;
+ name = name.trim();
+
+ if (name.startsWith("/queue/")) {
String qName = name.substring("/queue/".length(), name.length());
return ActiveMQDestination.createDestination(qName, \
ActiveMQDestination.QUEUE_TYPE); } else if (name.startsWith("/topic/")) {
@@ -192,16 +197,16 @@ public class LegacyFrameTranslator imple
} else {
if (forceFallback) {
try {
- ActiveMQDestination fallback = \
ActiveMQDestination.getUnresolvableDestinationTransformer().transform(name); + \
ActiveMQDestination fallback = \
ActiveMQDestination.getUnresolvableDestinationTransformer().transform(originalName); \
if (fallback != null) { return fallback;
}
} catch (JMSException e) {
- throw new ProtocolException("Illegal destination name: [" + name \
+ "] -- ActiveMQ STOMP destinations " + throw new \
ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP \
destinations "
+ "must begin with one of: /queue/ /topic/ /temp-queue/ \
/temp-topic/", false, e); }
}
- throw new ProtocolException("Illegal destination name: [" + name + "] -- \
ActiveMQ STOMP destinations " + throw new ProtocolException("Illegal \
destination name: [" + originalName + "] -- ActiveMQ STOMP \
destinations "
+ "must begin with one of: /queue/ /topic/ \
/temp-queue/ /temp-topic/"); }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic