Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 11754 invoked from network); 6 Mar 2006 02:45:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Mar 2006 02:45:26 -0000 Received: (qmail 32281 invoked by uid 500); 6 Mar 2006 02:46:10 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 32208 invoked by uid 500); 6 Mar 2006 02:46:09 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 32197 invoked by uid 99); 6 Mar 2006 02:46:09 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Mar 2006 18:46:09 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of sandymac@gmail.com designates 64.233.162.202 as permitted sender) Received: from [64.233.162.202] (HELO zproxy.gmail.com) (64.233.162.202) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Mar 2006 18:46:08 -0800 Received: by zproxy.gmail.com with SMTP id 12so475832nzp for ; Sun, 05 Mar 2006 18:45:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references; b=mm/jrIRZHsrJSueEbtUHZ72HUORLorNccEMEJ01sDmgThuEY+B+2S4Lh3DlXMUrOG2KhJZOfPhgBf1+O2xmQz6InUp2+KgAcIaMPwYbqrcw15U3h4pjrU5oZymqujaUn24cgaFP06DP4ArA0eltULK9ytcTZT0dsKCQBSSvDeKY= Received: by 10.36.133.8 with SMTP id g8mr2525073nzd; Sun, 05 Mar 2006 18:45:48 -0800 (PST) Received: by 10.37.2.45 with HTTP; Sun, 5 Mar 2006 18:45:48 -0800 (PST) Message-ID: <6bde122b0603051845v1116f082ve928171a8b2c8451@mail.gmail.com> Date: Sun, 5 Mar 2006 21:45:48 -0500 From: "Sandy McArthur" Sender: sandymac@gmail.com To: "Jakarta Commons Developers List" Subject: Re: [io] LineIterator suggestions [was: LineIterator finalize] In-Reply-To: <6bde122b0603051640t187616f2w1803ea8b40d59316@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_6800_20511998.1141613148002" References: <6bde122b0603051640t187616f2w1803ea8b40d59316@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_6800_20511998.1141613148002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Attached is the changed I'd make. If no one objects to those changes I can commit it myself. On 3/5/06, Sandy McArthur wrote: > On 3/5/06, Stephen Colebourne wrote: > > Sandy McArthur wrote: > > >>>I don't think LineIterator should have a finalizer method and I > > >>>believe the JavaDocs in that class about resource leaks are wrong a= nd > > >>>unnecessarily alarming. > > How is the javadoc over the top? I'll happily make changes, or go ahead > > yourself. > > I checked out the IO trunk and here is what I'd change relating to the > current LineIterator: > > * I think IOIterator should be removed. It's based on the premise that > an Iterator needs special action else it will leak resources. Also > there is only one implementation of this interface, which doesn't > actually leak anything. I don't believe it's utility justify it's > existence. Maybe in a later release if you find yourself adding a > number of Iterators with a close() method you can add it back in and > retro fit LineIterator to implement it. > > * Don't automatically closing the Reader when the last line is read. > The LineIterator potentially breaks being used with the > java.io.PushbackReader. PushbackReader lets the Reader backup so to > speak but it cannot do that if the Reader is closed. > > * Either make LineIterator final or change the way hasNext works to > allow meaningful subclassing. As hasNext() is currently implemented > there is no way for a sub-class that filters lines that only match a > regex without reimplementing hasNext() completely. > > * Remove the static method closeQuietly(LineIterator). I don't think > it's useful enough to justify itself. > > * Change the constructor to throw an IllegalArguementException not a > NullPointerException. I personally view an NPE as the result of trying > to dereference a field or method of null. The constructor doesn't > actually dereference reader, we are testing that the argument reader > is a legal and meaningful value to preemptively prevent a future NPE. > > -- > Sandy McArthur > > "He who dares not offend cannot be honest." > - Thomas Paine > -- Sandy McArthur "He who dares not offend cannot be honest." - Thomas Paine ------=_Part_6800_20511998.1141613148002 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org ------=_Part_6800_20511998.1141613148002--