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 2014/08/15 00:46:14 UTC
svn commit: r1618077 - in
/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client:
AMQSession_0_8.java BasicMessageProducer_0_8.java
UnsupportedAddressSyntaxException.java
Author: rgodfrey
Date: Thu Aug 14 22:46:14 2014
New Revision: 1618077
URL: http://svn.apache.org/r1618077
Log:
QPID-6001 : [Java Client] Prevent NPE when publishing using ADDR destination to Broker using AMQP 0-9-1 or lower
Added:
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java
Modified:
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java?rev=1618077&r1=1618076&r2=1618077&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java Thu Aug 14 22:46:14 2014
@@ -26,6 +26,14 @@ import static org.apache.qpid.configurat
import static org.apache.qpid.configuration.ClientProperties.QPID_FLOW_CONTROL_WAIT_FAILURE;
import static org.apache.qpid.configuration.ClientProperties.QPID_FLOW_CONTROL_WAIT_NOTIFY_PERIOD;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,13 +60,6 @@ import org.apache.qpid.protocol.AMQConst
import org.apache.qpid.protocol.AMQMethodEvent;
import org.apache.qpid.transport.TransportException;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMessageProducer_0_8>
{
/** Used for debugging. */
@@ -736,14 +737,9 @@ public class AMQSession_0_8 extends AMQS
boolean isConsumer,
boolean noLocal) throws AMQException
{
- throwUnsupportedAddressingSyntax();
+ throw new UnsupportedAddressSyntaxException(dest);
}
- void throwUnsupportedAddressingSyntax()
- {
- throw new UnsupportedOperationException("The new addressing based syntax is "
- + "not supported for AMQP 0-8/0-9/0-9-1 versions");
- }
protected void flushAcknowledgments()
{
Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java?rev=1618077&r1=1618076&r2=1618077&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java Thu Aug 14 22:46:14 2014
@@ -20,6 +20,17 @@
*/
package org.apache.qpid.client;
+import java.nio.ByteBuffer;
+import java.util.UUID;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.qpid.AMQException;
import org.apache.qpid.client.message.AMQMessageDelegate_0_8;
import org.apache.qpid.client.message.AbstractJMSMessage;
@@ -33,16 +44,6 @@ import org.apache.qpid.framing.ContentBo
import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.ExchangeDeclareBody;
import org.apache.qpid.framing.MethodRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import java.nio.ByteBuffer;
-import java.util.UUID;
public class BasicMessageProducer_0_8 extends BasicMessageProducer
{
@@ -60,7 +61,7 @@ public class BasicMessageProducer_0_8 ex
if (destination.getDestSyntax() == AMQDestination.DestSyntax.ADDR)
{
- getSession().throwUnsupportedAddressingSyntax();
+ throw new UnsupportedAddressSyntaxException(destination);
}
if(getSession().isDeclareExchanges())
Added: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java?rev=1618077&view=auto
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java (added)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java Thu Aug 14 22:46:14 2014
@@ -0,0 +1,32 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.client;
+
+class UnsupportedAddressSyntaxException extends UnsupportedOperationException
+{
+ UnsupportedAddressSyntaxException(final AMQDestination dest)
+ {
+ super("The address '" + dest.toString() + "' uses the " + AMQDestination.DestSyntax.ADDR + " addressing syntax"
+ + " which is not supported for AMQP 0-8/0-9/0-9-1 connections. Use the " + AMQDestination.DestSyntax.BURL
+ + " syntax instead:\n"
+ + "\tBURL:<Exchange Class>://<Exchange Name>/[<Destination>]/[<Queue>][?<option>='<value>'[&<option>='<value>']]\n");
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org