lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: [VOTE] Lucene and Solr 3.1 release candidate
Date Tue, 08 Mar 2011 13:23:07 GMT
On Tue, Mar 8, 2011 at 8:11 AM, Shai Erera <serera@gmail.com> wrote:
> I found another problem.
>
> Maybe something changed in the logic of FSDirectory.open(), but now when I
> run some tests over my code, I see that if MMapDirectory is chosen and an
> attempt to seek to an incorrect position is made, IllegalArgumentException
> is thrown, instead of IOE. This breaks my code which catches IOE and handle
> it.
>
> While I can modify my code to also catch IAE, I wonder if it's ok that
> MMapDir throws such an exception instead of IOE. It's actually thrown from
> ByteBuffer, however the caller, which holds a reference to a Directory, does
> not know if the underlying impl is MMapDir, LinuxFSDir etc.
>

This isn't a bug: Its clearly documented in the release notes that
FSDirectory.open()'s behavior has changed to return different
implementations for some platforms.
Additionally the documentation in FSDirectory states that different
implementations have quirks and recommends instantiating the desired
implementation directly.

The behavior of what exceptions MMapDirectory throws has not changed:
it throws the same exceptions it always did.

If your code depends upon the exact exception classes or text I think
you should instantiate the directory directly (and for the record, i
think this stuff is still "open-season" to change regardless, as its
internal).
Nowhere does any javadocs claim that any specific runtime exception is thrown.

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


Mime
View raw message