Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F3DE10F40 for ; Tue, 7 Jan 2014 21:00:15 +0000 (UTC) Received: (qmail 1482 invoked by uid 500); 7 Jan 2014 21:00:12 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 1409 invoked by uid 500); 7 Jan 2014 21:00:12 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 1401 invoked by uid 99); 7 Jan 2014 21:00:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jan 2014 21:00:12 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rcmuir@gmail.com designates 209.85.212.182 as permitted sender) Received: from [209.85.212.182] (HELO mail-wi0-f182.google.com) (209.85.212.182) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jan 2014 21:00:06 +0000 Received: by mail-wi0-f182.google.com with SMTP id en1so1257888wid.15 for ; Tue, 07 Jan 2014 12:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=+FhUN8d63Nc8Sequ1qMdlq2XUtxcq1C0IVOsMD37Yvg=; b=rWWpSFwdFgP1hZ9LYarYT8fBjWSKZ5xtIWYnSx9MLlMPyJctl9hm+jPTNYCfywHf/q JhmsnQRAkpRDM2ZMhFR9TMOnE/nIY1m03ojDGySA938GbI+Tm/EOP6slp3hSs2WdlTf2 xySvKFhahg05pgEbvD1BdeKzzbA7+8IxI41q+QN5ZUN0/RKotITl4BzGgN9ZhqcrggD5 VnnhWyidTM/VQRIdzwjngQoVJfcWlBa/4AtpAC7dZOGF3M24pp4YNsekEIA+DlUz08eP 9CBLFasXlgW3koL8rTtD70gnnM9FMpZ7WyspCjfqsckleH4HiJmc+bmtrhLDOWhsBgSS LK5w== X-Received: by 10.180.104.106 with SMTP id gd10mr18132071wib.47.1389128386701; Tue, 07 Jan 2014 12:59:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.58.165 with HTTP; Tue, 7 Jan 2014 12:59:25 -0800 (PST) In-Reply-To: References: From: Robert Muir Date: Tue, 7 Jan 2014 15:59:25 -0500 Message-ID: Subject: Re: How is incrementToken supposed to detect the lack of reset()? To: java-user Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Benson, do you want to open an issue to fix this constructor to not take Reader? (there might be one already, but lets make a new one). These things are supposed to be reused, and have setReader for that purpose. i think its confusing and contributes to bugs that you have to have logic in e.g. the ctor THEN ALSO in reset(). if someone does it correctly in the ctor, but they only test "one time", they might think everything is working.. On Tue, Jan 7, 2014 at 3:23 PM, Benson Margulies wrote: > For the record of other people who implement tokenizers: > > Say that your tokenizer has a constructor, like: > > public MyTokenizer(Reader reader, ....) { > super(reader); > myWrappedInputDevice = new MyWrappedInputDevice(reader); > } > > Not a good idea. Tokenizer carefully manages the data flow from the > constructor arg to the 'input' field. The correct form is: > > public MyTokenizer(Reader reader, ....) { > super(reader); > myWrappedInputDevice = new MyWrappedInputDevice(this.input); > } > > > > On Tue, Jan 7, 2014 at 2:59 PM, Robert Muir wrote: > >> See Tokenizer.java for the state machine logic. In general you should >> not have to do anything if the tokenizer is well-behaved (e.g. close >> calls super.close() and so on). >> >> >> >> On Tue, Jan 7, 2014 at 2:50 PM, Benson Margulies >> wrote: >> > In 4.6.0, >> org.apache.lucene.analysis.BaseTokenStreamTestCase#checkResetException >> > >> > fails if incrementToken fails to throw if there's a missing reset. >> > >> > How am I supposed to organize this in a Tokenizer? A quick look at >> > CharTokenizer did not reveal any code for the purpose. >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> > For additional commands, e-mail: java-user-help@lucene.apache.org >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org