lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 16/42: Lucene.Net.TestFramework.Util.LuceneTestCase: Throw explicit exception if Directory type cannot be resolved
Date Wed, 07 Aug 2019 22:26:13 GMT
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 5481d71be0219a80564e85e749b7d749ca80e17f
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Wed Jul 31 21:41:50 2019 +0700

    Lucene.Net.TestFramework.Util.LuceneTestCase: Throw explicit exception if Directory type
cannot be resolved
---
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index a2a2b67..ad36742 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -1515,8 +1515,10 @@ namespace Lucene.Net.Util
             }
 
             Type clazz = CommandLineUtil.LoadDirectoryClass(clazzName);
+            if (clazz == null)
+                throw new InvalidOperationException($"Type '{clazzName}' could not be instantiated.");
             // If it is a FSDirectory type, try its ctor(File)
-            if (clazz.GetTypeInfo().IsSubclassOf(typeof(FSDirectory)))
+            if (typeof(FSDirectory).IsAssignableFrom(clazz))
             {
                 DirectoryInfo dir = CreateTempDir("index-" + clazzName);
                 dir.Create(); // ensure it's created so we 'have' it.


Mime
View raw message