lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject lucenenet git commit: BUG: Fixed Lucene.Net.Analysis.Common.Compound.Hyphenation for .NET Core to ignore the DTD (since it is not supported). Removed DtdProcessingTestAttribute, since its only purpose was to ignore the errors thrown by the software (rath
Date Sat, 11 Mar 2017 08:31:29 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work 7c282a491 -> de4e99504


BUG: Fixed Lucene.Net.Analysis.Common.Compound.Hyphenation for .NET Core to ignore the DTD
(since it is not supported). Removed DtdProcessingTestAttribute, since its only purpose was
to ignore the errors thrown by the software (rather than addressing them). Left the FEATURE_DTD_PROCESSING
symbol in place, but it is likely that when DTD support is added to .NET Core this code will
need to change anyway.


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

Branch: refs/heads/api-work
Commit: de4e99504698e4290f430413c2d52c27cd15894c
Parents: 7c282a4
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Mar 11 15:22:12 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sat Mar 11 15:22:12 2017 +0700

----------------------------------------------------------------------
 .../Compound/Hyphenation/HyphenationTree.cs      | 10 +++++++---
 .../Compound/Hyphenation/PatternParser.cs        | 10 +++++++---
 .../Attributes/DtdProcessingTestAttribute.cs     | 19 -------------------
 .../Lucene.Net.TestFramework.csproj              |  1 -
 .../Compound/TestCompoundWordTokenFilter.cs      |  5 -----
 ...tHyphenationCompoundWordTokenFilterFactory.cs |  2 --
 .../Analysis/Core/TestRandomChains.cs            |  1 -
 7 files changed, 14 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
index 6f2af07..5f65b54 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
@@ -178,15 +178,19 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         {
             // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed
in.
             var xmlReaderSettings =
-#if FEATURE_DTD_PROCESSING
                 new XmlReaderSettings
                 {
+                    // DTD Processing currently is
+                    // not supported in .NET Standard but will come back in .NET Standard
2.0.
+                    // https://github.com/dotnet/corefx/issues/4376.
+#if FEATURE_DTD_PROCESSING
                     DtdProcessing = DtdProcessing.Parse,
                     XmlResolver = new PatternParser.DtdResolver()
-                };
 #else
-                new XmlReaderSettings();
+                    DtdProcessing = DtdProcessing.Ignore
 #endif
+                };
+
             using (var reader = XmlReader.Create(new StreamReader(source, encoding), xmlReaderSettings))
             {
                 LoadPatterns(reader);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
index 9bbe391..4070466 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
@@ -206,15 +206,19 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         private XmlReaderSettings GetXmlReaderSettings()
         {
             return
-#if FEATURE_DTD_PROCESSING
+
                 new XmlReaderSettings
                 {
+                    // DTD Processing currently is
+                    // not supported in .NET Standard but will come back in .NET Standard
2.0.
+                    // https://github.com/dotnet/corefx/issues/4376.
+#if FEATURE_DTD_PROCESSING
                     DtdProcessing = DtdProcessing.Parse,
                     XmlResolver = new DtdResolver()
-                };
 #else
-                new XmlReaderSettings();
+                    DtdProcessing = DtdProcessing.Ignore
 #endif
+                };
         }
 
         private IDictionary<string, string> GetAttributes(XmlReader node)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.TestFramework/Attributes/DtdProcessingTestAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Attributes/DtdProcessingTestAttribute.cs b/src/Lucene.Net.TestFramework/Attributes/DtdProcessingTestAttribute.cs
deleted file mode 100644
index 8cde504..0000000
--- a/src/Lucene.Net.TestFramework/Attributes/DtdProcessingTestAttribute.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using NUnit.Framework;
-
-namespace Lucene.Net.Attributes
-{
-    /// <summary>
-    /// Indicates that this test requires XML DTD Processing. Currently is
-    /// not supported in .NET Standard but will come back in .NET Standard 2.0.
-    /// https://github.com/dotnet/corefx/issues/4376.
-    /// This feature is compiled out with preprocessor FEATURE_DTD_PROCESSING in:
-    /// <see cref="Lucene.Net.Analysis.Compound.Hyphenation.HyphenationTree.LoadPatterns(System.IO.Stream,
System.Text.Encoding)"/>
-    /// <see cref="Lucene.Net.Analysis.Compound.Hyphenation.PatternParser.GetXmlReaderSettings()"/>
-    /// </summary>
-    public class DtdProcessingTestAttribute : CategoryAttribute
-    {
-        public DtdProcessingTestAttribute() : base("DtdProcessingTest")
-        {
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index 63771dd..1cea358 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -118,7 +118,6 @@
     <Compile Include="Analysis\VocabularyAssert.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Attributes\DtdProcessingTestAttribute.cs" />
     <Compile Include="Attributes\HasTimeoutAttribute.cs" />
     <Compile Include="Attributes\LongRunningTestAttribute.cs" />
     <Compile Include="Attributes\LuceneNetSpecificAttribute.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestCompoundWordTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestCompoundWordTokenFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestCompoundWordTokenFilter.cs
index 3154f2d..a9930b0 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestCompoundWordTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestCompoundWordTokenFilter.cs
@@ -37,7 +37,6 @@ namespace Lucene.Net.Analysis.Compound
         }
 
         [Test]
-        [DtdProcessingTest]
         public virtual void TestHyphenationCompoundWordsDA()
         {
             CharArraySet dict = makeDictionary("læse", "hest");
@@ -53,7 +52,6 @@ namespace Lucene.Net.Analysis.Compound
         }
 
         [Test]
-        [DtdProcessingTest]
         public virtual void TestHyphenationCompoundWordsDELongestMatch()
         {
             CharArraySet dict = makeDictionary("basketball", "basket", "ball", "kurv");
@@ -74,7 +72,6 @@ namespace Lucene.Net.Analysis.Compound
         /// This can be controlled with the min/max subword size.
         /// </summary>
         [Test]
-        [DtdProcessingTest]
         public virtual void TestHyphenationOnly()
         {
             //InputSource @is = new InputSource(this.GetType().getResource("da_UTF8.xml").toExternalForm());
@@ -283,7 +280,6 @@ namespace Lucene.Net.Analysis.Compound
         /// <summary>
         /// blast some random strings through the analyzer </summary>
         [Test]
-        [DtdProcessingTest]
         public virtual void TestRandomStrings()
         {
             CharArraySet dict = makeDictionary("a", "e", "i", "o", "u", "y", "bc", "def");
@@ -341,7 +337,6 @@ namespace Lucene.Net.Analysis.Compound
         }
 
         [Test]
-        [DtdProcessingTest]
         public virtual void TestEmptyTerm()
         {
             CharArraySet dict = makeDictionary("a", "e", "i", "o", "u", "y", "bc", "def");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestHyphenationCompoundWordTokenFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestHyphenationCompoundWordTokenFilterFactory.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestHyphenationCompoundWordTokenFilterFactory.cs
index d5f5690..a6878db 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestHyphenationCompoundWordTokenFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Compound/TestHyphenationCompoundWordTokenFilterFactory.cs
@@ -31,7 +31,6 @@ namespace Lucene.Net.Analysis.Compound
         /// Ensure the factory works with hyphenation grammar+dictionary: using default options.
         /// </summary>
         [Test]
-        [DtdProcessingTest]
         public virtual void TestHyphenationWithDictionary()
         {
             TextReader reader = new StringReader("min veninde som er lidt af en læsehest");
@@ -47,7 +46,6 @@ namespace Lucene.Net.Analysis.Compound
         /// its generally necessary to tweak these, or you get lots of expansions.
         /// </summary>
         [Test]
-        [DtdProcessingTest]
         public virtual void TestHyphenationOnly()
         {
             TextReader reader = new StringReader("basketballkurv");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/de4e9950/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index 0394100..19e9253 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -1138,7 +1138,6 @@ namespace Lucene.Net.Analysis.Core
         }
 
         [Test, LongRunningTest]
-        [DtdProcessingTest]
         public void TestRandomChains_()
         {
             int numIterations = AtLeast(20);


Mime
View raw message