You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2015/02/04 00:56:33 UTC
[1/2] lucenenet git commit: The checks in the stack trace to decide
where the error was from were using the wrong variables to get the type of
the object the method in the stack was calling from. Changed
frame.GetType().Name to method.DeclaringType.Name
Repository: lucenenet
Updated Branches:
refs/heads/master 0275b4daf -> 511507fbb
The checks in the stack trace to decide where the error was from were using the wrong variables to get the type of the object the method in the stack was calling from. Changed frame.GetType().Name to method.DeclaringType.Name and fixed some casing problems in the constants.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/692b43c3
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/692b43c3
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/692b43c3
Branch: refs/heads/master
Commit: 692b43c3dcd3c93bc1ec216fc309c581c991a65e
Parents: 0275b4d
Author: Chand2048 <Ch...@Microsoft.com>
Authored: Mon Feb 2 09:53:29 2015 -0800
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Feb 4 01:48:18 2015 +0200
----------------------------------------------------------------------
.../core/Index/TestIndexWriterExceptions.cs | 23 ++++++++++----------
1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/692b43c3/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 2a4963b..aec7be5 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -705,7 +705,7 @@ namespace Lucene.Net.Index
{
break;
}
- if (typeof(FreqProxTermsWriterPerField).Name.Equals(frame.GetType().Name) && "Flush".Equals(method.Name))
+ if (typeof(FreqProxTermsWriterPerField).Name.Equals(method.DeclaringType.Name) && "Flush".Equals(method.Name))
{
sawAppend = true;
}
@@ -1055,7 +1055,7 @@ namespace Lucene.Net.Index
foreach (var frame in trace.GetFrames())
{
var method = frame.GetMethod();
- if (DoFail && typeof(MockDirectoryWrapper).Name.Equals(frame.GetType().Name) && "Sync".Equals(method.Name))
+ if (DoFail && typeof(MockDirectoryWrapper).Name.Equals(method.DeclaringType.Name) && "Sync".Equals(method.Name))
{
DidFail = true;
if (VERBOSE)
@@ -1120,8 +1120,8 @@ namespace Lucene.Net.Index
{
internal bool FailOnCommit, FailOnDeleteFile;
internal readonly bool DontFailDuringGlobalFieldMap;
- internal const string PREPARE_STAGE = "prepareCommit";
- internal const string FINISH_STAGE = "finishCommit";
+ internal const string PREPARE_STAGE = "PrepareCommit";
+ internal const string FINISH_STAGE = "FinishCommit";
internal readonly string Stage;
public FailOnlyInCommit(bool dontFailDuringGlobalFieldMap, string stage)
@@ -1132,7 +1132,7 @@ namespace Lucene.Net.Index
public override void Eval(MockDirectoryWrapper dir)
{
- var trace = new StackTrace(new Exception());
+ var trace = new StackTrace();
bool isCommit = false;
bool isDelete = false;
bool isInGlobalFieldMap = false;
@@ -1143,15 +1143,16 @@ namespace Lucene.Net.Index
{
break;
}
- if (typeof(SegmentInfos).Name.Equals(frame.GetType().Name) && Stage.Equals(method.Name))
+
+ if (typeof(SegmentInfos).Name.Equals(method.DeclaringType.Name) && Stage.Equals(method.Name))
{
isCommit = true;
}
- if (typeof(MockDirectoryWrapper).Name.Equals(frame.GetType().Name) && "DeleteFile".Equals(method.Name))
+ if (typeof(MockDirectoryWrapper).Name.Equals(method.DeclaringType.Name) && "DeleteFile".Equals(method.Name))
{
isDelete = true;
}
- if (typeof(SegmentInfos).Name.Equals(frame.GetType().Name) && "WriteGlobalFieldMap".Equals(method.Name))
+ if (typeof(SegmentInfos).Name.Equals(method.DeclaringType.Name) && "WriteGlobalFieldMap".Equals(method.Name))
{
isInGlobalFieldMap = true;
}
@@ -1660,8 +1661,8 @@ namespace Lucene.Net.Index
private class FailOnTermVectors : MockDirectoryWrapper.Failure
{
- internal const string INIT_STAGE = "initTermVectorsWriter";
- internal const string AFTER_INIT_STAGE = "finishDocument";
+ internal const string INIT_STAGE = "InitTermVectorsWriter";
+ internal const string AFTER_INIT_STAGE = "FinishDocument";
internal const string EXC_MSG = "FOTV";
internal readonly string Stage;
@@ -1677,7 +1678,7 @@ namespace Lucene.Net.Index
foreach (var frame in trace.GetFrames())
{
var method = frame.GetMethod();
- if (typeof(TermVectorsConsumer).Name.Equals(frame.GetType().Name) && Stage.Equals(method.Name))
+ if (typeof(TermVectorsConsumer).Name.Equals(method.DeclaringType.Name) && Stage.Equals(method.Name))
{
fail = true;
break;
[2/2] lucenenet git commit: Missing the IndexWriterConfig was missing
SetCheckIntegrityAtMerge method.
Posted by sy...@apache.org.
Missing the IndexWriterConfig was missing SetCheckIntegrityAtMerge method.
C# does not have the synthetic flag so I changed it to look at the DeclaringType of the method to understand if it was a method from the LiveIndexWriterConfig. This allowed me to enable the check to ensure all setters are properly overridden.
Conflicts:
src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/511507fb
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/511507fb
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/511507fb
Branch: refs/heads/master
Commit: 511507fbb12cc0a34cf34a58a3ef7cecb46cc1e0
Parents: 692b43c
Author: Chand2048 <Ch...@Microsoft.com>
Authored: Mon Feb 2 11:33:20 2015 -0800
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Feb 4 01:49:46 2015 +0200
----------------------------------------------------------------------
src/Lucene.Net.Core/Index/IndexWriterConfig.cs | 5 +++++
.../core/Index/TestIndexWriterConfig.cs | 16 ++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/511507fb/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
index ed6c6e5..cf13334 100644
--- a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
@@ -704,6 +704,11 @@ namespace Lucene.Net.Index
return (IndexWriterConfig)base.SetUseCompoundFile(useCompoundFile);
}
+ public IndexWriterConfig SetCheckIntegrityAtMerge(bool checkIntegrityAtMerge)
+ {
+ return (IndexWriterConfig)base.SetCheckIntegrityAtMerge(checkIntegrityAtMerge);
+ }
+
public override string ToString()
{
StringBuilder sb = new StringBuilder(base.ToString());
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/511507fb/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
index 514b7f0..215d1d4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
@@ -127,28 +127,28 @@ namespace Lucene.Net.Index
HashSet<string> allSetters = new HashSet<string>();
foreach (MethodInfo m in typeof(IndexWriterConfig).GetMethods())
{
- if (m.Name.StartsWith("set") && !m.IsStatic)
+ if (m.Name.StartsWith("Set") && !m.IsStatic)
{
allSetters.Add(m.Name);
// setters overridden from LiveIndexWriterConfig are returned twice, once with
// IndexWriterConfig return type and second with LiveIndexWriterConfig. The ones
// from LiveIndexWriterConfig are marked 'synthetic', so just collect them and
// assert in the end that we also received them from IWC.
- // LUCENENET TODO
- /*if (m.Synthetic)
+ // In C# we do not have them marked synthetic so we look at the declaring type instead.
+ if (m.DeclaringType.Name == "LiveIndexWriterConfig")
{
liveSetters.Add(m.Name);
}
else
- {*/
- Assert.AreEqual(typeof(IndexWriterConfig), m.ReturnType, "method " + m.Name + " does not return IndexWriterConfig");
- //}
+ {
+ Assert.AreEqual(typeof(IndexWriterConfig), m.ReturnType, "method " + m.Name + " does not return IndexWriterConfig");
+ }
}
}
- /*foreach (string setter in liveSetters)
+ foreach (string setter in liveSetters)
{
Assert.IsTrue(allSetters.Contains(setter), "setter method not overridden by IndexWriterConfig: " + setter);
- }*/
+ }
}
[Test]