Example #1
0
        public override void Abort()
        {
            Exception th = null;

            foreach (DocFieldProcessorPerField field in fieldHash)
            {
                DocFieldProcessorPerField fieldNext = field;
                while (fieldNext != null)
                {
                    DocFieldProcessorPerField next = fieldNext.next;
                    try
                    {
                        fieldNext.Abort();
                    }
                    catch (Exception t)
                    {
                        if (th == null)
                        {
                            th = t;
                        }
                    }
                    fieldNext = next;
                }
            }

            try
            {
                storedConsumer.Abort();
            }
            catch (Exception t)
            {
                if (th == null)
                {
                    th = t;
                }
            }

            try
            {
                consumer.Abort();
            }
            catch (Exception t)
            {
                if (th == null)
                {
                    th = t;
                }
            }

            // If any errors occured, throw it.
            if (th != null)
            {
                if (th is Exception)
                {
                    throw (Exception)th;
                }
                // defensive code - we should not hit unchecked exceptions
                throw new Exception(th.Message, th);
            }
        }
Example #2
0
 public override void Abort() // LUCENENET NOTE: original was internal, but other implementations require public
 {
     try
     {
         first.Abort();
     }
     catch (Exception)
     {
     }
     try
     {
         second.Abort();
     }
     catch (Exception)
     {
     }
 }
Example #3
0
        public override void Abort()
        {
            Exception th = null;

            foreach (DocFieldProcessorPerField field in fieldHash)
            {
                DocFieldProcessorPerField fieldNext = field;
                while (fieldNext != null)
                {
                    DocFieldProcessorPerField next = fieldNext.next;
                    try
                    {
                        fieldNext.Abort();
                    }
                    catch (Exception t) when(t.IsThrowable())
                    {
                        if (th is null)
                        {
                            th = t;
                        }
                    }
                    fieldNext = next;
                }
            }

            try
            {
                storedConsumer.Abort();
            }
            catch (Exception t) when(t.IsThrowable())
            {
                if (th is null)
                {
                    th = t;
                }
            }

            try
            {
                consumer.Abort();
            }
            catch (Exception t) when(t.IsThrowable())
            {
                if (th is null)
                {
                    th = t;
                }
            }

            // If any errors occured, throw it.
            if (th != null)
            {
                if (th.IsRuntimeException())
                {
                    ExceptionDispatchInfo.Capture(th).Throw();                          // LUCENENET: Rethrow to preserve stack details from the original throw
                }
                if (th.IsError())
                {
                    ExceptionDispatchInfo.Capture(th).Throw();               // LUCENENET: Rethrow to preserve stack details from the original throw
                }
                // defensive code - we should not hit unchecked exceptions
                throw RuntimeException.Create(th);
            }
        }