Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Implemented
-
Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
-
None
-
all
Description
There are a few places in the tests and possibly in the code where exceptions are being rethrown incorrectly and erasing stacktrace.
Please fix these as you come across them and add the ticket number in the commit message.
BaseTokenStreamTestCase.cs has a good example of this. Inside the RunBare method:
// Do the test again with onlyUseNewAPI=true
try
{
onlyUseNewAPI = true;
base.RunBare();
}
catch(Exception ex)
{
System.Console.Out.WriteLine("Test failure of '" + GetType() + "' occurred with onlyUseNewAPI=true");
throw ex;
}
in this case you don't need to specify the exception, and we're trapping to write out the context of the exception problem.
try
{
onlyUseNewAPI = true;
base.RunBare();
}
catch
{
Type type = this.GetType();
Console.WriteLine("Test failure of '" + type.Name + "' occurred with onlyUseNewAPI=true");
throw;
}
http://msdn.microsoft.com/en-us/library/ms182363(v=vs.80).aspx
http://winterdom.com/2002/09/rethrowingexceptionsinc