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 2008/10/29 01:07:14 UTC

svn commit: r708735 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs

Author: jgomes
Date: Tue Oct 28 17:07:13 2008
New Revision: 708735

URL: http://svn.apache.org/viewvc?rev=708735&view=rev
Log:
Refactor to use TryGetValue() to avoid throwing exception.

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs?rev=708735&r1=708734&r2=708735&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs Tue Oct 28 17:07:13 2008
@@ -104,13 +104,10 @@
 				throw new IOException("Transport not scheme specified: [" + location + "]");
 			}
 
-			scheme = scheme.ToLower();
 			ITransportFactory tf;
-			try
-			{
-			    tf = TransportFactory.factoryCache[scheme];
-			}
-			catch
+
+			scheme = scheme.ToLower();
+			if(!TransportFactory.factoryCache.TryGetValue(scheme, out tf))
 			{
 			    // missing in the cache - go add request it if it exists
 			    tf = TransportFactory.AddTransportFactory(scheme);