activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r882749 - in /activemq/activemq-dotnet/Apache.NMS.EMS/trunk: ./ src/main/csharp/
Date Fri, 20 Nov 2009 22:42:49 GMT
Author: jgomes
Date: Fri Nov 20 22:42:44 2009
New Revision: 882749

URL: http://svn.apache.org/viewvc?rev=882749&view=rev
Log:
Added exception wrapping and re-throwing to embed provider specific exceptions inside NMS exceptions.
Fixes [AMQNET-148]. (See https://issues.apache.org/activemq/browse/AMQNET-148)

Added:
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ExceptionUtil.cs
Modified:
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProducer.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Session.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/StreamMessage.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/TextMessage.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs Fri Nov 20 22:42:44 2009
@@ -20,19 +20,19 @@
 
 namespace Apache.NMS.EMS
 {
-    /// <summary>
-    /// Represents a NMS connection to TIBCO.
-    /// </summary>
-    ///
-    public class Connection : Apache.NMS.IConnection
-    {
-    	private Apache.NMS.AcknowledgementMode acknowledgementMode;
-    	public readonly TIBCO.EMS.Connection tibcoConnection;
+	/// <summary>
+	/// Represents a NMS connection to TIBCO.
+	/// </summary>
+	///
+	public class Connection : Apache.NMS.IConnection
+	{
+		private Apache.NMS.AcknowledgementMode acknowledgementMode;
+		public readonly TIBCO.EMS.Connection tibcoConnection;
 		private IRedeliveryPolicy redeliveryPolicy;
 		private ConnectionMetaData metaData = null;
 		private readonly Atomic<bool> started = new Atomic<bool>(false);
 		private bool closed = false;
-    	private bool disposed = false;
+		private bool disposed = false;
 
 		public Connection(TIBCO.EMS.Connection cnx)
 		{
@@ -45,16 +45,23 @@
 			Dispose(false);
 		}
 
-    	#region IStartable Members
+		#region IStartable Members
 
 		/// <summary>
-        /// Starts message delivery for this connection.
-        /// </summary>
-        public void Start()
-        {
+		/// Starts message delivery for this connection.
+		/// </summary>
+		public void Start()
+		{
 			if(started.CompareAndSet(false, true))
 			{
-				this.tibcoConnection.Start();
+				try
+				{
+					this.tibcoConnection.Start();
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
 			}
 		}
 
@@ -68,13 +75,20 @@
 		#region IStoppable Members
 
 		/// <summary>
-        /// Stop message delivery for this connection.
-        /// </summary>
-        public void Stop()
-        {
-			if(started.CompareAndSet(true, false))
+		/// Stop message delivery for this connection.
+		/// </summary>
+		public void Stop()
+		{
+			try
+			{
+				if(started.CompareAndSet(true, false))
+				{
+					this.tibcoConnection.Stop();
+				}
+			}
+			catch(Exception ex)
 			{
-	            this.tibcoConnection.Stop();
+				ExceptionUtil.WrapAndThrowNMSException(ex);
 			}
 		}
 
@@ -83,21 +97,29 @@
 		#region IConnection Members
 
 		/// <summary>
-        /// Creates a new session to work on this connection
-        /// </summary>
+		/// Creates a new session to work on this connection
+		/// </summary>
 		public Apache.NMS.ISession CreateSession()
-        {
-            return CreateSession(acknowledgementMode);
-        }
-        
-        /// <summary>
-        /// Creates a new session to work on this connection
-        /// </summary>
+		{
+			return CreateSession(acknowledgementMode);
+		}
+
+		/// <summary>
+		/// Creates a new session to work on this connection
+		/// </summary>
 		public Apache.NMS.ISession CreateSession(Apache.NMS.AcknowledgementMode mode)
-        {
-			bool isTransacted = (Apache.NMS.AcknowledgementMode.Transactional == mode);
-			return EMSConvert.ToNMSSession(this.tibcoConnection.CreateSession(isTransacted,
-			                                                  EMSConvert.ToSessionMode(mode)));
+		{
+			try
+			{
+				bool isTransacted = (Apache.NMS.AcknowledgementMode.Transactional == mode);
+				return EMSConvert.ToNMSSession(this.tibcoConnection.CreateSession(isTransacted,
+																  EMSConvert.ToSessionMode(mode)));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void Close()
@@ -109,10 +131,20 @@
 					return;
 				}
 
-				this.tibcoConnection.ExceptionHandler -= this.HandleTibcoException;
-				this.tibcoConnection.Stop();
-				this.tibcoConnection.Close();
-				closed = true;
+				try
+				{
+					this.tibcoConnection.ExceptionHandler -= this.HandleTibcoException;
+					this.tibcoConnection.Stop();
+					this.tibcoConnection.Close();
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+				finally
+				{
+					closed = true;
+				}
 			}
 		}
 
@@ -121,7 +153,7 @@
 		#region IDisposable Members
 
 		public void Dispose()
-        {
+		{
 			Dispose(true);
 			GC.SuppressFinalize(this);
 		}
@@ -164,16 +196,37 @@
 		}
 
 		public Apache.NMS.AcknowledgementMode AcknowledgementMode
-        {
-            get { return acknowledgementMode; }
-            set { acknowledgementMode = value; }
-        }
-
-        public string ClientId
-        {
-            get { return this.tibcoConnection.ClientID; }
-            set { this.tibcoConnection.ClientID = value; }
-        }
+		{
+			get { return acknowledgementMode; }
+			set { acknowledgementMode = value; }
+		}
+
+		public string ClientId
+		{
+			get
+			{
+				try
+				{
+					return this.tibcoConnection.ClientID;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+					return null;
+				}
+			}
+			set
+			{
+				try
+				{
+					this.tibcoConnection.ClientID = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
+		}
 
 		/// <summary>
 		/// Get/or set the redelivery policy for this connection.

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionFactory.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionFactory.cs Fri Nov 20 22:42:44 2009
@@ -42,6 +42,7 @@
 			catch(Exception ex)
 			{
 				Apache.NMS.Tracer.DebugFormat("Exception instantiating TIBCO.EMS.ConnectionFactory: {0}", ex.Message);
+				ExceptionUtil.WrapAndThrowNMSException(ex);
 			}
 
 			VerifyConnectionFactory();
@@ -67,6 +68,7 @@
 			catch(Exception ex)
 			{
 				Apache.NMS.Tracer.DebugFormat("Exception instantiating TIBCO.EMS.ConnectionFactory: {0}", ex.Message);
+				ExceptionUtil.WrapAndThrowNMSException(ex);
 			}
 
 			VerifyConnectionFactory();
@@ -83,6 +85,7 @@
 			catch(Exception ex)
 			{
 				Apache.NMS.Tracer.DebugFormat("Exception instantiating TIBCO.EMS.ConnectionFactory: {0}", ex.Message);
+				ExceptionUtil.WrapAndThrowNMSException(ex);
 			}
 
 			VerifyConnectionFactory();
@@ -100,6 +103,7 @@
 			catch(Exception ex)
 			{
 				Apache.NMS.Tracer.DebugFormat("Exception instantiating TIBCO.EMS.ConnectionFactory: {0}", ex.Message);
+				ExceptionUtil.WrapAndThrowNMSException(ex);
 			}
 
 			VerifyConnectionFactory();
@@ -120,8 +124,18 @@
 		/// </summary>
 		public Apache.NMS.IConnection CreateConnection()
 		{
-			Apache.NMS.IConnection connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection());
-			connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
+			Apache.NMS.IConnection connection = null;
+
+			try
+			{
+				connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection());
+				connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+
 			return connection;
 		}
 
@@ -130,8 +144,18 @@
 		/// </summary>
 		public Apache.NMS.IConnection CreateConnection(string userName, string password)
 		{
-			Apache.NMS.IConnection connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection(userName, password));
-			connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
+			Apache.NMS.IConnection connection = null;
+
+			try
+			{
+				connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection(userName, password));
+				connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+
 			return connection;
 		}
 
@@ -143,33 +167,40 @@
 			get { return this.brokerUri; }
 			set
 			{
-				if(null == this.brokerUri || !this.brokerUri.Equals(value))
+				try
 				{
-					// Re-create the TIBCO connection factory.
-					this.brokerUri = value;
-					if(null == this.brokerUri)
-					{
-						this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory();
-					}
-					else
+					if(null == this.brokerUri || !this.brokerUri.Equals(value))
 					{
-						if(null == this.clientId)
+						// Re-create the TIBCO connection factory.
+						this.brokerUri = value;
+						if(null == this.brokerUri)
 						{
-							this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString);
+							this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory();
 						}
 						else
 						{
-							if(null == this.properties)
+							if(null == this.clientId)
 							{
-								this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString, this.clientId);
+								this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString);
 							}
 							else
 							{
-								this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString, this.clientId, this.properties);
+								if(null == this.properties)
+								{
+									this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString, this.clientId);
+								}
+								else
+								{
+									this.tibcoConnectionFactory = new TIBCO.EMS.ConnectionFactory(this.brokerUri.OriginalString, this.clientId, this.properties);
+								}
 							}
 						}
 					}
 				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
 			}
 		}
 

Added: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ExceptionUtil.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ExceptionUtil.cs?rev=882749&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ExceptionUtil.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ExceptionUtil.cs Fri Nov 20 22:42:44 2009
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Apache.NMS.EMS
+{
+	class ExceptionUtil
+	{
+		/// <summary>
+		/// Wrap the provider specific exception inside an NMS exception to more tightly
+		/// integrate the provider extensions into the NMS API.
+		/// </summary>
+		/// <param name="ex"></param>
+		public static void WrapAndThrowNMSException(Exception ex)
+		{
+			if(ex is Apache.NMS.NMSException)
+			{
+				// Already derived from NMSException
+				throw ex;
+			}
+
+			if(ex is TIBCO.EMS.AuthenticationException)
+			{
+				TIBCO.EMS.AuthenticationException tibcoex = ex as TIBCO.EMS.AuthenticationException;
+				throw new Apache.NMS.NMSSecurityException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.CannotProceedException)
+			{
+				TIBCO.EMS.CannotProceedException tibcoex = ex as TIBCO.EMS.CannotProceedException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.ConfigurationException)
+			{
+				TIBCO.EMS.ConfigurationException tibcoex = ex as TIBCO.EMS.ConfigurationException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.InvalidNameException)
+			{
+				TIBCO.EMS.InvalidNameException tibcoex = ex as TIBCO.EMS.InvalidNameException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.NameNotFoundException)
+			{
+				TIBCO.EMS.NameNotFoundException tibcoex = ex as TIBCO.EMS.NameNotFoundException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.NamingException)
+			{
+				TIBCO.EMS.NamingException tibcoex = ex as TIBCO.EMS.NamingException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.CommunicationException)
+			{
+				TIBCO.EMS.CommunicationException tibcoex = ex as TIBCO.EMS.CommunicationException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.ServiceUnavailableException)
+			{
+				TIBCO.EMS.ServiceUnavailableException tibcoex = ex as TIBCO.EMS.ServiceUnavailableException;
+				throw new Apache.NMS.NMSConnectionException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.IllegalStateException)
+			{
+				TIBCO.EMS.IllegalStateException tibcoex = ex as TIBCO.EMS.IllegalStateException;
+				throw new Apache.NMS.IllegalStateException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.InvalidClientIDException)
+			{
+				TIBCO.EMS.InvalidClientIDException tibcoex = ex as TIBCO.EMS.InvalidClientIDException;
+				throw new Apache.NMS.InvalidClientIDException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.InvalidDestinationException)
+			{
+				TIBCO.EMS.InvalidDestinationException tibcoex = ex as TIBCO.EMS.InvalidDestinationException;
+				throw new Apache.NMS.InvalidDestinationException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.InvalidSelectorException)
+			{
+				TIBCO.EMS.InvalidSelectorException tibcoex = ex as TIBCO.EMS.InvalidSelectorException;
+				throw new Apache.NMS.InvalidSelectorException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.MessageEOFException)
+			{
+				TIBCO.EMS.MessageEOFException tibcoex = ex as TIBCO.EMS.MessageEOFException;
+				throw new Apache.NMS.MessageEOFException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.MessageFormatException)
+			{
+				TIBCO.EMS.MessageFormatException tibcoex = ex as TIBCO.EMS.MessageFormatException;
+				throw new Apache.NMS.MessageFormatException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.MessageNotReadableException)
+			{
+				TIBCO.EMS.MessageNotReadableException tibcoex = ex as TIBCO.EMS.MessageNotReadableException;
+				throw new Apache.NMS.MessageNotReadableException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.MessageNotWriteableException)
+			{
+				TIBCO.EMS.MessageNotWriteableException tibcoex = ex as TIBCO.EMS.MessageNotWriteableException;
+				throw new Apache.NMS.MessageNotWriteableException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.ResourceAllocationException)
+			{
+				TIBCO.EMS.ResourceAllocationException tibcoex = ex as TIBCO.EMS.ResourceAllocationException;
+				throw new Apache.NMS.ResourceAllocationException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.SecurityException)
+			{
+				TIBCO.EMS.SecurityException tibcoex = ex as TIBCO.EMS.SecurityException;
+				throw new Apache.NMS.NMSSecurityException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.TransactionInProgressException)
+			{
+				TIBCO.EMS.TransactionInProgressException tibcoex = ex as TIBCO.EMS.TransactionInProgressException;
+				throw new Apache.NMS.TransactionInProgressException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.TransactionRolledBackException)
+			{
+				TIBCO.EMS.TransactionRolledBackException tibcoex = ex as TIBCO.EMS.TransactionRolledBackException;
+				throw new Apache.NMS.TransactionRolledBackException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			if(ex is TIBCO.EMS.EMSException)
+			{
+				TIBCO.EMS.EMSException tibcoex = ex as TIBCO.EMS.EMSException;
+				throw new Apache.NMS.NMSException(tibcoex.Message, tibcoex.ErrorCode, tibcoex);
+			}
+
+			// Not an EMS exception that should be wrapped.
+			throw ex;
+		}
+	}
+}

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs Fri Nov 20 22:42:44 2009
@@ -46,18 +46,40 @@
 
 		public void Clear()
 		{
-			this.tibcoMapMessage.ClearBody();
+			try
+			{
+				this.tibcoMapMessage.ClearBody();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public bool Contains(object key)
 		{
-			return this.tibcoMapMessage.ItemExists(key.ToString());
+			try
+			{
+				return this.tibcoMapMessage.ItemExists(key.ToString());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return false;
+			}
 		}
 
 		public void Remove(object key)
 		{
-			// Best guess at equivalent implementation.
-			this.tibcoMapMessage.SetObject(key.ToString(), null);
+			try
+			{
+				// Best guess at equivalent implementation.
+				this.tibcoMapMessage.SetObject(key.ToString(), null);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public int Count
@@ -65,15 +87,22 @@
 			get
 			{
 				int count = 0;
-				IEnumerator namesEnumerator = this.tibcoMapMessage.MapNames;
-
-				if(null != namesEnumerator)
+				try
 				{
-					while(namesEnumerator.MoveNext())
+					IEnumerator namesEnumerator = this.tibcoMapMessage.MapNames;
+
+					if(null != namesEnumerator)
 					{
-						count++;
+						while(namesEnumerator.MoveNext())
+						{
+							count++;
+						}
 					}
 				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
 
 				return count;
 			}
@@ -85,9 +114,16 @@
 			{
 				ArrayList keys = new ArrayList();
 
-				foreach(string itemName in EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+				try
+				{
+					foreach(string itemName in EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+					{
+						keys.Add(itemName);
+					}
+				}
+				catch(Exception ex)
 				{
-					keys.Add(itemName);
+					ExceptionUtil.WrapAndThrowNMSException(ex);
 				}
 
 				return keys;
@@ -100,9 +136,16 @@
 			{
 				ArrayList keys = new ArrayList();
 
-				foreach(string itemName in EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+				try
 				{
-					keys.Add(this.tibcoMapMessage.GetObject(itemName));
+					foreach(string itemName in EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+					{
+						keys.Add(this.tibcoMapMessage.GetObject(itemName));
+					}
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
 				}
 
 				return keys;
@@ -113,122 +156,302 @@
 		{
 			get
 			{
-				return this.tibcoMapMessage.GetObject(key);
+				try
+				{
+					return this.tibcoMapMessage.GetObject(key);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+					return null;
+				}
 			}
 			set
 			{
-				this.tibcoMapMessage.SetObject(key, value);
+				try
+				{
+					this.tibcoMapMessage.SetObject(key, value);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
 			}
 		}
 
 		public string GetString(string key)
 		{
-			return this.tibcoMapMessage.GetString(key);
+			try
+			{
+				return this.tibcoMapMessage.GetString(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetString(string key, string value)
 		{
-			this.tibcoMapMessage.SetString(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetString(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public bool GetBool(string key)
 		{
-			return this.tibcoMapMessage.GetBoolean(key);
+			try
+			{
+				return this.tibcoMapMessage.GetBoolean(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return false;
+			}
 		}
 
 		public void SetBool(string key, bool value)
 		{
-			this.tibcoMapMessage.SetBoolean(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetBoolean(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public byte GetByte(string key)
 		{
-			return this.tibcoMapMessage.GetByte(key);
+			try
+			{
+				return this.tibcoMapMessage.GetByte(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetByte(string key, byte value)
 		{
-			this.tibcoMapMessage.SetByte(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetByte(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public char GetChar(string key)
 		{
-			return this.tibcoMapMessage.GetChar(key);
+			try
+			{
+				return this.tibcoMapMessage.GetChar(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return (char) 0;
+			}
 		}
 
 		public void SetChar(string key, char value)
 		{
-			this.tibcoMapMessage.SetChar(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetChar(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public short GetShort(string key)
 		{
-			return this.tibcoMapMessage.GetShort(key);
+			try
+			{
+				return this.tibcoMapMessage.GetShort(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetShort(string key, short value)
 		{
-			this.tibcoMapMessage.SetShort(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetShort(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public int GetInt(string key)
 		{
-			return this.tibcoMapMessage.GetInt(key);
+			try
+			{
+				return this.tibcoMapMessage.GetInt(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetInt(string key, int value)
 		{
-			this.tibcoMapMessage.SetInt(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetInt(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public long GetLong(string key)
 		{
-			return this.tibcoMapMessage.GetLong(key);
+			try
+			{
+				return this.tibcoMapMessage.GetLong(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetLong(string key, long value)
 		{
-			this.tibcoMapMessage.SetLong(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetLong(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public float GetFloat(string key)
 		{
-			return this.tibcoMapMessage.GetFloat(key);
+			try
+			{
+				return this.tibcoMapMessage.GetFloat(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetFloat(string key, float value)
 		{
-			this.tibcoMapMessage.SetFloat(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetFloat(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public double GetDouble(string key)
 		{
-			return this.tibcoMapMessage.GetDouble(key);
+			try
+			{
+				return this.tibcoMapMessage.GetDouble(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetDouble(string key, double value)
 		{
-			this.tibcoMapMessage.SetDouble(key, value);
+			try
+			{
+				this.tibcoMapMessage.SetDouble(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public IList GetList(string key)
 		{
-			return (IList) this.tibcoMapMessage.GetObject(key);
+			try
+			{
+				return (IList) this.tibcoMapMessage.GetObject(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetList(string key, IList list)
 		{
-			this.tibcoMapMessage.SetObject(key, list);
+			try
+			{
+				this.tibcoMapMessage.SetObject(key, list);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public IDictionary GetDictionary(string key)
 		{
-			return (IDictionary) this.tibcoMapMessage.GetObject(key);
+			try
+			{
+				return (IDictionary) this.tibcoMapMessage.GetObject(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetDictionary(string key, IDictionary dictionary)
 		{
-			this.tibcoMapMessage.SetObject(key, dictionary);
+			try
+			{
+				this.tibcoMapMessage.SetObject(key, dictionary);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		#endregion

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs Fri Nov 20 22:42:44 2009
@@ -28,7 +28,7 @@
 			this.tibcoMessage = message;
 		}
 
-#region IMessage Members
+		#region IMessage Members
 
 		/// <summary>
 		/// If using client acknowledgement mode on the session then this method will acknowledge that the
@@ -36,7 +36,14 @@
 		/// </summary>
 		public void Acknowledge()
 		{
-			this.tibcoMessage.Acknowledge();
+			try
+			{
+				this.tibcoMessage.Acknowledge();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -48,7 +55,14 @@
 		/// </summary>
 		public void ClearBody()
 		{
-			this.tibcoMessage.ClearBody();
+			try
+			{
+				this.tibcoMessage.ClearBody();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -58,7 +72,14 @@
 		/// </summary>
 		public void ClearProperties()
 		{
-			this.tibcoMessage.ClearProperties();
+			try
+			{
+				this.tibcoMessage.ClearProperties();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -74,8 +95,29 @@
 		/// </summary>
 		public string NMSCorrelationID
 		{
-			get { return this.tibcoMessage.CorrelationID; }
-			set { this.tibcoMessage.CorrelationID = value; }
+			get
+			{
+				try
+				{
+					return this.tibcoMessage.CorrelationID;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+					return null;
+				}
+			}
+			set
+			{
+				try
+				{
+					this.tibcoMessage.CorrelationID = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		/// <summary>
@@ -112,7 +154,17 @@
 		public MsgDeliveryMode NMSDeliveryMode
 		{
 			get { return EMSConvert.ToNMSMsgDeliveryMode(this.tibcoMessage.MsgDeliveryMode); }
-			set { this.tibcoMessage.MsgDeliveryMode = EMSConvert.ToMessageDeliveryMode(value); }
+			set
+			{
+				try
+				{
+					this.tibcoMessage.MsgDeliveryMode = EMSConvert.ToMessageDeliveryMode(value);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		/// <summary>
@@ -121,7 +173,17 @@
 		public MsgPriority NMSPriority
 		{
 			get { return (MsgPriority) this.tibcoMessage.Priority; }
-			set { this.tibcoMessage.Priority = (int) value; }
+			set
+			{
+				try
+				{
+					this.tibcoMessage.Priority = (int) value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		/// <summary>
@@ -140,13 +202,20 @@
 			get { return EMSConvert.ToNMSDestination(this.tibcoMessage.ReplyTo); }
 			set
 			{
-				if(null == value)
+				try
 				{
-					this.tibcoMessage.ReplyTo = null;
+					if(null == value)
+					{
+						this.tibcoMessage.ReplyTo = null;
+					}
+					else
+					{
+						this.tibcoMessage.ReplyTo = ((Apache.NMS.EMS.Destination) value).tibcoDestination;
+					}
 				}
-				else
+				catch(Exception ex)
 				{
-					this.tibcoMessage.ReplyTo = ((Apache.NMS.EMS.Destination) value).tibcoDestination;
+					ExceptionUtil.WrapAndThrowNMSException(ex);
 				}
 			}
 		}
@@ -166,7 +235,17 @@
 		public string NMSType
 		{
 			get { return this.tibcoMessage.MsgType; }
-			set { this.tibcoMessage.MsgType = value; }
+			set
+			{
+				try
+				{
+					this.tibcoMessage.MsgType = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		#endregion

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs Fri Nov 20 22:42:44 2009
@@ -93,13 +93,22 @@
 
 			lock(this)
 			{
-				if(!this.nmsSession.tibcoSession.IsClosed)
+				try
 				{
-					this.tibcoMessageConsumer.MessageHandler -= this.HandleTibcoMsg;
-					this.tibcoMessageConsumer.Close();
+					if(!this.nmsSession.tibcoSession.IsClosed)
+					{
+						this.tibcoMessageConsumer.MessageHandler -= this.HandleTibcoMsg;
+						this.tibcoMessageConsumer.Close();
+					}
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+				finally
+				{
+					closed = true;
 				}
-
-				closed = true;
 			}
 		}
 

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProducer.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProducer.cs Fri Nov 20 22:42:44 2009
@@ -55,11 +55,18 @@
 				timeToLive = this.tibcoMessageProducer.TimeToLive;
 			}
 
-			this.tibcoMessageProducer.Send(
-						msg.tibcoMessage,
-						this.tibcoMessageProducer.MsgDeliveryMode,
-						this.tibcoMessageProducer.Priority,
-						timeToLive);
+			try
+			{
+				this.tibcoMessageProducer.Send(
+							msg.tibcoMessage,
+							this.tibcoMessageProducer.MsgDeliveryMode,
+							this.tibcoMessageProducer.Priority,
+							timeToLive);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -69,11 +76,18 @@
 		{
 			Apache.NMS.EMS.Message msg = (Apache.NMS.EMS.Message) message;
 
-			this.tibcoMessageProducer.Send(
-						msg.tibcoMessage,
-						EMSConvert.ToMessageDeliveryMode(deliveryMode),
-						(int) priority,
-						(long) timeToLive.TotalMilliseconds);
+			try
+			{
+				this.tibcoMessageProducer.Send(
+							msg.tibcoMessage,
+							EMSConvert.ToMessageDeliveryMode(deliveryMode),
+							(int) priority,
+							(long) timeToLive.TotalMilliseconds);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -90,12 +104,19 @@
 				timeToLive = this.tibcoMessageProducer.TimeToLive;
 			}
 
-			this.tibcoMessageProducer.Send(
-						dest.tibcoDestination,
-						msg.tibcoMessage,
-						this.tibcoMessageProducer.MsgDeliveryMode,
-						this.tibcoMessageProducer.Priority,
-						timeToLive);
+			try
+			{
+				this.tibcoMessageProducer.Send(
+							dest.tibcoDestination,
+							msg.tibcoMessage,
+							this.tibcoMessageProducer.MsgDeliveryMode,
+							this.tibcoMessageProducer.Priority,
+							timeToLive);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		/// <summary>
@@ -107,24 +128,51 @@
 			Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination) destination;
 			Apache.NMS.EMS.Message msg = (Apache.NMS.EMS.Message) message;
 
-			this.tibcoMessageProducer.Send(
-						dest.tibcoDestination,
-						msg.tibcoMessage,
-						EMSConvert.ToMessageDeliveryMode(deliveryMode),
-						(int) priority,
-						(long) timeToLive.TotalMilliseconds);
+			try
+			{
+				this.tibcoMessageProducer.Send(
+							dest.tibcoDestination,
+							msg.tibcoMessage,
+							EMSConvert.ToMessageDeliveryMode(deliveryMode),
+							(int) priority,
+							(long) timeToLive.TotalMilliseconds);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public MsgDeliveryMode DeliveryMode
 		{
 			get { return EMSConvert.ToNMSMsgDeliveryMode(this.tibcoMessageProducer.MsgDeliveryMode); }
-			set { this.tibcoMessageProducer.MsgDeliveryMode = EMSConvert.ToMessageDeliveryMode(value); }
+			set
+			{
+				try
+				{
+					this.tibcoMessageProducer.MsgDeliveryMode = EMSConvert.ToMessageDeliveryMode(value);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		public TimeSpan TimeToLive
 		{
 			get { return TimeSpan.FromMilliseconds(this.tibcoMessageProducer.TimeToLive); }
-			set { this.tibcoMessageProducer.TimeToLive = (long) value.TotalMilliseconds; }
+			set
+			{
+				try
+				{
+					this.tibcoMessageProducer.TimeToLive = (long) value.TotalMilliseconds;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		/// <summary>
@@ -139,19 +187,49 @@
 		public MsgPriority Priority
 		{
 			get { return (MsgPriority) this.tibcoMessageProducer.Priority; }
-			set { this.tibcoMessageProducer.Priority = (int) value; }
+			set
+			{
+				try
+				{
+					this.tibcoMessageProducer.Priority = (int) value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		public bool DisableMessageID
 		{
 			get { return this.tibcoMessageProducer.DisableMessageID; }
-			set { this.tibcoMessageProducer.DisableMessageID = value; }
+			set
+			{
+				try
+				{
+					this.tibcoMessageProducer.DisableMessageID = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		public bool DisableMessageTimestamp
 		{
 			get { return this.tibcoMessageProducer.DisableMessageTimestamp; }
-			set { this.tibcoMessageProducer.DisableMessageTimestamp = value; }
+			set
+			{
+				try
+				{
+					this.tibcoMessageProducer.DisableMessageTimestamp = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		/// <summary>
@@ -231,12 +309,21 @@
 					return;
 				}
 
-				if(!this.nmsSession.tibcoSession.IsClosed)
+				try
 				{
-					this.tibcoMessageProducer.Close();
+					if(!this.nmsSession.tibcoSession.IsClosed)
+					{
+						this.tibcoMessageProducer.Close();
+					}
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+				finally
+				{
+					closed = true;
 				}
-
-				closed = true;
 			}
 		}
 		///<summary>

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs Fri Nov 20 22:42:44 2009
@@ -16,6 +16,7 @@
  */
 
 using System.Collections;
+using System;
 
 namespace Apache.NMS.EMS
 {
@@ -32,7 +33,14 @@
 
 		public void Clear()
 		{
-			this.tibcoMessage.ClearProperties();
+			try
+			{
+				this.tibcoMessage.ClearProperties();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public bool Contains(object key)
@@ -42,8 +50,15 @@
 
 		public void Remove(object key)
 		{
-			// Best guess at equivalent implementation.
-			this.tibcoMessage.SetObjectProperty(key.ToString(), null);
+			try
+			{
+				// Best guess at equivalent implementation.
+				this.tibcoMessage.SetObjectProperty(key.ToString(), null);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public int Count
@@ -51,15 +66,22 @@
 			get
 			{
 				int count = 0;
-				IEnumerator propertyNamesEnumerator = this.tibcoMessage.PropertyNames;
-
-				if(null != propertyNamesEnumerator)
+				try
 				{
-					while(propertyNamesEnumerator.MoveNext())
+					IEnumerator propertyNamesEnumerator = this.tibcoMessage.PropertyNames;
+
+					if(null != propertyNamesEnumerator)
 					{
-						count++;
+						while(propertyNamesEnumerator.MoveNext())
+						{
+							count++;
+						}
 					}
 				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
 
 				return count;
 			}
@@ -71,9 +93,16 @@
 			{
 				ArrayList keys = new ArrayList();
 
-				foreach(string propertyName in EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
+				try
+				{
+					foreach(string propertyName in EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
+					{
+						keys.Add(propertyName);
+					}
+				}
+				catch(Exception ex)
 				{
-					keys.Add(propertyName);
+					ExceptionUtil.WrapAndThrowNMSException(ex);
 				}
 
 				return keys;
@@ -86,9 +115,16 @@
 			{
 				ArrayList values = new ArrayList();
 
-				foreach(string propertyName in EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
+				try
 				{
-					values.Add(this.tibcoMessage.GetObjectProperty(propertyName));
+					foreach(string propertyName in EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
+					{
+						values.Add(this.tibcoMessage.GetObjectProperty(propertyName));
+					}
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
 				}
 
 				return values;
@@ -97,118 +133,304 @@
 
 		public object this[string key]
 		{
-			get { return this.tibcoMessage.GetObjectProperty(key); }
-			set { this.tibcoMessage.SetObjectProperty(key, value); }
+			get
+			{
+				try
+				{
+					return this.tibcoMessage.GetObjectProperty(key);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+					return null;
+				}
+			}
+			set
+			{
+				try
+				{
+					this.tibcoMessage.SetObjectProperty(key, value);
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		public string GetString(string key)
 		{
-			return this.tibcoMessage.GetStringProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetStringProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetString(string key, string value)
 		{
-			this.tibcoMessage.SetStringProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetStringProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public bool GetBool(string key)
 		{
-			return this.tibcoMessage.GetBooleanProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetBooleanProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return false;
+			}
 		}
 
 		public void SetBool(string key, bool value)
 		{
-			this.tibcoMessage.SetBooleanProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetBooleanProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public byte GetByte(string key)
 		{
-			return this.tibcoMessage.GetByteProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetByteProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetByte(string key, byte value)
 		{
-			this.tibcoMessage.SetByteProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetByteProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public char GetChar(string key)
 		{
-			return (char) this.tibcoMessage.GetShortProperty(key);
+			try
+			{
+				return (char) this.tibcoMessage.GetShortProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return (char) 0;
+			}
 		}
 
 		public void SetChar(string key, char value)
 		{
-			this.tibcoMessage.SetShortProperty(key, (short) value);
+			try
+			{
+				this.tibcoMessage.SetShortProperty(key, (short) value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public short GetShort(string key)
 		{
-			return this.tibcoMessage.GetShortProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetShortProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetShort(string key, short value)
 		{
-			this.tibcoMessage.SetShortProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetShortProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public int GetInt(string key)
 		{
-			return this.tibcoMessage.GetIntProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetIntProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetInt(string key, int value)
 		{
-			this.tibcoMessage.SetIntProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetIntProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public long GetLong(string key)
 		{
-			return this.tibcoMessage.GetLongProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetLongProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetLong(string key, long value)
 		{
-			this.tibcoMessage.SetLongProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetLongProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public float GetFloat(string key)
 		{
-			return this.tibcoMessage.GetFloatProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetFloatProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetFloat(string key, float value)
 		{
-			this.tibcoMessage.SetFloatProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetFloatProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public double GetDouble(string key)
 		{
-			return this.tibcoMessage.GetDoubleProperty(key);
+			try
+			{
+				return this.tibcoMessage.GetDoubleProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public void SetDouble(string key, double value)
 		{
-			this.tibcoMessage.SetDoubleProperty(key, value);
+			try
+			{
+				this.tibcoMessage.SetDoubleProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public IList GetList(string key)
 		{
-			return (IList) this.tibcoMessage.GetObjectProperty(key);
+			try
+			{
+				return (IList) this.tibcoMessage.GetObjectProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetList(string key, IList list)
 		{
-			this.tibcoMessage.SetObjectProperty(key, list);
+			try
+			{
+				this.tibcoMessage.SetObjectProperty(key, list);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public IDictionary GetDictionary(string key)
 		{
-			return (IDictionary) this.tibcoMessage.GetObjectProperty(key);
+			try
+			{
+				return (IDictionary) this.tibcoMessage.GetObjectProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void SetDictionary(string key, IDictionary dictionary)
 		{
-			this.tibcoMessage.SetObjectProperty(key, dictionary);
+			try
+			{
+				this.tibcoMessage.SetObjectProperty(key, dictionary);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		#endregion

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Session.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Session.cs Fri Nov 20 22:42:44 2009
@@ -48,74 +48,169 @@
 		{
 			Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination) destination;
 
-			return EMSConvert.ToNMSMessageProducer(this, this.tibcoSession.CreateProducer(destinationObj.tibcoDestination));
+			try
+			{
+				return EMSConvert.ToNMSMessageProducer(this, this.tibcoSession.CreateProducer(destinationObj.tibcoDestination));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination)
 		{
 			Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination) destination;
 
-			return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination));
+			try
+			{
+				return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination, string selector)
 		{
 			Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination) destination;
 
-			return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector));
+			try
+			{
+				return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination, string selector, bool noLocal)
 		{
 			Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination) destination;
 
-			return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector, noLocal));
+			try
+			{
+				return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector, noLocal));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IMessageConsumer CreateDurableConsumer(Apache.NMS.ITopic destination, string name, string selector, bool noLocal)
 		{
 			Apache.NMS.EMS.Topic topicObj = (Apache.NMS.EMS.Topic) destination;
 
-			return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateDurableSubscriber(topicObj.tibcoTopic, name, selector, noLocal));
+			try
+			{
+				return EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateDurableSubscriber(topicObj.tibcoTopic, name, selector, noLocal));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void DeleteDurableConsumer(string name)
 		{
-			this.tibcoSession.Unsubscribe(name);
+			try
+			{
+				this.tibcoSession.Unsubscribe(name);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public IQueueBrowser CreateBrowser(IQueue queue)
 		{
 			Apache.NMS.EMS.Queue queueObj = (Apache.NMS.EMS.Queue) queue;
 
-			return EMSConvert.ToNMSQueueBrowser(this.tibcoSession.CreateBrowser(queueObj.tibcoQueue));
+			try
+			{
+				return EMSConvert.ToNMSQueueBrowser(this.tibcoSession.CreateBrowser(queueObj.tibcoQueue));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public IQueueBrowser CreateBrowser(IQueue queue, string selector)
 		{
 			Apache.NMS.EMS.Queue queueObj = (Apache.NMS.EMS.Queue) queue;
 
-			return EMSConvert.ToNMSQueueBrowser(this.tibcoSession.CreateBrowser(queueObj.tibcoQueue, selector));
+			try
+			{
+				return EMSConvert.ToNMSQueueBrowser(this.tibcoSession.CreateBrowser(queueObj.tibcoQueue, selector));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IQueue GetQueue(string name)
 		{
-			return EMSConvert.ToNMSQueue(this.tibcoSession.CreateQueue(name));
+			try
+			{
+				return EMSConvert.ToNMSQueue(this.tibcoSession.CreateQueue(name));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.ITopic GetTopic(string name)
 		{
-			return EMSConvert.ToNMSTopic(this.tibcoSession.CreateTopic(name));
+			try
+			{
+				return EMSConvert.ToNMSTopic(this.tibcoSession.CreateTopic(name));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.ITemporaryQueue CreateTemporaryQueue()
 		{
-			return EMSConvert.ToNMSTemporaryQueue(this.tibcoSession.CreateTemporaryQueue());
+			try
+			{
+				return EMSConvert.ToNMSTemporaryQueue(this.tibcoSession.CreateTemporaryQueue());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.ITemporaryTopic CreateTemporaryTopic()
 		{
-			return EMSConvert.ToNMSTemporaryTopic(this.tibcoSession.CreateTemporaryTopic());
+			try
+			{
+				return EMSConvert.ToNMSTemporaryTopic(this.tibcoSession.CreateTemporaryTopic());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		/// <summary>
@@ -123,65 +218,142 @@
 		/// </summary>
 		public void DeleteDestination(IDestination destination)
 		{
-			// TODO: Implement if possible.  If not possible, then change exception to NotSupportedException().
-			throw new NotImplementedException();
+			// TODO: Implement if possible.
 		}
 
 		public Apache.NMS.IMessage CreateMessage()
 		{
-			return EMSConvert.ToNMSMessage(this.tibcoSession.CreateMessage());
+			try
+			{
+				return EMSConvert.ToNMSMessage(this.tibcoSession.CreateMessage());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.ITextMessage CreateTextMessage()
 		{
-			return EMSConvert.ToNMSTextMessage(this.tibcoSession.CreateTextMessage());
+			try
+			{
+				return EMSConvert.ToNMSTextMessage(this.tibcoSession.CreateTextMessage());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.ITextMessage CreateTextMessage(string text)
 		{
-			return EMSConvert.ToNMSTextMessage(this.tibcoSession.CreateTextMessage(text));
+			try
+			{
+				return EMSConvert.ToNMSTextMessage(this.tibcoSession.CreateTextMessage(text));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IMapMessage CreateMapMessage()
 		{
-			return EMSConvert.ToNMSMapMessage(this.tibcoSession.CreateMapMessage());
+			try
+			{
+				return EMSConvert.ToNMSMapMessage(this.tibcoSession.CreateMapMessage());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IBytesMessage CreateBytesMessage()
 		{
-			return EMSConvert.ToNMSBytesMessage(this.tibcoSession.CreateBytesMessage());
+			try
+			{
+				return EMSConvert.ToNMSBytesMessage(this.tibcoSession.CreateBytesMessage());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IBytesMessage CreateBytesMessage(byte[] body)
 		{
-			Apache.NMS.IBytesMessage bytesMessage = CreateBytesMessage();
+			try
+			{
+				Apache.NMS.IBytesMessage bytesMessage = CreateBytesMessage();
 
-			if(null != bytesMessage)
+				if(null != bytesMessage)
+				{
+					bytesMessage.Content = body;
+				}
+
+				return bytesMessage;
+			}
+			catch(Exception ex)
 			{
-				bytesMessage.Content = body;
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
 			}
-
-			return bytesMessage;
 		}
 
 		public Apache.NMS.IStreamMessage CreateStreamMessage()
 		{
-			return EMSConvert.ToNMSStreamMessage(this.tibcoSession.CreateStreamMessage());
+			try
+			{
+				return EMSConvert.ToNMSStreamMessage(this.tibcoSession.CreateStreamMessage());
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public Apache.NMS.IObjectMessage CreateObjectMessage(Object body)
 		{
-			return EMSConvert.ToNMSObjectMessage(this.tibcoSession.CreateObjectMessage(body));
+			try
+			{
+				return EMSConvert.ToNMSObjectMessage(this.tibcoSession.CreateObjectMessage(body));
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 		
 		public void Commit()
 		{
-			this.tibcoSession.Commit();
+			try
+			{
+				this.tibcoSession.Commit();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 		
 		public void Rollback()
 		{
-			this.tibcoSession.Rollback();
+			try
+			{
+				this.tibcoSession.Rollback();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 		
 		// Properties
@@ -215,8 +387,18 @@
 					return;
 				}
 
-				this.tibcoSession.Close();
-				closed = true;
+				try
+				{
+					this.tibcoSession.Close();
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+				finally
+				{
+					closed = true;
+				}
 			}
 		}
 

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/StreamMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/StreamMessage.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/StreamMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/StreamMessage.cs Fri Nov 20 22:42:44 2009
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+using System;
 namespace Apache.NMS.EMS
 {
 	class StreamMessage : Apache.NMS.EMS.Message, Apache.NMS.IStreamMessage
@@ -34,122 +35,301 @@
 
 		public bool ReadBoolean()
 		{
-			return this.tibcoStreamMessage.ReadBoolean();
+			try
+			{
+				return this.tibcoStreamMessage.ReadBoolean();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return false;
+			}
 		}
 
 		public byte ReadByte()
 		{
-			return this.tibcoStreamMessage.ReadByte();
+			try
+			{
+				return this.tibcoStreamMessage.ReadByte();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public int ReadBytes(byte[] value)
 		{
-			return this.tibcoStreamMessage.ReadBytes(value);
+			try
+			{
+				return this.tibcoStreamMessage.ReadBytes(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public char ReadChar()
 		{
-			return this.tibcoStreamMessage.ReadChar();
+			try
+			{
+				return this.tibcoStreamMessage.ReadChar();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return (char) 0;
+			}
 		}
 
 		public double ReadDouble()
 		{
-			return this.tibcoStreamMessage.ReadDouble();
+			try
+			{
+				return this.tibcoStreamMessage.ReadDouble();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public short ReadInt16()
 		{
-			return this.tibcoStreamMessage.ReadShort();
+			try
+			{
+				return this.tibcoStreamMessage.ReadShort();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public int ReadInt32()
 		{
-			return this.tibcoStreamMessage.ReadInt();
+			try
+			{
+				return this.tibcoStreamMessage.ReadInt();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public long ReadInt64()
 		{
-			return this.tibcoStreamMessage.ReadLong();
+			try
+			{
+				return this.tibcoStreamMessage.ReadLong();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public object ReadObject()
 		{
-			return this.tibcoStreamMessage.ReadObject();
+			try
+			{
+				return this.tibcoStreamMessage.ReadObject();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public float ReadSingle()
 		{
-			return this.tibcoStreamMessage.ReadFloat();
+			try
+			{
+				return this.tibcoStreamMessage.ReadFloat();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return 0;
+			}
 		}
 
 		public string ReadString()
 		{
-			return this.tibcoStreamMessage.ReadString();
+			try
+			{
+				return this.tibcoStreamMessage.ReadString();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
 		}
 
 		public void Reset()
 		{
-			this.tibcoStreamMessage.Reset();
+			try
+			{
+				this.tibcoStreamMessage.Reset();
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteBoolean(bool value)
 		{
-			this.tibcoStreamMessage.WriteBoolean(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteBoolean(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteByte(byte value)
 		{
-			this.tibcoStreamMessage.WriteByte(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteByte(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteBytes(byte[] value, int offset, int length)
 		{
-			this.tibcoStreamMessage.WriteBytes(value, offset, length);
+			try
+			{
+				this.tibcoStreamMessage.WriteBytes(value, offset, length);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteBytes(byte[] value)
 		{
-			this.tibcoStreamMessage.WriteBytes(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteBytes(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteChar(char value)
 		{
-			this.tibcoStreamMessage.WriteChar(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteChar(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteDouble(double value)
 		{
-			this.tibcoStreamMessage.WriteDouble(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteDouble(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteInt16(short value)
 		{
-			this.tibcoStreamMessage.WriteShort(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteShort(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteInt32(int value)
 		{
-			this.tibcoStreamMessage.WriteInt(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteInt(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteInt64(long value)
 		{
-			this.tibcoStreamMessage.WriteLong(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteLong(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteObject(object value)
 		{
-			this.tibcoStreamMessage.WriteObject(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteObject(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteSingle(float value)
 		{
-			this.tibcoStreamMessage.WriteFloat(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteFloat(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		public void WriteString(string value)
 		{
-			this.tibcoStreamMessage.WriteString(value);
+			try
+			{
+				this.tibcoStreamMessage.WriteString(value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
 		}
 
 		#endregion

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/TextMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/TextMessage.cs?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/TextMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/TextMessage.cs Fri Nov 20 22:42:44 2009
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+using System;
 namespace Apache.NMS.EMS
 {
 	class TextMessage : Apache.NMS.EMS.Message, Apache.NMS.ITextMessage
@@ -34,8 +35,29 @@
 
 		public string Text
 		{
-			get { return this.tibcoTextMessage.Text; }
-			set { this.tibcoTextMessage.Text = value; }
+			get
+			{
+				try
+				{
+					return this.tibcoTextMessage.Text;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+					return null;
+				}
+			}
+			set
+			{
+				try
+				{
+					this.tibcoTextMessage.Text = value;
+				}
+				catch(Exception ex)
+				{
+					ExceptionUtil.WrapAndThrowNMSException(ex);
+				}
+			}
 		}
 
 		#endregion

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj?rev=882749&r1=882748&r2=882749&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj Fri Nov 20 22:42:44 2009
@@ -73,6 +73,7 @@
     <Compile Include="src\main\csharp\Connection.cs" />
     <Compile Include="src\main\csharp\ConnectionFactory.cs" />
     <Compile Include="src\main\csharp\ConnectionMetaData.cs" />
+    <Compile Include="src\main\csharp\ExceptionUtil.cs" />
     <Compile Include="src\main\csharp\StreamMessage.cs" />
     <Compile Include="src\main\csharp\QueueBrowser.cs" />
     <Compile Include="src\main\csharp\Destination.cs" />



Mime
View raw message