You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bu...@apache.org on 2005/05/15 19:10:20 UTC
DO NOT REPLY [Bug 33848] -
ArrayIndexOutOfBoundsException when using MultiFieldQueryParser
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33848>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33848
------- Additional Comments From john.wang@gmail.com 2005-05-15 19:10 -------
Created an attachment (id=15035)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=15035&action=view)
Added a nullcheck for Query instances before adding to the multi clause.
I wrote a unit test to try to recreate this issue with the latest trunk code. I
see that the ArrayIndexOutofBounds issue is gone. However, I do see null
Queries are added to resulting Query when switching from the deprecated method
by using the non-static parse method. After a little investigation, I see that
it is missing some null checks.
Here is the unit test and attached is the modified source of
MultiFieldQueryParser.java.
public static void main(String[] args) throws Exception{
String[] fields=new String[]{"f1","f2","f3","f4","f5"};
MultiFieldQueryParser parser=new
MultiFieldQueryParser(fields,new TestAnalyzer(fields));
String qString="bla AND blo";
Query q=parser.parse(qString);
System.out.println(q);
}
static class TestAnalyzer extends Analyzer{
String[] _defaultFields;
StandardAnalyzer _std;
public TestAnalyzer(String[] defaultFields){
_defaultFields=defaultFields;
_std=new StandardAnalyzer();
}
public TokenStream tokenStream(String fieldName, Reader reader)
{
if ("f1".equals(fieldName)){
return new EmptyTokenStream();
}
else{
return _std.tokenStream(fieldName, reader);
}
}
private static class EmptyTokenStream extends TokenStream{
public Token next() throws IOException {
return null;
}
}
}
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org