This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 55c8ac0f32a7a7e2bd4619819d4f21eb6f2d145c Author: Shad Storhaug <[email protected]> AuthorDate: Wed Jul 31 14:52:58 2019 +0700 BUG: Lucene.Net.Util.CommandLineUtil.AdjustDirectoryName - IndexOf comparison must be StringComparison.Ordinal (or in this case, a single char) to be compatible with all cultures/platforms. --- src/Lucene.Net/Util/CommandLineUtil.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net/Util/CommandLineUtil.cs b/src/Lucene.Net/Util/CommandLineUtil.cs index 2d04e65..cf0020b 100644 --- a/src/Lucene.Net/Util/CommandLineUtil.cs +++ b/src/Lucene.Net/Util/CommandLineUtil.cs @@ -89,9 +89,13 @@ namespace Lucene.Net.Util throw new System.ArgumentException("The " + typeof(FSDirectory).Name + " implementation cannot be null or empty"); } - if (clazzName.IndexOf(".") == -1) // if not fully qualified, assume .store + // LUCENENET specific: Changed to use char rather than string so we get StringComparison.Ordinal, + // otherwise this could fail on some operating systems in certain cultures. + if (clazzName.IndexOf('.') == -1) // if not fully qualified, assume .store { - clazzName = typeof(Directory).Namespace + "." + clazzName; + // LUCENENET NOTE: .NET expects the type to be in the currently executing assembly or mscorlib + // if not fully qualified. This fails on macOS if called from LuceneTestCase.NewFSDirectory() without the AssemblyQualifiedName. + clazzName = typeof(Directory).AssemblyQualifiedName.Replace(nameof(Directory), clazzName); } return clazzName; }
