lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/3] lucenenet git commit: throw a more informative exception to track down TeamCity test failures
Date Tue, 30 Dec 2014 06:14:42 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master cb4bbe094 -> 2bf20847f


throw a more informative exception to track down TeamCity test failures


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a57d7201
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a57d7201
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a57d7201

Branch: refs/heads/master
Commit: a57d7201e74ba53784dffb2e18be2e2646618da3
Parents: cb4bbe0
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Mon Dec 29 20:34:20 2014 -0500
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Mon Dec 29 20:34:20 2014 -0500

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Util/Paths.cs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a57d7201/src/Lucene.Net.TestFramework/Util/Paths.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/Paths.cs b/src/Lucene.Net.TestFramework/Util/Paths.cs
index 108efe1..2685305 100644
--- a/src/Lucene.Net.TestFramework/Util/Paths.cs
+++ b/src/Lucene.Net.TestFramework/Util/Paths.cs
@@ -139,10 +139,23 @@ namespace Lucene.Net.Util
                     // where [Section] is either core, demo, or contrib, and [Build] is either
Debug or Release.
                     string assemblyLocation = AssemblyDirectory;
                     int index = -1;
+
+                    var buildPathPart = Path.DirectorySeparatorChar + "build" + Path.DirectorySeparatorChar;
+                    var binPathPart = Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar;
+
                     if (assemblyLocation.IndexOf("build", StringComparison.InvariantCultureIgnoreCase)
> -1)
-                        index = assemblyLocation.IndexOf(Path.DirectorySeparatorChar + "build"
+ Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase);
+                    {
+                        index = assemblyLocation.IndexOf(buildPathPart, StringComparison.InvariantCultureIgnoreCase);
+                    }
                     else
-                        index = assemblyLocation.IndexOf(Path.DirectorySeparatorChar + "bin"
+ Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase);
+                    {
+                        index = assemblyLocation.IndexOf(binPathPart, StringComparison.InvariantCultureIgnoreCase);
+                    }
+
+                    if (index < 0)
+                    {
+                        throw new ArgumentOutOfRangeException("Could not locate project root
directory in " + assemblyLocation + ", checked " + buildPathPart + " and " + binPathPart);
+                    }
 
                     int difference = assemblyLocation.Substring(index).Count(o => o ==
Path.DirectorySeparatorChar);
 


Mime
View raw message