Skip to content
Permalink
Browse files
Merged revision(s) 1185320 from activemq/activemq-dotnet/Apache.NMS/b…
…ranches/1.5.x:

Add exception handling around directory name parsing.
Fixes [AMQNET-337]. (See https://issues.apache.org/jira/browse/AMQNET-337)
  • Loading branch information
Jim Gomes committed Oct 17, 2011
1 parent 0ed52f2 commit c87621626c9cf2e3808b9c5489ad8a55ea8420e7
Showing 1 changed file with 25 additions and 9 deletions.
@@ -314,18 +314,34 @@ private static string[] GetConfigSearchPaths()
// 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

0 comments on commit c876216

Please sign in to comment.