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 ada4865773a968a62ce336b1643ba0b39634b9b1 Author: Shad Storhaug <[email protected]> AuthorDate: Wed Sep 4 00:15:31 2019 +0700 Lucene.Net.Spatial.Query.SpatialArgsParser: Fixed number/string conversions to use invariant culture --- src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs | 4 ++-- src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs index fd58b8b..0ce3253 100644 --- a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs +++ b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs @@ -40,9 +40,9 @@ namespace Lucene.Net.Spatial.Prefix.Tree protected SpatialContext m_ctx; protected int? m_maxLevels; - /// <summary>The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".</summary> + /// <summary>The factory is looked up via "prefixTree" in <paramref name="args"/>, expecting "geohash" or "quad".</summary> /// <remarks> - /// The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad". + /// The factory is looked up via "prefixTree" in <paramref name="args"/>, expecting "geohash" or "quad". /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen. /// </remarks> public static SpatialPrefixTree MakeSPT(IDictionary<string, string> args, SpatialContext ctx) diff --git a/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs b/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs index 6254ab7..7a4e054 100644 --- a/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs +++ b/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs @@ -4,6 +4,7 @@ using Spatial4n.Core.Exceptions; using Spatial4n.Core.Shapes; using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; @@ -57,7 +58,7 @@ namespace Lucene.Net.Spatial.Queries str.Append('('); str.Append(args.Shape); if (args.DistErrPct != null) - str.Append(" distErrPct=").Append(string.Format("{0:0.00}%", args.DistErrPct * 100d)); + str.Append(" distErrPct=").Append(string.Format("{0:0.00}%", args.DistErrPct * 100d, CultureInfo.InvariantCulture)); if (args.DistErr != null) str.Append(" distErr=").Append(args.DistErr); str.Append(')'); @@ -137,14 +138,12 @@ namespace Lucene.Net.Spatial.Queries protected static double? ReadDouble(string v) { - double val; - return double.TryParse(v, out val) ? val : (double?)null; + return double.TryParse(v, NumberStyles.Float, CultureInfo.InvariantCulture, out double val) ? val : (double?)null; } protected static bool ReadBool(string v, bool defaultValue) { - bool ret; - return bool.TryParse(v, out ret) ? ret : defaultValue; + return bool.TryParse(v, out bool ret) ? ret : defaultValue; } /// <summary>
