lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prescott Nasser (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [Lucene.Net] [jira] [Issue Comment Edited] (LUCENENET-54) ArgumentOurOfRangeException caused by SF.Snowball.Ext.DanishStemmer
Date Fri, 13 Jan 2012 18:04:39 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185710#comment-13185710
] 

Prescott Nasser edited comment on LUCENENET-54 at 1/13/12 6:04 PM:
-------------------------------------------------------------------

Simon Svensson:

I've written a simple reproduction of LUCENENET-54 
(ArgumentOutOfRangeException in SnowballProgram). I'm not sure about the 
correct workflow to reopen this issue (it was closed as invalid in 2007 
due to missing information), so I'm throwing what I got into the 
developer mailing list and hope that someone else knows the correct 
approach. Problem originates in SnowballProgram.slice_to, where the 
second argument to StringBuilder.ToString(start, length) where the last 
parameter is passed an index instead of the length.
 
Reproduction:
using System.IO;
using Lucene.Net.Analysis.Snowball;
using Lucene.Net.Analysis.Tokenattributes;
using NUnit.Framework;
 
namespace ConsoleApplication {
 [TestFixture]
 public class LuceneRepo {
 [Test(Description = "LUCENENET-54")]
 public void Repro() {
 var analyzer = new SnowballAnalyzer("Finnish");
 
var input = new StringReader("terve");
 var tokenStream = analyzer.TokenStream("fieldName", input);
 var termAttr = 
(TermAttribute)tokenStream.AddAttribute(typeof (TermAttribute));
 
Assert.That(tokenStream.IncrementToken(), Is.True);
 Assert.That(termAttr.Term(), Is.EqualTo("terv"));
 }
 }
}
 
Unexpected exception:
System.ArgumentOutOfRangeException: Index and length must refer to a 
location within the string.
Parameter name: length
 at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)
 at SF.Snowball.SnowballProgram.slice_to(StringBuilder s) in 
C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\SnowballProgram.cs:line 467
 at SF.Snowball.Ext.FinnishStemmer.r_tidy() in C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\Ext\FinnishStemmer.cs:line 
974
 at SF.Snowball.Ext.FinnishStemmer.Stem() in C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\Ext\FinnishStemmer.cs:line 
1137
 
Expected result:
The unit test should pass.
 
                
      was (Author: pnasser):
    I've written a simple reproduction of LUCENENET-54 
(ArgumentOutOfRangeException in SnowballProgram). I'm not sure about the 
correct workflow to reopen this issue (it was closed as invalid in 2007 
due to missing information), so I'm throwing what I got into the 
developer mailing list and hope that someone else knows the correct 
approach. Problem originates in SnowballProgram.slice_to, where the 
second argument to StringBuilder.ToString(start, length) where the last 
parameter is passed an index instead of the length.
 
Reproduction:
using System.IO;
using Lucene.Net.Analysis.Snowball;
using Lucene.Net.Analysis.Tokenattributes;
using NUnit.Framework;
 
namespace ConsoleApplication {
 [TestFixture]
 public class LuceneRepo {
 [Test(Description = "LUCENENET-54")]
 public void Repro() {
 var analyzer = new SnowballAnalyzer("Finnish");
 
var input = new StringReader("terve");
 var tokenStream = analyzer.TokenStream("fieldName", input);
 var termAttr = 
(TermAttribute)tokenStream.AddAttribute(typeof (TermAttribute));
 
Assert.That(tokenStream.IncrementToken(), Is.True);
 Assert.That(termAttr.Term(), Is.EqualTo("terv"));
 }
 }
}
 
Unexpected exception:
System.ArgumentOutOfRangeException: Index and length must refer to a 
location within the string.
Parameter name: length
 at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)
 at SF.Snowball.SnowballProgram.slice_to(StringBuilder s) in 
C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\SnowballProgram.cs:line 467
 at SF.Snowball.Ext.FinnishStemmer.r_tidy() in C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\Ext\FinnishStemmer.cs:line 
974
 at SF.Snowball.Ext.FinnishStemmer.Stem() in C:\Dev\Third 
Party\Lucene.NET\src\contrib\Snowball\SF\Snowball\Ext\FinnishStemmer.cs:line 
1137
 
Expected result:
The unit test should pass.
 
                  
> ArgumentOurOfRangeException caused by SF.Snowball.Ext.DanishStemmer
> -------------------------------------------------------------------
>
>                 Key: LUCENENET-54
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-54
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.4, Lucene.Net 3.0.3, Lucene.Net 2.9.4g
>         Environment: Windows XP SP2, lucene.net v2.0 004
>            Reporter: Torsten Rendelmann
>            Priority: Critical
>             Fix For: Lucene.Net 3.0.3
>
>
> Exception Information
> System.SystemException: System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index and
length must refer to a location within the string.
> Parameter name: length
>    at System.String.Substring(Int32 startIndex, Int32 length)
>    at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)
>    at SF.Snowball.SnowballProgram.slice_to(StringBuilder s)
>    at SF.Snowball.Ext.DanishStemmer.r_undouble()
>    at SF.Snowball.Ext.DanishStemmer.Stem()
>    --- End of inner exception stack trace ---
>    at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly
caller, Boolean verifyAccess)
>    at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess)
>    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)
>    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
>    at System.Reflection.MethodInfo.Invoke(Object obj, Object[] parameters)
>    at Lucene.Net.Analysis.Snowball.SnowballFilter.Next()
>    at Lucene.Net.Analysis.Snowball.SnowballFilter.Next()
>    at Lucene.Net.Index.DocumentWriter.InvertDocument(Document doc)
>    at Lucene.Net.Index.DocumentWriter.AddDocument(String segment, Document doc)
>    at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message