Presumably you'd also hit this exception if the DP deletes all commit
points, right?

I like IllegalStateException.

Mike

2010/4/15 Shai Erera <ser...@gmail.com>:
> BTW, even if it's a stupid thing to do, someone can today create SDP and
> call snapshot without ever creating IW. And it's not an impossible scenario.
> Consider a backup-aware application which creates SDP first, then passes it
> to the indexing process and the backup process, separately. The backup
> process doesn't need to know of IW at all, and might call snapshot() before
> IW was even created, and SDP.onInit was called. It's a possibility, not
> saying it's a great and safe architecture.
>
> So this is really about do we want to write clear protective code, or allow
> the NPE?
>
> Shai
>
> 2010/4/15 Shai Erera <ser...@gmail.com>
>>
>> Well ... one can still call commit() or close() right after IW creation.
>> And this is a very rare case to be hit by. Was just asking about whether we
>> want to add an explicit and clear protective code about it or not.
>>
>> Shai
>>
>> On Thu, Apr 15, 2010 at 10:26 AM, Earwin Burrfoot <ear...@gmail.com>
>> wrote:
>>>
>>> We should just let IW create a null commit on an empty directory, like
>>> it always did ;)
>>> Then a whole class of such problems disappears.
>>>
>>> On Thu, Apr 15, 2010 at 11:16, Shai Erera <ser...@gmail.com> wrote:
>>> > SDP throws NPE if the index includes no commits, but snapshot() is
>>> > called.
>>> > This is an extreme case, but can happen if one takes snapshots (for
>>> > backup
>>> > purposes for example) in a separate code segment than indexing, and
>>> > does not
>>> > know if commit was called or not.
>>> >
>>> > I think we should throw an IllegalStateException instead of falling on
>>> > NPE,
>>> > w/ a descriptive message. Alternatively, we can just return null and
>>> > document it ... But I prefer the ISE instead. What do you think?
>>> >
>>> > Shai
>>> >
>>>
>>>
>>>
>>> --
>>> Kirill Zakharenko/Кирилл Захаренко (ear...@gmail.com)
>>> Home / Mobile: +7 (495) 683-567-4 / +7 (903) 5-888-423
>>> ICQ: 104465785
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
>>> For additional commands, e-mail: java-dev-h...@lucene.apache.org
>>>
>>
>
>

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

Reply via email to