Author: jgomes
Date: Mon Oct 17 18:34:25 2011
New Revision: 1185320
URL: http://svn.apache.org/viewvc?rev=1185320&view=rev
Log:
Add exception handling around directory name parsing.
Fixes [AMQNET-337]. (See https://issues.apache.org/jira/browse/AMQNET-337)
Modified:
activemq/activemq-dotnet/Apache.NMS/branches/1.5.x/src/main/csharp/NMSConnectionFactory.cs
Modified:
activemq/activemq-dotnet/Apache.NMS/branches/1.5.x/src/main/csharp/NMSConnectionFactory.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/branches/1.5.x/src/main/csharp/NMSConnectionFactory.cs?rev=1185320&r1=1185319&r2=1185320&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS/branches/1.5.x/src/main/csharp/NMSConnectionFactory.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS/branches/1.5.x/src/main/csharp/NMSConnectionFactory.cs
Mon Oct 17 18:34:25 2011
@@ -314,18 +314,34 @@ namespace Apache.NMS
// Check the current folder first.
pathList.Add("");
#if !NETCF
- AppDomain currentDomain = AppDomain.CurrentDomain;
-
- // Check the folder the assembly is located in.
-
pathList.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
- if(null != currentDomain.BaseDirectory)
+ try
{
- pathList.Add(currentDomain.BaseDirectory);
- }
+ AppDomain currentDomain =
AppDomain.CurrentDomain;
- if(null != currentDomain.RelativeSearchPath)
+ // Check the folder the assembly is located in.
+ Assembly executingAssembly =
Assembly.GetExecutingAssembly();
+ try
+ {
+
pathList.Add(Path.GetDirectoryName(executingAssembly.Location));
+ }
+ catch(Exception ex)
+ {
+ Tracer.DebugFormat("Error parsing
executing assembly location: {0} : {1}", executingAssembly.Location,
ex.Message);
+ }
+
+ if(null != currentDomain.BaseDirectory)
+ {
+
pathList.Add(currentDomain.BaseDirectory);
+ }
+
+ if(null != currentDomain.RelativeSearchPath)
+ {
+
pathList.Add(currentDomain.RelativeSearchPath);
+ }
+ }
+ catch(Exception ex)
{
- pathList.Add(currentDomain.RelativeSearchPath);
+ Tracer.DebugFormat("Error configuring search
paths: {0}", ex.Message);
}
#endif