lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [45/50] [abbrv] lucenenet git commit: SWEEP: Lucene.Net.Core: reviewed all catch blocks to ensure the type caught is correct, the exception (if rethrown) is added as innerException of the one that is thrown, and that if a new error is thrown in Lucene, i
Date Wed, 15 Mar 2017 23:50:27 GMT
SWEEP: Lucene.Net.Core: reviewed all catch blocks to ensure the type caught is correct, the
exception (if rethrown) is added as innerException of the one that is thrown, and that if
a new error is thrown in Lucene, it is also thrown new in .NET


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

Branch: refs/heads/api-work
Commit: 74750b98df815e85d1cd07a4c4e5012a9181dd66
Parents: 50fff66
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Mar 16 05:57:44 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Mar 16 05:57:44 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/CheckIndex.cs         |  2 +
 .../Index/ConcurrentMergeScheduler.cs           |  2 +-
 src/Lucene.Net.Core/Index/DirectoryReader.cs    |  6 ++-
 src/Lucene.Net.Core/Index/DocTermOrds.cs        |  2 +-
 src/Lucene.Net.Core/Index/IndexFileDeleter.cs   | 19 ++++++--
 src/Lucene.Net.Core/Index/IndexReader.cs        |  5 +-
 src/Lucene.Net.Core/Index/SegmentCoreReaders.cs | 16 +++++--
 .../Index/TwoStoredFieldsConsumers.cs           | 14 +++---
 .../Search/ControlledRealTimeReopenThread.cs    |  6 ---
 src/Lucene.Net.Core/Store/LockVerifyServer.cs   |  4 +-
 src/Lucene.Net.Core/Store/NIOFSDirectory.cs     |  2 +-
 src/Lucene.Net.Core/Store/RateLimiter.cs        |  2 +-
 .../Store/SimpleFSLockFactory.cs                |  5 +-
 src/Lucene.Net.Core/Util/AttributeImpl.cs       |  4 +-
 src/Lucene.Net.Core/Util/AttributeSource.cs     |  8 ++--
 src/Lucene.Net.Core/Util/Automaton/RegExp.cs    |  4 +-
 src/Lucene.Net.Core/Util/IOUtils.cs             | 48 +++++++++++---------
 src/Lucene.Net.Core/Util/WAH8DocIdSet.cs        |  2 +-
 18 files changed, 90 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CheckIndex.cs b/src/Lucene.Net.Core/Index/CheckIndex.cs
index 430de6f..27b33dc 100644
--- a/src/Lucene.Net.Core/Index/CheckIndex.cs
+++ b/src/Lucene.Net.Core/Index/CheckIndex.cs
@@ -2366,6 +2366,8 @@ namespace Lucene.Net.Index
             return assertsOn;
         }
 
+        // LUCENENET TODO: This seems too useful not to port over...but I suppose there is
a Java version that could be used on the command line.
+
         /*
         /// Command-line interface to check and fix an index.
         ///

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs b/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
index 28164cd..cef599e 100644
--- a/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
@@ -461,7 +461,7 @@ namespace Lucene.Net.Index
                         }
                         catch (ThreadInterruptedException ie)
                         {
-                            throw new ThreadInterruptedException("Thread Interrupted Exception",
ie);
+                            throw new ThreadInterruptedException(ie.ToString(), ie);
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/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 bd42aa4..95e32fc 100644
--- a/src/Lucene.Net.Core/Index/DirectoryReader.cs
+++ b/src/Lucene.Net.Core/Index/DirectoryReader.cs
@@ -299,7 +299,7 @@ namespace Lucene.Net.Index
                         // segments_N is corrupt
                         sis.Read(dir, fileName);
                     }
-                    catch (FileNotFoundException/* | NoSuchFileException fnfe*/)
+                    catch (FileNotFoundException)
                     {
                         // LUCENE-948: on NFS (and maybe others), if
                         // you have writers switching back and forth
@@ -310,6 +310,10 @@ namespace Lucene.Net.Index
                         // as if the file does not exist
                         sis = null;
                     }
+                    catch (NoSuchFileException)
+                    {
+                        sis = null;
+                    }
 
                     if (sis != null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/DocTermOrds.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocTermOrds.cs b/src/Lucene.Net.Core/Index/DocTermOrds.cs
index 3f21f5f..b7f66e6 100644
--- a/src/Lucene.Net.Core/Index/DocTermOrds.cs
+++ b/src/Lucene.Net.Core/Index/DocTermOrds.cs
@@ -1128,7 +1128,7 @@ namespace Lucene.Net.Index
                 catch (System.IO.IOException e)
 #pragma warning restore 168
                 {
-                    throw new Exception();
+                    throw new Exception(e.ToString(), e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/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 0faa8f0..fa934b9 100644
--- a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
@@ -197,6 +197,21 @@ 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;
+                            }
                             catch (IOException e)
                             {
                                 if (SegmentInfos.GenerationFromSegmentsFileName(fileName)
<= currentGen && directory.FileLength(fileName) > 0)
@@ -245,11 +260,9 @@ namespace Lucene.Net.Index
                 {
                     sis.Read(directory, currentSegmentsFile);
                 }
-#pragma warning disable 168
                 catch (IOException e)
-#pragma warning restore 168
                 {
-                    throw new CorruptIndexException("failed to locate current segments_N
file \"" + currentSegmentsFile + "\"");
+                    throw new CorruptIndexException("failed to locate current segments_N
file \"" + currentSegmentsFile + "\"" + e.ToString(), e);
                 }
                 if (infoStream.IsEnabled("IFD"))
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/IndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexReader.cs b/src/Lucene.Net.Core/Index/IndexReader.cs
index de0fe5b..0442bda 100644
--- a/src/Lucene.Net.Core/Index/IndexReader.cs
+++ b/src/Lucene.Net.Core/Index/IndexReader.cs
@@ -156,10 +156,7 @@ namespace Lucene.Net.Index
                         }
                         else
                         {
-                            //th.AddSuppressed(t);
-                            // LUCENENET TODO - Figure out how to track these exceptions
-                            // Drop the exception instead of wrapping in AggregateException.
-                            // Wrapping will change the exception type and change flow control.
+                            th.AddSuppressed(t);
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
index 21efb11..a64847f 100644
--- a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
+++ b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
@@ -163,8 +163,9 @@ namespace Lucene.Net.Index
                     normsProducer = null;
                 }
 
-                // LUCENENET TODO: Not sure why this catch block is swallowing AccessViolationException,

-                // because it didn't exist in Lucene. Is it really needed?
+                // LUCENENET TODO: EXCEPTIONS Not sure why this catch block is swallowing
AccessViolationException, 
+                // because it didn't exist in Lucene. Is it really needed? AVE is for protected
memory...could
+                // this be needed because we are using unchecked??
 
 #if !NETSTANDARD
                 try
@@ -271,8 +272,17 @@ namespace Lucene.Net.Index
                     {
                         listener.OnClose(this);
                     }
-                    catch (Exception)
+                    catch (Exception t)
                     {
+                        
+                        if (th == null)
+                        {
+                            th = t;
+                        }
+                        else
+                        {
+                            th.AddSuppressed(t);
+                        }
                     }
                 }
                 IOUtils.ReThrowUnchecked(th);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Index/TwoStoredFieldsConsumers.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TwoStoredFieldsConsumers.cs b/src/Lucene.Net.Core/Index/TwoStoredFieldsConsumers.cs
index b8e5958..68a32b8 100644
--- a/src/Lucene.Net.Core/Index/TwoStoredFieldsConsumers.cs
+++ b/src/Lucene.Net.Core/Index/TwoStoredFieldsConsumers.cs
@@ -25,24 +25,24 @@ namespace Lucene.Net.Index
     internal class TwoStoredFieldsConsumers : StoredFieldsConsumer
     {
         private readonly StoredFieldsConsumer first;
-        private readonly StoredFieldsConsumer fecond;
+        private readonly StoredFieldsConsumer second;
 
         public TwoStoredFieldsConsumers(StoredFieldsConsumer first, StoredFieldsConsumer
second)
         {
             this.first = first;
-            this.fecond = second;
+            this.second = second;
         }
 
         public override void AddField(int docID, IIndexableField field, FieldInfo fieldInfo)
         {
             first.AddField(docID, field, fieldInfo);
-            fecond.AddField(docID, field, fieldInfo);
+            second.AddField(docID, field, fieldInfo);
         }
 
         public override void Flush(SegmentWriteState state) // LUCENENET NOTE: original was
internal, but other implementations require public
         {
             first.Flush(state);
-            fecond.Flush(state);
+            second.Flush(state);
         }
 
         public override void Abort() // LUCENENET NOTE: original was internal, but other
implementations require public
@@ -56,7 +56,7 @@ namespace Lucene.Net.Index
             }
             try
             {
-                fecond.Abort();
+                second.Abort();
             }
             catch (Exception)
             {
@@ -66,13 +66,13 @@ namespace Lucene.Net.Index
         public override void StartDocument() // LUCENENET NOTE: original was internal, but
other implementations require public
         {
             first.StartDocument();
-            fecond.StartDocument();
+            second.StartDocument();
         }
 
         internal override void FinishDocument()
         {
             first.FinishDocument();
-            fecond.FinishDocument();
+            second.FinishDocument();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs b/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs
index 898c0a4..de15a75 100644
--- a/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs
@@ -42,11 +42,6 @@ namespace Lucene.Net.Search
     public class ControlledRealTimeReopenThread<T> : ThreadClass, IDisposable
         where T : class
     {
-        /*private void InitializeInstanceFields()
-        {
-            ReopenCond = ReopenLock.NewCondition();
-        }*/
-
         private readonly ReferenceManager<T> manager;
         private readonly long targetMaxStaleNS;
         private readonly long targetMinStaleNS;
@@ -76,7 +71,6 @@ namespace Lucene.Net.Search
         ///        become visible. </param>
         public ControlledRealTimeReopenThread(TrackingIndexWriter writer, ReferenceManager<T>
manager, double targetMaxStaleSec, double targetMinStaleSec)
         {
-            //InitializeInstanceFields();
             if (targetMaxStaleSec < targetMinStaleSec)
             {
                 throw new System.ArgumentException("targetMaxScaleSec (= " + targetMaxStaleSec
+ ") < targetMinStaleSec (=" + targetMinStaleSec + ")");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Store/LockVerifyServer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/LockVerifyServer.cs b/src/Lucene.Net.Core/Store/LockVerifyServer.cs
index 1ccd128..209e4ec 100644
--- a/src/Lucene.Net.Core/Store/LockVerifyServer.cs
+++ b/src/Lucene.Net.Core/Store/LockVerifyServer.cs
@@ -183,7 +183,9 @@ namespace Lucene.Net.Store
                     }
                     catch (Exception e)
                     {
-                        throw e;
+                        // LUCENENET NOTE: We need to throw a new exception
+                        // to ensure this is Exception and not some other type.
+                        throw new Exception(e.ToString(), e);
                     }
                     finally
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
index 1b540b5..2709760 100644
--- a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
@@ -255,7 +255,7 @@ namespace Lucene.Net.Store
                 }
                 catch (System.IO.IOException ioe)
                 {
-                    throw new System.IO.IOException(ioe.Message + ": " + this, ioe);
+                    throw new System.IO.IOException(ioe.ToString() + ": " + this, ioe);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Store/RateLimiter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimiter.cs b/src/Lucene.Net.Core/Store/RateLimiter.cs
index 92cecce..ea15744 100644
--- a/src/Lucene.Net.Core/Store/RateLimiter.cs
+++ b/src/Lucene.Net.Core/Store/RateLimiter.cs
@@ -135,7 +135,7 @@ namespace Lucene.Net.Store
                         }
                         catch (ThreadInterruptedException ie)
                         {
-                            throw new ThreadInterruptedException("Thread Interrupted Exception",
ie);
+                            throw new ThreadInterruptedException(ie.ToString(), ie);
                         }
 #endif
                         curNS = DateTime.UtcNow.Ticks * 100;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs b/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
index a7c45b4..614d092 100644
--- a/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
@@ -147,6 +147,7 @@ namespace Lucene.Net.Store
             }
             else
             {
+                // LUCENENET TODO: This doesn't look right. I think it should be File.Exists
and if true throw the exception...
                 try
                 {
                     System.IO.Directory.Exists(lockDir.FullName);
@@ -157,7 +158,7 @@ namespace Lucene.Net.Store
                 }
             }
 
-            if (lockFile.Exists)
+            if (lockFile.Exists) // LUCENENET TODO: This should probably be File.Exists(lockFile.FullName)...
             {
                 return false;
             }
@@ -170,7 +171,7 @@ namespace Lucene.Net.Store
         }
 
         public override void Release()
-        {//LUCENE TO-DO
+        {//LUCENE TO-DO : change the logic to be more like Lucene...don't attempt delete
unless the file exists
             try
             {
                 lockFile.Delete();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Util/AttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/AttributeImpl.cs b/src/Lucene.Net.Core/Util/AttributeImpl.cs
index 6b8b439..16ad7a2 100644
--- a/src/Lucene.Net.Core/Util/AttributeImpl.cs
+++ b/src/Lucene.Net.Core/Util/AttributeImpl.cs
@@ -114,9 +114,9 @@ namespace Lucene.Net.Util
                     reflector.Reflect(interf, f.Name, f.GetValue(this));
                 }
             }
-            catch (UnauthorizedAccessException uae)
+            catch (MemberAccessException e)
             {
-                throw new Exception(uae.Message, uae);
+                throw new Exception(e.ToString(), e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Util/AttributeSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/AttributeSource.cs b/src/Lucene.Net.Core/Util/AttributeSource.cs
index 053072a..b230cb8 100644
--- a/src/Lucene.Net.Core/Util/AttributeSource.cs
+++ b/src/Lucene.Net.Core/Util/AttributeSource.cs
@@ -69,9 +69,9 @@ namespace Lucene.Net.Util
                     {
                         return (Attribute)System.Activator.CreateInstance(GetClassForInterface<S>());
                     }
-                    catch (ArgumentException)
+                    catch (Exception e)
                     {
-                        throw new System.ArgumentException("Could not instantiate implementing
class for " + typeof(S).FullName);
+                        throw new System.ArgumentException("Could not instantiate implementing
class for " + typeof(S).FullName, e);
                     }
                 }
 
@@ -89,9 +89,9 @@ namespace Lucene.Net.Util
                             string name = attClass.FullName.Replace(attClass.Name, attClass.Name.Substring(1))
+ ", " + attClass.GetTypeInfo().Assembly.FullName;
                             attClassImplMap.Add(attClass, new WeakReference(clazz = Type.GetType(name,
true)));
                         }
-                        catch (Exception)
+                        catch (Exception e)
                         {
-                            throw new System.ArgumentException("Could not find implementing
class for " + attClass.Name);
+                            throw new System.ArgumentException("Could not find implementing
class for " + attClass.Name, e);
                         }
                     }
                     return clazz;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
index 6b69281..868f8f0 100644
--- a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
@@ -607,7 +607,7 @@ namespace Lucene.Net.Util.Automaton
                         }
                         catch (System.IO.IOException e)
                         {
-                            throw new System.ArgumentException(e.Message, e);
+                            throw new System.ArgumentException(e.ToString(), e);
                         }
                     }
                     if (aa == null)
@@ -1260,7 +1260,7 @@ namespace Lucene.Net.Util.Automaton
                     catch (System.FormatException e)
 #pragma warning restore 168
                     {
-                        throw new System.ArgumentException("interval syntax error at position
" + (pos - 1));
+                        throw new System.ArgumentException("interval syntax error at position
" + (pos - 1), e);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Util/IOUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/IOUtils.cs b/src/Lucene.Net.Core/Util/IOUtils.cs
index c0aad7c..afc3c09 100644
--- a/src/Lucene.Net.Core/Util/IOUtils.cs
+++ b/src/Lucene.Net.Core/Util/IOUtils.cs
@@ -77,13 +77,13 @@ namespace Lucene.Net.Util
         {
             Exception th = null;
 
-            foreach (IDisposable o in objects)
+            foreach (IDisposable @object in objects)
             {
                 try
                 {
-                    if (o != null)
+                    if (@object != null)
                     {
-                        o.Dispose();
+                        @object.Dispose();
                     }
                 }
                 catch (Exception t)
@@ -233,10 +233,9 @@ namespace Lucene.Net.Util
         /// <summary>
         /// Closes all given <tt>IDisposable</tt>s, suppressing all thrown exceptions.
</summary>
         /// <seealso cref= #closeWhileHandlingException(IDisposable...) </seealso>
-        public static void CloseWhileHandlingException<T1>(IEnumerable<T1> objects)
-            where T1 : IDisposable
+        public static void CloseWhileHandlingException(IEnumerable<IDisposable> objects)
         {
-            foreach (T1 @object in objects)
+            foreach (IDisposable @object in objects)
             {
                 try
                 {
@@ -254,24 +253,19 @@ namespace Lucene.Net.Util
 
         /// <summary>
         /// Since there's no C# equivalent of Java's Exception.AddSuppressed, we add the
-        /// suppressed exceptions to a data field. </summary>
+        /// suppressed exceptions to a data field via the 
+        /// <see cref="Support.ExceptionExtensions.AddSuppressed(Exception, Exception)"/>
method.
+        /// <para/>
+        /// The exceptions can be retrieved by calling <see cref="ExceptionExtensions.GetSuppressed(Exception)"/>
+        /// or <see cref="ExceptionExtensions.GetSuppressedAsList(Exception)"/>.
+        /// </summary>
         /// <param name="exception"> this exception should get the suppressed one added
</param>
         /// <param name="suppressed"> the suppressed exception </param>
         private static void AddSuppressed(Exception exception, Exception suppressed)
         {
             if (exception != null && suppressed != null)
             {
-                List<Exception> suppressedExceptions;
-                if (!exception.Data.Contains("SuppressedExceptions"))
-                {
-                    suppressedExceptions = new List<Exception>();
-                    exception.Data.Add("SuppressedExceptions", suppressedExceptions);
-                }
-                else
-                {
-                    suppressedExceptions = (List<Exception>)exception.Data["SuppressedExceptions"];
-                }
-                suppressedExceptions.Add(suppressed);
+                exception.AddSuppressed(suppressed);
             }
         }
 
@@ -476,9 +470,21 @@ namespace Lucene.Net.Util
                     {
                         throw;
                     }
-
-                    // Pause 5 msec
-                    Thread.Sleep(5);
+#if !NETSTANDARD
+                    try
+                    {
+#endif
+                        // Pause 5 msec
+                        Thread.Sleep(5);
+#if !NETSTANDARD
+                    }
+                    catch (ThreadInterruptedException ie)
+                    {
+                        var ex = new ThreadInterruptedException(ie.ToString(), ie);
+                        //ex.AddSuppressed(exc);
+                        throw ex;
+                    }
+#endif
                 }
                 finally
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74750b98/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
index 9e418ab..9d34c64 100644
--- a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
+++ b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
@@ -357,7 +357,7 @@ namespace Lucene.Net.Util
                 }
                 catch (System.IO.IOException cannotHappen)
                 {
-                    throw new InvalidOperationException(cannotHappen.ToString(), cannotHappen);
+                    throw new InvalidOperationException(cannotHappen.ToString(), cannotHappen);
// LUCENENET NOTE: This was AssertionError in Lucene
                 }
                 @out.WriteBytes(dirtyWords.Bytes, 0, dirtyWords.Length);
                 dirtyWords.Length = 0;


Mime
View raw message