lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [16/20] lucenenet git commit: BUG: Fixed culture issue with parsing numbers from string in Lucene.Net.Expressions.JS.JavascriptCompiler
Date Tue, 28 Feb 2017 12:30:07 GMT
BUG: Fixed culture issue with parsing numbers from string in Lucene.Net.Expressions.JS.JavascriptCompiler


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

Branch: refs/heads/api-work
Commit: 3ad36c4d33a366c6fa57f582c65b583229ed157f
Parents: e9ec2ab
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Feb 28 18:19:30 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Feb 28 18:19:30 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3ad36c4d/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index 1f631db..15d0de2 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -4,6 +4,7 @@ using Lucene.Net.Queries.Function;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -305,19 +306,19 @@ namespace Lucene.Net.Expressions.JS
                         if (bitwiseOps.Any(s => sourceText.Contains(s)))
                         {
                             int val;
-                            if (int.TryParse(text, out val))
+                            if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture,
out val))
                             {
                                 gen.Emit(OpCodes.Ldc_I4, val);
                             }
                             else
                             {
-                                gen.Emit(OpCodes.Ldc_I8,long.Parse(text));
+                                gen.Emit(OpCodes.Ldc_I8,long.Parse(text, CultureInfo.InvariantCulture));
                                 gen.Emit(OpCodes.Conv_Ovf_U4_Un);
                             }
                         }
                         else
                         {
-                            gen.Emit(OpCodes.Ldc_R8, double.Parse(text));
+                            gen.Emit(OpCodes.Ldc_R8, double.Parse(text, CultureInfo.InvariantCulture));
                         }
                         break;
                     }


Mime
View raw message