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 2019/08/07 22:26:11 UTC

[lucenenet] 14/42: BUG: Lucene.Net.Util.StringHelper: - Fixed parsing issue converting string to int in ambient culture

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 5a02e176c6b297fdeaaad10cedda425cbe7c2bbd
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 16:15:10 2019 +0700

    BUG: Lucene.Net.Util.StringHelper: - Fixed parsing issue converting string to int in ambient culture
---
 src/Lucene.Net/Util/StringHelper.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net/Util/StringHelper.cs b/src/Lucene.Net/Util/StringHelper.cs
index fe2f12d..03bdca4 100644
--- a/src/Lucene.Net/Util/StringHelper.cs
+++ b/src/Lucene.Net/Util/StringHelper.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 
 namespace Lucene.Net.Util
 {
@@ -114,10 +115,10 @@ namespace Lucene.Net.Util
 
                 while (aTokens.HasMoreTokens())
                 {
-                    int aToken = Convert.ToInt32(aTokens.NextToken());
+                    int aToken = Convert.ToInt32(aTokens.NextToken(), CultureInfo.InvariantCulture);
                     if (bTokens.HasMoreTokens())
                     {
-                        int bToken = Convert.ToInt32(bTokens.NextToken());
+                        int bToken = Convert.ToInt32(bTokens.NextToken(), CultureInfo.InvariantCulture);
                         if (aToken != bToken)
                         {
                             return aToken < bToken ? -1 : 1;
@@ -136,7 +137,7 @@ namespace Lucene.Net.Util
                 // b has some extra trailing tokens. if these are all zeroes, thats ok.
                 while (bTokens.HasMoreTokens())
                 {
-                    if (Convert.ToInt32(bTokens.NextToken()) != 0)
+                    if (Convert.ToInt32(bTokens.NextToken(), CultureInfo.InvariantCulture) != 0)
                     {
                         return -1;
                     }