lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: Allowing IOExceptions in TermVectorMapper?
Date Thu, 25 Oct 2007 16:03:58 GMT
Cool use of the TVMs, but...

I think a RuntimeException is better, as TVMs don't generally do IO.   
The TermVectorReader.readTermVector is just calling back to the TVM,  
so it is appropriate that it throws the IOException since it is where  
the IO happens.  Implementation exceptions, IMO, are best handled  
through RuntimeExceptions, else you are potentially putting  
implementation details into the interface.  Not sure if an  
IOException falls into that category, since it is pretty generic,  
but, what do others think?

I suppose we could have a whole fun debate about checked exceptions  
versus unchecked.  :-)

http://www.javapractices.com/Topic129.cjp
http://java.sun.com/docs/books/tutorial/essential/exceptions/ 
runtime.html
and on, and on, and on

On Oct 24, 2007, at 7:23 PM, Karl Wettin wrote:

> How about allowing IOExceptions beeing thrown from the abstract  
> TermVectorMapper methods?
>
> The use case is that I want a normalized frequency, and I'd like to  
> do that by loading the factor from an IndexReader in setExpectations.
>
> I could wrap it in a RuntimeException, I could update the values  
> later. But TermVectorReader.readTermVector already throws  
> IOException, so using that feels like the optimal solution to me. Or?
>
>
>
> -- 
> karl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>



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


Mime
View raw message