lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [01/15] lucenenet git commit: Fixed bug in AssemblyExtensions.TryFindResource - we need to test the full path before the first slice is done.
Date Sat, 08 Apr 2017 21:37:51 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work e262d6f45 -> 86401a95c


Fixed bug in AssemblyExtensions.TryFindResource - we need to test the full path before the
first slice is done.


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

Branch: refs/heads/api-work
Commit: a9028b74c492670ad0dd6e5213f048b77288ea72
Parents: e262d6f
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Apr 9 00:27:14 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Apr 9 00:27:14 2017 +0700

----------------------------------------------------------------------
 .../Egothor.Stemmer/TestCompile.cs                        | 10 +++++-----
 src/Lucene.Net/Support/AssemblyExtensions.cs              |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a9028b74/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
index b8dec71..690d905 100644
--- a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
+++ b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
@@ -1,10 +1,10 @@
-´╗┐using Lucene.Net.Support;
+´╗┐using Lucene.Net;
+using Lucene.Net.Support;
 using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 using System.IO;
 using System.Text;
-using System.Reflection;
 
 /*
  Egothor Software License version 1.00
@@ -72,7 +72,7 @@ namespace Egothor.Stemmer
             dir.Create();
             FileInfo output;
 
-            using (Stream input = GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(),
"testRules.txt"))
+            using (Stream input = GetType().getResourceAsStream("testRules.txt"))
             {
                 output = new FileInfo(Path.Combine(dir.FullName, "testRules.txt"));
                 Copy(input, output);
@@ -92,7 +92,7 @@ namespace Egothor.Stemmer
             DirectoryInfo dir = CreateTempDir("testCompile");
             dir.Create();
             FileInfo output;
-            using (Stream input = GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(),
"testRules.txt"))
+            using (Stream input = GetType().getResourceAsStream("testRules.txt"))
             {
                 output = new FileInfo(Path.Combine(dir.FullName, "testRules.txt"));
                 Copy(input, output);
@@ -112,7 +112,7 @@ namespace Egothor.Stemmer
             DirectoryInfo dir = CreateTempDir("testCompile");
             dir.Create();
             FileInfo output;
-            using (Stream input = GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(),
"testRules.txt"))
+            using (Stream input = GetType().getResourceAsStream("testRules.txt"))
             {
                 output = new FileInfo(Path.Combine(dir.FullName, "testRules.txt"));
                 Copy(input, output);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a9028b74/src/Lucene.Net/Support/AssemblyExtensions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/AssemblyExtensions.cs b/src/Lucene.Net/Support/AssemblyExtensions.cs
index 1269ce1..6bdc039 100644
--- a/src/Lucene.Net/Support/AssemblyExtensions.cs
+++ b/src/Lucene.Net/Support/AssemblyExtensions.cs
@@ -86,7 +86,6 @@ namespace Lucene.Net.Support
                 string nameToFind = null;
                 while (resourceName.Length > 0 && resourceName.Contains('.') &&
(!(string.IsNullOrEmpty(prefix)) || resourceName.Equals(exactResourceName)))
                 {
-                    resourceName = resourceName.Substring(resourceName.IndexOf('.') + 1);
                     nameToFind = string.IsNullOrEmpty(prefix)
                         ? resourceName
                         : string.Concat(prefix, ".", resourceName);
@@ -101,6 +100,8 @@ namespace Lucene.Net.Support
                         result = matches[0]; // First of many
                         return false;
                     }
+
+                    resourceName = resourceName.Substring(resourceName.IndexOf('.') + 1);
                 }
                 result = null; // No match
                 return false;


Mime
View raw message