You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2009/03/31 19:08:22 UTC

svn commit: r760527 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs

Author: jgomes
Date: Tue Mar 31 17:08:21 2009
New Revision: 760527

URL: http://svn.apache.org/viewvc?rev=760527&view=rev
Log:
Added destination checking when sending a message.  Informative exceptions will be thrown if the destination is invalid.
Fixes [AMQNET-143]. (See https://issues.apache.org/activemq/browse/AMQNET-143)

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs?rev=760527&r1=760526&r2=760527&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs Tue Mar 31 17:08:21 2009
@@ -137,6 +137,19 @@
 
 		protected void Send(IDestination destination, IMessage message, bool persistent, byte priority, TimeSpan timeToLive, bool specifiedTimeToLive)
 		{
+			if(null == destination)
+			{
+				// See if this producer was created without a destination.
+				if(null == info.Destination)
+				{
+					throw new NotSupportedException();
+				}
+
+				// The producer was created with a destination, but an invalid destination
+				// was specified.
+				throw new Apache.NMS.InvalidDestinationException();
+			}
+
 			CheckClosed();
 			ActiveMQMessage activeMessage = (ActiveMQMessage) message;