lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3939) ClassCastException thrown in the map(String,int,TermVectorOffsetInfo[],int[]) method in org.apache.lucene.index.SortedTermVectorMapper
Date Mon, 02 Apr 2012 15:47:24 GMT

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

Michael McCandless commented on LUCENE-3939:
--------------------------------------------

By the way, in 4.0 we've simplified access to term vectors: they use the same API as postings
(so you can visit terms/docs/positions), except covering only one document.  Term vectors
are an inverted index for just one document...
                
> ClassCastException thrown in the map(String,int,TermVectorOffsetInfo[],int[]) method
in org.apache.lucene.index.SortedTermVectorMapper
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3939
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3939
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.0.2, 3.1, 3.4, 3.5
>            Reporter: SHIN HWEI TAN
>   Original Estimate: 0.05h
>  Remaining Estimate: 0.05h
>
> The method "map" in the "SortedTermVectorMapper" class does not check the parameter "term"
for the valid values. It throws ClassCastException when called with a invalid string for the
parameter "term" (i.e., "var3.map("*", (-1), null, null)"). The exception thrown is due to
an explict cast(i.e., casting the return value of termToTVE.get(term) to type "TermVectorEntry").

> Suggested Fixes: Replace the beginning of the method body for the class "SortedTermVectorMapper"
by changing it like this:
> public void map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions)
{
> 	if(termToTVE.get(term) instanceof TermVectorEntry){
> 	  	TermVectorEntry entry = (TermVectorEntry) termToTVE.get(term);
>  		...
> 	}
> }

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message