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:06 UTC

[lucenenet] 09/42: BUG: Lucene.Net.Benchmark.ByTask.Utils.Config: Fixed FormatException caused by converting number to string in ambient culture and parsing it back to a number in invariant 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 2803600a8b69b45a103c440e4dcaceb6b409ae06
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 06:56:59 2019 +0700

    BUG: Lucene.Net.Benchmark.ByTask.Utils.Config: Fixed FormatException caused by converting number to string in ambient culture and parsing it back to a number in invariant culture
---
 src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
index 53e8afd..4f11292 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
@@ -234,7 +234,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
             if (sval.IndexOf(":") < 0)
             {
@@ -274,7 +274,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
             if (sval.IndexOf(":") < 0)
             {
@@ -313,7 +313,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(); // LUCENENET NOTE: bool ignores the IFormatProvider argument, it returns the values of constants
             }
             if (sval.IndexOf(":") < 0)
             {