From 2b278b306c22b749a4f6afd433bbca31b7de92fb Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Mon, 26 Apr 2021 10:57:42 +0700 Subject: [PATCH] Lucene.Net.QueryParser.Flexible.Standard.Processors: Changed numeric processors back to using FormatException, because that is the expected parse error in .NET (see #446) --- .../Flexible/Standard/Processors/NumericQueryNodeProcessor.cs | 2 +- .../Standard/Processors/NumericRangeQueryNodeProcessor.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs index 43c764fa73..8475cd724a 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs @@ -89,7 +89,7 @@ protected override IQueryNode PostProcessNode(IQueryNode node) { number = numberFormat.Parse(text); } - catch (Exception e) when (e.IsParseException()) + catch (FormatException e) // LUCENENET: In .NET we are expecting the framework to throw FormatException, not ParseException { throw new QueryNodeParseException(new Message( QueryParserMessages.COULD_NOT_PARSE_NUMBER, fieldNode diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs index 226465ca20..c1e2dda1d7 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs @@ -87,7 +87,7 @@ protected override IQueryNode PostProcessNode(IQueryNode node) { lowerNumber = numberFormat.Parse(lowerText); } - catch (Exception e) when (e.IsParseException()) + catch (FormatException e) // LUCENENET: In .NET we are expecting the framework to throw FormatException, not ParseException { throw new QueryNodeParseException(new Message( QueryParserMessages.COULD_NOT_PARSE_NUMBER, lower @@ -101,7 +101,7 @@ protected override IQueryNode PostProcessNode(IQueryNode node) { upperNumber = numberFormat.Parse(upperText); } - catch (Exception e) when (e.IsParseException()) + catch (FormatException e) // LUCENENET: In .NET we are expecting the framework to throw FormatException, not ParseException { throw new QueryNodeParseException(new Message( QueryParserMessages.COULD_NOT_PARSE_NUMBER, upper