lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [6/8] lucenenet git commit: Lucene.Net.Codecs.Lucene40: Possible issues if Debug.Assert is compiled out, since methods asserted change state
Date Sun, 09 Apr 2017 13:08:53 GMT
Lucene.Net.Codecs.Lucene40: Possible issues if Debug.Assert is compiled out, since methods
asserted change state


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

Branch: refs/heads/api-work
Commit: e35087d6d618ec0e04a00e27e5724ea38f4a95f4
Parents: 5a2d9e4
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Apr 9 18:40:01 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Apr 9 18:40:01 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Codecs/Lucene40/BitVector.cs              | 9 ++++++---
 src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs | 6 ++++--
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e35087d6/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene40/BitVector.cs b/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
index 39af20a..640b453 100644
--- a/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
@@ -279,7 +279,8 @@ namespace Lucene.Net.Codecs.Lucene40
                     WriteBits(output);
                 }
                 CodecUtil.WriteFooter(output);
-                Debug.Assert(VerifyCount());
+                bool verified = VerifyCount();
+                Debug.Assert(verified);
             }
             finally
             {
@@ -464,7 +465,8 @@ namespace Lucene.Net.Codecs.Lucene40
                     CodecUtil.CheckEOF(input);
 #pragma warning restore 612, 618
                 }
-                Debug.Assert(VerifyCount());
+                bool verified = VerifyCount();
+                Debug.Assert(verified);
             }
             finally
             {
@@ -478,7 +480,8 @@ namespace Lucene.Net.Codecs.Lucene40
             Debug.Assert(count != -1);
             int countSav = count;
             count = -1;
-            Debug.Assert(countSav == Count(), "saved count was " + countSav + " but recomputed
count is " + count);
+            bool checkCount = countSav == Count();
+            Debug.Assert(checkCount, "saved count was " + countSav + " but recomputed count
is " + count);
             return true;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e35087d6/src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs
index c19047d..cd81003 100644
--- a/src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40LiveDocsFormat.cs
@@ -90,7 +90,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             string filename = IndexFileNames.FileNameFromGeneration(info.Info.Name, DELETES_EXTENSION,
info.DelGen);
             BitVector liveDocs = new BitVector(dir, filename, context);
-            Debug.Assert(liveDocs.Count() == info.Info.DocCount - info.DelCount, "liveDocs.count()="
+ liveDocs.Count() + " info.docCount=" + info.Info.DocCount + " info.getDelCount()=" + info.DelCount);
+            int liveDocsCount = liveDocs.Count();
+            Debug.Assert(liveDocsCount == info.Info.DocCount - info.DelCount, "liveDocs.count()="
+ liveDocsCount + " info.docCount=" + info.Info.DocCount + " info.getDelCount()=" + info.DelCount);
             Debug.Assert(liveDocs.Length == info.Info.DocCount);
             return liveDocs;
         }
@@ -99,7 +100,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             string filename = IndexFileNames.FileNameFromGeneration(info.Info.Name, DELETES_EXTENSION,
info.NextDelGen);
             BitVector liveDocs = (BitVector)bits;
-            Debug.Assert(liveDocs.Count() == info.Info.DocCount - info.DelCount - newDelCount);
+            int liveDocsCount = liveDocs.Count();
+            Debug.Assert(liveDocsCount == info.Info.DocCount - info.DelCount - newDelCount);
             Debug.Assert(liveDocs.Length == info.Info.DocCount);
             liveDocs.Write(dir, filename, context);
         }


Mime
View raw message