You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2016/10/11 18:35:30 UTC

[45/47] lucenenet git commit: Fixed missing using clause and invalid attempt to decrement countdown below 0 (for some reason 2 doesn't work, but checking the count before decrementing does).

Fixed missing using clause and invalid attempt to decrement countdown below 0 (for some reason 2 doesn't work, but checking the count before decrementing does).


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

Branch: refs/heads/master
Commit: fbc171b3930ff58b9087ea9e4affeed0f14c1f7c
Parents: eb6fd3a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Oct 11 07:40:45 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Oct 12 01:10:59 2016 +0700

----------------------------------------------------------------------
 .../core/Index/TestIndexWriterWithThreads.cs        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fbc171b3/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
index e80286e..103248f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
@@ -631,17 +631,21 @@ namespace Lucene.Net.Index
                     Document doc = new Document();
                     Field field = OuterInstance.NewTextField("field", "testData", Field.Store.YES);
                     doc.Add(field);
-                    IndexWriter writer = new IndexWriter(Dir, OuterInstance.NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
-                    IwConstructed.Signal();
-                    StartIndexing_Renamed.Wait();
-                    writer.AddDocument(doc);
-                    writer.Dispose();
+                    using (IndexWriter writer = new IndexWriter(Dir, OuterInstance.NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))))
+                    {
+                        if (IwConstructed.CurrentCount > 0)
+                        {
+                            IwConstructed.Signal();
+                        }
+                        StartIndexing_Renamed.Wait();
+                        writer.AddDocument(doc);
+                    }
                 }
                 catch (Exception e)
                 {
                     Failed = true;
                     Failure = e;
-                    Console.WriteLine(e.StackTrace);
+                    Console.WriteLine(e.ToString());
                     return;
                 }
             }