Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 9882 invoked from network); 5 Mar 2007 21:34:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2007 21:34:16 -0000 Received: (qmail 35624 invoked by uid 500); 5 Mar 2007 21:34:20 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 35572 invoked by uid 500); 5 Mar 2007 21:34:20 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 35539 invoked by uid 99); 5 Mar 2007 21:34:20 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2007 13:34:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2007 13:34:11 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 09F28714340 for ; Mon, 5 Mar 2007 13:33:51 -0800 (PST) Message-ID: <29763459.1173130431037.JavaMail.jira@brutus> Date: Mon, 5 Mar 2007 13:33:51 -0800 (PST) From: "Hoss Man (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-818) IndexWriter should detect when it's used after being closed In-Reply-To: <31514116.1172518447790.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478166 ] Hoss Man commented on LUCENE-818: --------------------------------- 1) my example attempted to be concise ... ideally we would be explicit in our catches. 2) the body of the catch clauses could be put into a helper method just like ensureOpen to help reduce code noise 3) if there are situations where damage will be done by not testing that we are open before taking some action, that would fall under my "adding better error checking in those specific cases (if we know of any) and throwing explicit exceptions." ... a lot of this could be achieved (as Yonik suggested) by nulling out more things in close so that the first attempt to do something dangerous after the close triggered a NullPointerException. 4) "fail fast" is always good ... except when it makes the non-failure case slow ... i was merely suggesting an alternative that would achieve the same results without penalizing performance of people obeying the rules. as an added bonus, both methodologies could be used... if numDoc(), maxDoc(), isDeleted(), and hasDeletions() are the only mehtods were people are concerned about the performance impacts of calling ensureOpen() everytime, then those methods could be the ones where isOpen could be checked in any exception handling block, and all of the other mehtods could use ensureOpen as orriginal described. > 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 > Attachments: LUCENE-818.patch, LUCENE-818.take2.patch, LUCENE-818.take3.patch > > > 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org