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

Michael McCandless commented on LUCENE-818:
-------------------------------------------


I'm planning on adding o.a.l.store.AlreadyClosedException.

But, I'm back to subclassing this from IllegalStateException (not
IOException).  There are a fair number of methods where we should
throw this exception but IOException was not already in the throws
clause.  Also, since it's rather rare, I think subclassing an
unchecked Exception is appropriate.

The only counter argument is IndexReader which currently throws
IOException if it has been closed but then acquireWriteLock is called
(for one of the "writer" methods).  So this would technically be an
API change for this particular case in IndexReader.  But I think it's
a tiny API change especially because it does not affect user's code
since they already must catch the existing IOException (vs the other
methods where adding checked "throws IOException" would be a major API
change).


> IndexWriter should detect when it's used after being closed
> -----------------------------------------------------------
>
>                 Key: LUCENE-818
>                 URL: https://issues.apache.org/jira/browse/LUCENE-818
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.1
>            Reporter: Michael McCandless
>         Assigned To: Michael McCandless
>            Priority: Minor
>
> Spinoff from this thread on java-user:
>     http://www.gossamer-threads.com/lists/lucene/java-user/45986
> If you call addDocument on IndexWriter after it's closed you'll hit a
> hard-to-explain NullPointerException (because the RAMDirectory was
> closed).  Before 2.1, apparently you won't hit any exception and the
> IndexWrite will keep running but will have released it's write lock (I
> think).
> I plan to fix IndexWriter methods to throw an IllegalStateException if
> it has been closed.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to