Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C2DE905B for ; Thu, 9 Feb 2012 17:16:25 +0000 (UTC) Received: (qmail 83317 invoked by uid 500); 9 Feb 2012 17:16:23 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 83110 invoked by uid 500); 9 Feb 2012 17:16:22 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 83098 invoked by uid 99); 9 Feb 2012 17:16:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 17:16:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 17:16:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 768651ADEC3 for ; Thu, 9 Feb 2012 17:15:59 +0000 (UTC) Date: Thu, 9 Feb 2012 17:15:59 +0000 (UTC) From: "Uwe Schindler (Commented) (JIRA)" To: dev@lucene.apache.org Message-ID: <426968278.19957.1328807759486.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <419009559.19772.1328805119466.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LUCENE-3766) Remove/deprecate Tokenizer's default ctor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-3766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204660#comment-13204660 ] Uwe Schindler commented on LUCENE-3766: --------------------------------------- As far as I remember this was because of Solr. Some tokenizers in Solr were originally TokenStreams. After we restructured all of them, there is no reason to keep default ctor or allow null at all. > Remove/deprecate Tokenizer's default ctor > ----------------------------------------- > > Key: LUCENE-3766 > URL: https://issues.apache.org/jira/browse/LUCENE-3766 > Project: Lucene - Java > Issue Type: Improvement > Reporter: Michael McCandless > Fix For: 3.6, 4.0 > > > I was working on a new Tokenizer... and I accidentally forgot to call super(input) (and super.reset(input) from my reset method)... which then meant my correctOffset() calls were silently a no-op; this is very trappy. > Fortunately the awesome BaseTokenStreamTestCase caught this (I hit failures because the offsets were not in fact being corrected). > One minimal thing we can do (but it sounds like from Robert there may be reasons why we can't) is add {{assert input != null}} in Tokenizer.correctOffset: > {noformat} > Index: lucene/core/src/java/org/apache/lucene/analysis/Tokenizer.java > =================================================================== > --- lucene/core/src/java/org/apache/lucene/analysis/Tokenizer.java (revision 1242316) > +++ lucene/core/src/java/org/apache/lucene/analysis/Tokenizer.java (working copy) > @@ -82,6 +82,7 @@ > * @see CharStream#correctOffset > */ > protected final int correctOffset(int currentOff) { > + assert input != null: "subclass failed to call super(Reader) or super.reset(Reader)"; > return (input instanceof CharStream) ? ((CharStream) input).correctOffset(currentOff) : currentOff; > } > {noformat} > But best would be to remove the default ctor that leaves input null... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org