From 99d2076c74b04a3923d2e189cf7e1ec647c0bdbf Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Wed, 18 Dec 2024 08:45:35 -0700 Subject: [PATCH] Add FormatException case to Utf8ToString() catch --- src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs index 8b8b08e6e0..1125feaffc 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs @@ -407,10 +407,10 @@ public override int GetOrd(int docId) SimpleTextUtil.ReadLine(_input, _scratch); try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. + // LUCENENET: .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) when (pe.IsParseException()) + catch (Exception pe) when (pe.IsParseException() || pe.IsNumberFormatException()) { var e = new CorruptIndexException($"failed to parse ord (resource={_input})", pe); throw e;