diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilterFactory.cs index 1752eab242..c2d6493a16 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilterFactory.cs @@ -94,7 +94,7 @@ public virtual void Inform(IResourceLoader loader) this.dictionary = new Dictionary(affix, dictionaries, ignoreCase); } - catch (Exception e) + catch (Exception e) when (e.IsParseException()) { throw new IOException("Unable to load hunspell data! [dictionary=" + dictionaries + ",affix=" + affixFile + "]", e); } diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs index bdc2328f87..d8babea675 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs @@ -1,4 +1,4 @@ -// Lucene version compatibility level 4.8.1 +// Lucene version compatibility level 4.8.1 using Lucene.Net.Analysis.TokenAttributes; using Lucene.Net.Util; using System; @@ -144,14 +144,14 @@ public override bool Accept(AttributeSource source) m_termAtt = source.AddAttribute(); } - DateTime date; //We don't care about the date, just that we can parse it as a date + //We don't care about the date, just that we can parse it as a date if (m_formats == null) { - return DateTime.TryParse(m_termAtt.ToString(), m_culture, m_style, out date); + return DateTime.TryParse(m_termAtt.ToString(), m_culture, m_style, out _); } else { - return DateTime.TryParseExact(m_termAtt.ToString(), m_formats, m_culture, m_style, out date); + return DateTime.TryParseExact(m_termAtt.ToString(), m_formats, m_culture, m_style, out _); } } } diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs index f292d15af5..9aa8336270 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs @@ -105,7 +105,7 @@ public void Inform(IResourceLoader loader) // TODO: expose dedup as a parameter? map = LoadSynonyms(loader, formatClass, true, analyzer); } - catch (Exception e) + catch (Exception e) when (e.IsParseException()) { throw new IOException("Error parsing synonyms file:", e); } diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs index 97bcbea41e..36d915a8ac 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs @@ -136,7 +136,7 @@ public override void Parse(TextReader @in) } catch (Exception e) when (e.IsIllegalArgumentException()) { - throw new Exception("Invalid synonym rule at line " + lineNumber, e); + throw new FormatException("Invalid synonym rule at line " + lineNumber, e); //ex.initCause(e); //throw ex; } diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs index 7be8f1e3a8..682a41cac8 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs @@ -80,7 +80,7 @@ public override void Parse(TextReader @in) } catch (Exception e) when (e.IsIllegalArgumentException()) { - throw new Exception("Invalid synonym rule at line " + lineNumber.ToString(), e); + throw new FormatException("Invalid synonym rule at line " + lineNumber.ToString(), e); } finally { diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs index a97ebf66b9..ad941169c2 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs @@ -96,7 +96,7 @@ protected override Query[] PrepareQueries() { qq.Add(qp.Parse(line)); } - catch (ParseException e) + catch (Lucene.Net.QueryParsers.Classic.ParseException e) { Console.Error.WriteLine("Exception: " + e.Message + " occurred while parsing line: " + lineNum + " Text: " + line); } diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs index 15e943a7a5..b35e39e390 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs @@ -172,7 +172,7 @@ public override void SetParams(string @params) { intArgValue = int.Parse(argValue, CultureInfo.InvariantCulture); } - catch (FormatException e) + catch (Exception e) when (e.IsParseException()) { throw new Exception ("Line #" + GetLineNumber(stok) + ": Exception parsing " + argName + " value '" + argValue + "'", e); @@ -204,7 +204,7 @@ public override void SetParams(string @params) { intArgValue = int.Parse(argValue, CultureInfo.InvariantCulture); } - catch (FormatException e) + catch (Exception e) when (e.IsParseException()) { throw new Exception ("Line #" + GetLineNumber(stok) + ": Exception parsing " + argName + " value '" + argValue + "'", e); @@ -257,7 +257,7 @@ public override void SetParams(string @params) { intArgValue = int.Parse(stok.StringValue.Trim(), CultureInfo.InvariantCulture); } - catch (FormatException e) + catch (Exception e) when (e.IsParseException()) { throw new Exception ("Line #" + GetLineNumber(stok) + ": Exception parsing " + argName + " value '" + stok.StringValue + "'", e); diff --git a/src/Lucene.Net.Benchmark/Quality/QualityQuery.cs b/src/Lucene.Net.Benchmark/Quality/QualityQuery.cs index f849b49c05..1074d1a2ff 100644 --- a/src/Lucene.Net.Benchmark/Quality/QualityQuery.cs +++ b/src/Lucene.Net.Benchmark/Quality/QualityQuery.cs @@ -93,7 +93,7 @@ public virtual int CompareTo(QualityQuery other) int nOther = int.Parse(other.queryID, CultureInfo.InvariantCulture); return n - nOther; } - catch (FormatException /*e*/) + catch (Exception e) when (e.IsParseException()) { // fall back to string comparison return queryID.CompareToOrdinal(other.queryID); diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs index c63fb0edd7..8f98eede3a 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs @@ -4,9 +4,7 @@ using Lucene.Net.Util; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; -using System.IO; using System.Text; namespace Lucene.Net.Codecs.SimpleText @@ -289,9 +287,9 @@ public override void Get(int docId, BytesRef result) len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); } - catch (FormatException ex) + catch (Exception pe) when (pe.IsParseException()) { - throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", pe); } result.Bytes = new byte[len]; @@ -345,9 +343,9 @@ public bool Get(int index) len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Number, CultureInfo.InvariantCulture); } - catch (FormatException ex) + catch (Exception pe) when (pe.IsParseException()) { - throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", pe); } // skip past bytes @@ -413,7 +411,7 @@ public override int GetOrd(int docId) // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. return int.Parse(_scratch.Utf8ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1; } - catch (Exception pe) + catch (Exception pe) when (pe.IsParseException()) { var e = new CorruptIndexException($"failed to parse ord (resource={_input})", pe); throw e; @@ -443,9 +441,8 @@ public override void LookupOrd(int ord, BytesRef result) // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); - } - catch (Exception pe) + catch (Exception pe) when (pe.IsParseException()) { var e = new CorruptIndexException($"failed to parse int length (resource={_input})", pe); throw e; @@ -547,7 +544,7 @@ public override void LookupOrd(long ord, BytesRef result) len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); } - catch (Exception pe) + catch (Exception pe) when (pe.IsParseException()) { var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); throw e; diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs index 285455888b..0844a19ebc 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs @@ -117,9 +117,7 @@ internal class JavascriptLexer : Lexer public override void DisplayRecognitionError(string[] tokenNames, RecognitionException re) { string message = " unexpected character '" + (char)re.Character + "' at position (" + re.CharPositionInLine + ")."; - ParseException parseException = new ParseException(message, re.CharPositionInLine); - - throw new InvalidOperationException(parseException.Message, parseException); + throw new ParseException(message, re.CharPositionInLine); } // delegates @@ -2178,35 +2176,4 @@ public override string Description #pragma warning restore IDE0052 // Remove unread private members } } - - // LUCENENET: It is no longer good practice to use binary serialization. - // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 -#if FEATURE_SERIALIZABLE_EXCEPTIONS - [Serializable] -#endif - public class ParseException : Exception - { - public ParseException(string message, int charPositionInLine) - : base(message + ": " + charPositionInLine) - { - } - - // LUCENENET: For testing purposes - internal ParseException(string message) - : base(message) - { - } - -#if FEATURE_SERIALIZABLE_EXCEPTIONS - /// - /// Initializes a new instance of this class with serialized data. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected ParseException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } } diff --git a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs index 8da6329b99..95d7fbc887 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs @@ -1,4 +1,4 @@ -/* +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -205,9 +205,7 @@ public override void DisplayRecognitionError(string[] tokenNames, RecognitionExc } } } - //ParseException parseException = new ParseException(message, re.CharPositionInLine); - - throw new InvalidOperationException(message); + throw new ParseException(message, re.CharPositionInLine); } public static string GetReadableTokenString(IToken token) diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs index 3300cc044b..97762d38ff 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs @@ -67,10 +67,10 @@ public IQueryNode Parse(string query, string field) IQueryNode querynode = TopLevelQuery(field); return querynode; } - catch (ParseException tme) + catch (Lucene.Net.QueryParsers.Flexible.Standard.Parser.ParseException tme) // LUCENENET: Flexible QueryParser has its own ParseException that is different than the one in Support { tme.SetQuery(query); - throw tme; + throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) } catch (Exception tme) when (tme.IsError()) { diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs index c1e1ae594f..43c764fa73 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 (FormatException e) + catch (Exception e) when (e.IsParseException()) { 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 784d800176..226465ca20 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 (FormatException e) + catch (Exception e) when (e.IsParseException()) { 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 (FormatException e) + catch (Exception e) when (e.IsParseException()) { throw new QueryNodeParseException(new Message( QueryParserMessages.COULD_NOT_PARSE_NUMBER, upper diff --git a/src/Lucene.Net.QueryParser/Xml/Builders/UserInputQueryBuilder.cs b/src/Lucene.Net.QueryParser/Xml/Builders/UserInputQueryBuilder.cs index ea3883efe3..992e361ba9 100644 --- a/src/Lucene.Net.QueryParser/Xml/Builders/UserInputQueryBuilder.cs +++ b/src/Lucene.Net.QueryParser/Xml/Builders/UserInputQueryBuilder.cs @@ -80,7 +80,7 @@ public virtual Query GetQuery(XmlElement e) q.Boost = DOMUtils.GetAttribute(e, "boost", 1.0f); return q; } - catch (ParseException e1) + catch (Lucene.Net.QueryParsers.Classic.ParseException e1) // LUCENENET: Classic QueryParser has its own ParseException that is different than the one in Support { throw new ParserException(e1.Message, e1); } diff --git a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs index 703f65ef3e..6ab979ce6c 100644 --- a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs +++ b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs @@ -255,7 +255,7 @@ internal void ReadWeight(string weight) } catch (FormatException e) { - // LUCENENET TODO: This is just so we can see what string and what culture was being tested when parsing failed, + // LUCENENET: This is just so we can see what string and what culture was being tested when parsing failed, // to try to reproduce the conditions of the failure. throw new FormatException($"Weight '{weight}' could not be parsed to long or double in culture '{CultureInfo.CurrentCulture.Name}'.", e); } diff --git a/src/Lucene.Net.TestFramework/Search/CheckHits.cs b/src/Lucene.Net.TestFramework/Search/CheckHits.cs index 7e63b56ae6..1a72af3fbe 100644 --- a/src/Lucene.Net.TestFramework/Search/CheckHits.cs +++ b/src/Lucene.Net.TestFramework/Search/CheckHits.cs @@ -400,21 +400,16 @@ public static void VerifyExplanation(string q, int doc, float score, bool deep, { k1 += "max plus ".Length; int k2 = descr.IndexOf(" ", k1, StringComparison.Ordinal); - try + + // LUCENENET NOTE: Using current culture here is intentional because + // we are parsing from text that was made using the current culture. + if (float.TryParse(descr.Substring(k1, k2 - k1).Trim(), out x)) { - // LUCENENET NOTE: Using current culture here is intentional because - // we are parsing from text that was made using the current culture. - x = Convert.ToSingle(descr.Substring(k1, k2 - k1).Trim()); if (descr.Substring(k2).Trim().Equals("times others of:", StringComparison.Ordinal)) { maxTimesOthers = true; } } -#pragma warning disable 168, IDE0059 - catch (FormatException e) -#pragma warning restore 168, IDE0059 - { - } } } // TODO: this is a TERRIBLE assertion!!!! diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs index 62244388af..206c023ff8 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs @@ -110,7 +110,7 @@ public virtual void TestInvalidData() new Dictionary(affixStream, dictStream); fail("didn't get expected exception"); } - catch (Exception expected) + catch (Exception expected) when (expected.IsParseException()) { assertTrue(expected.Message.StartsWith("The affix file contains a rule with less than four elements", StringComparison.Ordinal)); //assertEquals(24, expected.ErrorOffset); // No parse exception in LUCENENET diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs index 0d5e2d41d5..2269a671d7 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs @@ -1,4 +1,4 @@ -// Lucene version compatibility level 4.8.1 +// Lucene version compatibility level 4.8.1 using Lucene.Net.Analysis.En; using NUnit.Framework; using System; @@ -63,7 +63,15 @@ public virtual void TestInvalidDoubleMap() { string testFile = "a => b => c"; SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random)); - Assert.Throws(() => parser.Parse(new StringReader(testFile))); + try + { + parser.Parse(new StringReader(testFile)); + fail(); + } + catch (Exception pe) when (pe.IsParseException()) + { + // expected + } } /// @@ -73,7 +81,15 @@ public virtual void TestInvalidAnalyzesToNothingOutput() { string testFile = "a => 1"; SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random, MockTokenizer.SIMPLE, false)); - Assert.Throws(() => parser.Parse(new StringReader(testFile))); + try + { + parser.Parse(new StringReader(testFile)); + fail(); + } + catch (Exception pe) when (pe.IsParseException()) + { + // expected + } } /// @@ -83,7 +99,15 @@ public virtual void TestInvalidAnalyzesToNothingInput() { string testFile = "1 => a"; SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random, MockTokenizer.SIMPLE, false)); - Assert.Throws(() => parser.Parse(new StringReader(testFile))); + try + { + parser.Parse(new StringReader(testFile)); + fail(); + } + catch (Exception pe) when (pe.IsParseException()) + { + // expected + } } /// @@ -93,7 +117,15 @@ public virtual void TestInvalidPositionsInput() { string testFile = "testola => the test"; SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT)); - Assert.Throws(() => parser.Parse(new StringReader(testFile))); + try + { + parser.Parse(new StringReader(testFile)); + fail(); + } + catch (Exception pe) when (pe.IsParseException()) + { + // expected + } } /// @@ -103,7 +135,15 @@ public virtual void TestInvalidPositionsOutput() { string testFile = "the test => testola"; SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT)); - Assert.Throws(() => parser.Parse(new StringReader(testFile))); + try + { + parser.Parse(new StringReader(testFile)); + fail(); + } + catch (Exception pe) when (pe.IsParseException()) + { + // expected + } } /// diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs index 724da586ad..58a733745e 100644 --- a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs @@ -276,7 +276,7 @@ public virtual void TestCustomQueryParserWildcard() MockTokenizer.WHITESPACE, false)).Parse("a?t"); fail("Wildcard queries should not be allowed"); } - catch (ParseException /*expected*/) + catch (Lucene.Net.QueryParsers.Classic.ParseException /*expected*/) // LUCENENET: Classic QueryParser has its own ParseException that is different than the one in Support { // expected exception } @@ -291,7 +291,7 @@ public virtual void TestCustomQueryParserFuzzy() MockTokenizer.WHITESPACE, false)).Parse("xunit~"); fail("Fuzzy queries should not be allowed"); } - catch (ParseException /*expected*/) + catch (Lucene.Net.QueryParsers.Classic.ParseException /*expected*/) // LUCENENET: Classic QueryParser has its own ParseException that is different than the one in Support { // expected exception } diff --git a/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs b/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs index ca56899304..6daed67645 100644 --- a/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs +++ b/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs @@ -1,6 +1,5 @@ using J2N.Text; using Spatial4n.Core.Context; -using Spatial4n.Core.Exceptions; using Spatial4n.Core.Shapes; using System; using System.Collections.Generic; @@ -62,7 +61,7 @@ public static IEnumerator GetTestData(Stream @in, SpatialContex { data.shape = ctx.ReadShapeFromWkt(vals[2]); } - catch (ParseException e) + catch (Spatial4n.Core.Exceptions.ParseException e) // LUCENENET: Spatial4n has its own ParseException that is different than the one in Support { throw new Exception(e.ToString(), e); }