summaryrefslogtreecommitdiff
path: root/qpid/java/client/src/main
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2013-05-09 14:19:18 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2013-05-09 14:19:18 +0000
commit438323043a46489c85d849a0ac0f47e8bf2efb60 (patch)
treee187fd9c08c02af66cc302a2fab8aa8571a7678a /qpid/java/client/src/main
parent33112e20aee3941ad36e3e2350e80ad78f9ba6d2 (diff)
downloadqpid-python-438323043a46489c85d849a0ac0f47e8bf2efb60.tar.gz
QPID-3838 If stric-jms flag is used qpid.subject is prefixed with "JMS_"
to ensure we are in compliance with the JMS spec. Without this fix we fail the JEE TCK. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1480656 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/main')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
index 41dcba0f10..ef92a9281e 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQPInvalidClassException;
import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQDestination.DestSyntax;
import org.apache.qpid.client.AMQSession_0_10;
import org.apache.qpid.client.CustomJMSXProperty;
import org.apache.qpid.framing.AMQShortString;
@@ -92,6 +93,7 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
private MessageProperties _messageProps;
private DeliveryProperties _deliveryProps;
private String _messageID;
+ private boolean isStrictJMS = Boolean.getBoolean("strict-jms");
protected AMQMessageDelegate_0_10()
{
@@ -101,6 +103,11 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
protected AMQMessageDelegate_0_10(MessageProperties messageProps, DeliveryProperties deliveryProps, long deliveryTag)
{
+ this(AMQDestination.getDefaultDestSyntax(),messageProps,deliveryProps,deliveryTag);
+ }
+
+ protected AMQMessageDelegate_0_10(DestSyntax destSyntax,MessageProperties messageProps, DeliveryProperties deliveryProps, long deliveryTag)
+ {
super(deliveryTag);
_messageProps = messageProps;
_deliveryProps = deliveryProps;
@@ -108,7 +115,7 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
AMQDestination dest;
- if (AMQDestination.getDefaultDestSyntax() == AMQDestination.DestSyntax.BURL)
+ if (destSyntax == AMQDestination.DestSyntax.BURL)
{
dest = generateDestination(new AMQShortString(_deliveryProps.getExchange()),
new AMQShortString(_deliveryProps.getRoutingKey()));
@@ -116,9 +123,15 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
else
{
String subject = null;
- if (messageProps != null && messageProps.getApplicationHeaders() != null)
+ if (isStrictJMS && messageProps != null && messageProps.getApplicationHeaders() != null)
{
+ System.out.println("%%%% Going to set subject");
subject = (String)messageProps.getApplicationHeaders().get(QpidMessageProperties.QPID_SUBJECT);
+ if (subject != null)
+ {
+ messageProps.getApplicationHeaders().remove(QpidMessageProperties.QPID_SUBJECT);
+ messageProps.getApplicationHeaders().put("JMS_" + QpidMessageProperties.QPID_SUBJECT,subject);
+ }
}
dest = (AMQDestination) convertToAddressBasedDestination(_deliveryProps.getExchange(),
_deliveryProps.getRoutingKey(), subject);
@@ -732,6 +745,10 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
{
return _deliveryProps.getRoutingKey();
}
+ else if (isStrictJMS && QpidMessageProperties.QPID_SUBJECT.equals(propertyName))
+ {
+ return (String)getApplicationHeaders().get("JMS_" + QpidMessageProperties.QPID_SUBJECT);
+ }
else
{
checkPropertyName(propertyName);
@@ -976,7 +993,7 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
// JMSType. JMSMessageID, JMSCorrelationID, and JMSType values may be
// null and if so are treated as a NULL value.
- if (Boolean.getBoolean("strict-jms"))
+ if (isStrictJMS)
{
// JMS start character
if (!(Character.isJavaIdentifierStart(propertyName.charAt(0))))