Lucene.Net.Core: Removed NoSuchFileException, since it is not being thrown anywhere anyway - we already have a FileNotFoundException which serves this purpose.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1b926eab Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1b926eab Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1b926eab Branch: refs/heads/api-work Commit: 1b926eab66c55c4392aeba3e0c6638bf49822a90 Parents: 6204e32 Author: Shad Storhaug <[email protected]> Authored: Sun Mar 26 15:36:48 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Mar 26 15:36:48 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Index/DirectoryReader.cs | 9 +++--- src/Lucene.Net.Core/Index/IndexFileDeleter.cs | 31 ++++++++++--------- src/Lucene.Net.Core/Index/IndexWriter.cs | 9 +++--- .../Index/NoSuchFileException.cs | 32 -------------------- src/Lucene.Net.Core/Lucene.Net.csproj | 1 - src/Lucene.Net.Core/Store/Directory.cs | 6 ++-- .../Util/LuceneTestCase.cs | 9 +++--- 7 files changed, 34 insertions(+), 63 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Index/DirectoryReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DirectoryReader.cs b/src/Lucene.Net.Core/Index/DirectoryReader.cs index 9265635..3d55e8e 100644 --- a/src/Lucene.Net.Core/Index/DirectoryReader.cs +++ b/src/Lucene.Net.Core/Index/DirectoryReader.cs @@ -310,10 +310,11 @@ namespace Lucene.Net.Index // as if the file does not exist sis = null; } - catch (NoSuchFileException) - { - sis = null; - } + // LUCENENET specific - .NET (thankfully) only has one FileNotFoundException, so we don't need this + //catch (NoSuchFileException) + //{ + // sis = null; + //} if (sis != null) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Index/IndexFileDeleter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs index 1d1b8df..ee6baf8 100644 --- a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs +++ b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs @@ -197,21 +197,22 @@ namespace Lucene.Net.Index } sis = null; } - catch (NoSuchFileException) - { - // LUCENE-948: on NFS (and maybe others), if - // you have writers switching back and forth - // between machines, it's very likely that the - // dir listing will be stale and will claim a - // file segments_X exists when in fact it - // doesn't. So, we catch this and handle it - // as if the file does not exist - if (infoStream.IsEnabled("IFD")) - { - infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); - } - sis = null; - } + // LUCENENET specific - .NET (thankfully) only has one FileNotFoundException, so we don't need this + //catch (NoSuchFileException) + //{ + // // LUCENE-948: on NFS (and maybe others), if + // // you have writers switching back and forth + // // between machines, it's very likely that the + // // dir listing will be stale and will claim a + // // file segments_X exists when in fact it + // // doesn't. So, we catch this and handle it + // // as if the file does not exist + // if (infoStream.IsEnabled("IFD")) + // { + // infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); + // } + // sis = null; + //} catch (IOException e) { if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen && directory.FileLength(fileName) > 0) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Index/IndexWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/IndexWriter.cs b/src/Lucene.Net.Core/Index/IndexWriter.cs index 2420209..4a572fb 100644 --- a/src/Lucene.Net.Core/Index/IndexWriter.cs +++ b/src/Lucene.Net.Core/Index/IndexWriter.cs @@ -5933,10 +5933,11 @@ namespace Lucene.Net.Index { return false; } - catch (NoSuchFileException) - { - return false; - } + // LUCENENET specific - .NET (thankfully) only has one FileNotFoundException, so we don't need this + //catch (NoSuchFileException) + //{ + // return false; + //} } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Index/NoSuchFileException.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/NoSuchFileException.cs b/src/Lucene.Net.Core/Index/NoSuchFileException.cs deleted file mode 100644 index 3c04ea0..0000000 --- a/src/Lucene.Net.Core/Index/NoSuchFileException.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace Lucene.Net.Index -{ - /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - // LUCENENET TODO: This exception is being caught, but not thrown. - // It is LUCENENET specific. If we can make use of it, move to Support. - // If not, it should be deleted. - // LUCENENET: All exeption classes should be marked serializable -#if FEATURE_SERIALIZABLE - [Serializable] -#endif - internal class NoSuchFileException : Exception // LUCENENET TODO: API Remove this exception (no equivalent in .NET, since we are already using FileNotFoundException in all of the same places). - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Lucene.Net.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj index dca7a21..3c3a029 100644 --- a/src/Lucene.Net.Core/Lucene.Net.csproj +++ b/src/Lucene.Net.Core/Lucene.Net.csproj @@ -322,7 +322,6 @@ <Compile Include="Index\NoMergeScheduler.cs" /> <Compile Include="Index\NormsConsumer.cs" /> <Compile Include="Index\NormsConsumerPerField.cs" /> - <Compile Include="Index\NoSuchFileException.cs" /> <Compile Include="Index\NumericDocValues.cs" /> <Compile Include="Index\NumericDocValuesFieldUpdates.cs" /> <Compile Include="Index\NumericDocValuesWriter.cs" /> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.Core/Store/Directory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/Directory.cs b/src/Lucene.Net.Core/Store/Directory.cs index 622f157..8f6f4a7 100644 --- a/src/Lucene.Net.Core/Store/Directory.cs +++ b/src/Lucene.Net.Core/Store/Directory.cs @@ -64,7 +64,7 @@ namespace Lucene.Net.Store /// Returns the length of a file in the directory. this method follows the /// following contract: /// <list> - /// <item>Throws <see cref="System.IO.FileNotFoundException"/> or <see cref="Index.NoSuchFileException"/> + /// <item>Throws <see cref="System.IO.FileNotFoundException"/> /// if the file does not exist.</item> /// <item>Returns a value >=0 if the file exists, which specifies its length.</item> /// </list> @@ -100,7 +100,7 @@ namespace Lucene.Net.Store /// the only <see cref="Directory"/> implementations that respect this /// parameter are <see cref="FSDirectory"/> and /// <see cref="CompoundFileDirectory"/>. - /// <para/>Throws <see cref="System.IO.FileNotFoundException"/> or <see cref="Index.NoSuchFileException"/> + /// <para/>Throws <see cref="System.IO.FileNotFoundException"/> /// if the file does not exist. /// </summary> public abstract IndexInput OpenInput(string name, IOContext context); @@ -226,7 +226,7 @@ namespace Lucene.Net.Store /// efficiently open one or more sliced <see cref="IndexInput"/> instances from a /// single file handle. The underlying file handle is kept open until the /// <see cref="IndexInputSlicer"/> is closed. - /// <para/>Throws <see cref="FileNotFoundException"/> or <see cref="Index.NoSuchFileException"/> + /// <para/>Throws <see cref="FileNotFoundException"/> /// if the file does not exist. /// <para/> /// @lucene.internal http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b926eab/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs index 8d2e0f8..1772485 100644 --- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs +++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs @@ -2653,10 +2653,11 @@ namespace Lucene.Net.Util { return false; } - catch (NoSuchFileException) - { - return false; - } + // LUCENENET specific - .NET (thankfully) only has one FileNotFoundException, so we don't need this + //catch (NoSuchFileException) + //{ + // return false; + //} } /// <summary>
