lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Updated: (LUCENE-1825) AttributeSource.getAttribute() should throw better IllegalArgumentException
Date Thu, 20 Aug 2009 21:47:14 GMT


Uwe Schindler updated LUCENE-1825:

    Attachment: LUCENE-1825.patch

Attached is a first patch, that fixes the wrong getAttribute() calss without checking, if
the attribute is available.
For testing, I added a system property to LuceneTestCase "TokenStream.onlyUseNewAPI", that
can be set to true. When I have done this (and explicitely excluded some tests like the deprecated
Tee/Sink test and the extra backwards test) using this switch, especially Highlighter fails
because of assuming that all Attributes are always there. With onlyUseNewAPI=false, the tests
pass, because the used Attribute Impl is Token, which implements all attributes.
There is still one test (TestMappingCharFilter) using, which I fix tomorrow
to use incrementToken. I am currently thinking about testing all affected tests automatically
two times with both settings. Maybe I add a special LuceneTestCase subclass, that runs all
tests two times. All test depending on TokenStreams like the indexer should simply subclass
this special class.
For the beginning, the system property is ON. I added it to common-build as true for testing.
How do I pass the command line parameters from ant itsself to the underlying tests?

> AttributeSource.getAttribute() should throw better IllegalArgumentException
> ---------------------------------------------------------------------------
>                 Key: LUCENE-1825
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Tim Smith
>            Assignee: Uwe Schindler
>            Priority: Minor
>             Fix For: 2.9
>         Attachments: LUCENE-1825.patch
> when seting "use only new API" for TokenStream, i received the following exception:
> {code}
>    [junit] Caused by: java.lang.IllegalArgumentException: This AttributeSource does not
have the attribute 'interface org.apache.lucene.analysis.tokenattributes.TermAttribute'.
>     [junit] 	at org.apache.lucene.util.AttributeSource.getAttribute(
>     [junit] 	at org.apache.lucene.index.TermsHashPerField.start(
>     [junit] 	at org.apache.lucene.index.DocInverterPerField.processFields(
>     [junit] 	at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(
>     [junit] 	at org.apache.lucene.index.DocumentsWriter.updateDocument(
>     [junit] 	at org.apache.lucene.index.DocumentsWriter.updateDocument(
>     [junit] 	at org.apache.lucene.index.IndexWriter.updateDocument(
> {code}
> However, i can't actually see the culprit that caused this exception
> suggest that the IllegalArgumentException include "getClass().getName()" in order to
be able to identify which TokenStream implementation actually caused this

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message