lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [12/27] lucenenet git commit: Lucene.Net.Core.Search.SearcherLifetimeManager: Fixed potential keynotfound bug in Acquire() method
Date Thu, 02 Mar 2017 01:10:55 GMT
Lucene.Net.Core.Search.SearcherLifetimeManager: Fixed potential keynotfound bug in Acquire()
method


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

Branch: refs/heads/api-work
Commit: f2751a4b7b02b86a97696f702a3af10e3cf71455
Parents: 3e43fb2
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Mar 1 23:14:44 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Mar 2 08:08:47 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f2751a4b/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs b/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
index 60ab5ff..d6e2154 100644
--- a/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
+++ b/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
@@ -191,8 +191,8 @@ namespace Lucene.Net.Search
         public virtual IndexSearcher Acquire(long version)
         {
             EnsureOpen();
-            SearcherTracker tracker = _searchers[version]; // LUCENENET TODO: Throws exception
when non-match instead of returning null
-            if (tracker != null && tracker.Searcher.IndexReader.TryIncRef())
+            SearcherTracker tracker;
+            if (_searchers.TryGetValue(version, out tracker) && tracker != null &&
tracker.Searcher.IndexReader.TryIncRef())
             {
                 return tracker.Searcher;
             }


Mime
View raw message