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 2020/07/24 18:10:11 UTC

[lucenenet] 02/02: Lucene.Net.Tests.Analysis.Common: Fixed potential issue with ArgumentExceptions being thrown from char.ConvertToUtf32(string, int) by reverting back to CodePointAt() method in TestCharTokenizers.TestCrossPlaneNomalization().

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 43745dbf2f0f4a20b283d83f17e6d374b4e34944
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 22 18:18:23 2020 +0700

    Lucene.Net.Tests.Analysis.Common: Fixed potential issue with ArgumentExceptions being thrown from char.ConvertToUtf32(string, int) by reverting back to CodePointAt() method in TestCharTokenizers.TestCrossPlaneNomalization().
---
 .../Analysis/Util/TestCharTokenizers.cs                             | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharTokenizers.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharTokenizers.cs
index 51dc9c1..da3e608 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharTokenizers.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharTokenizers.cs
@@ -9,6 +9,7 @@ using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Analysis.Util;
 using Lucene.Net.Util;
 using NUnit.Framework;
+using Lucene.Net.Attributes;
 
 namespace Lucene.Net.Analysis.Util
 {
@@ -135,7 +136,7 @@ namespace Lucene.Net.Analysis.Util
                         var highlightedText = s.Substring(offsetAtt.StartOffset, offsetAtt.EndOffset - offsetAtt.StartOffset);
                         for (int j = 0, cp = 0; j < highlightedText.Length; j += Character.CharCount(cp))
                         {
-                            cp = char.ConvertToUtf32(highlightedText, j);
+                            cp = highlightedText.CodePointAt(j);
                             assertTrue("non-letter:" + cp.ToString("x"), Character.IsLetter(cp));
                         }
                     }
@@ -198,7 +199,7 @@ namespace Lucene.Net.Analysis.Util
                         string highlightedText = s.Substring(offsetAtt.StartOffset, offsetAtt.EndOffset - offsetAtt.StartOffset);
                         for (int j = 0, cp = 0; j < highlightedText.Length; j += Character.CharCount(cp))
                         {
-                            cp = char.ConvertToUtf32(highlightedText, j);
+                            cp = highlightedText.CodePointAt(j);
                             assertTrue("non-letter:" + cp.ToString("x"), Character.IsLetter(cp));
                         }
                     }
@@ -248,6 +249,7 @@ namespace Lucene.Net.Analysis.Util
         /// </summary>
 
         [Test]
+        [LuceneNetSpecific]
         public virtual void TestSurrogates()
         {
             var analyzer = new AnalyzerAnonymousInnerClassHelper3();