Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 92364 invoked from network); 1 Mar 2011 15:44:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Mar 2011 15:44:06 -0000 Received: (qmail 95381 invoked by uid 500); 1 Mar 2011 15:44:05 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 94818 invoked by uid 500); 1 Mar 2011 15:44:01 -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 94792 invoked by uid 99); 1 Mar 2011 15:44:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2011 15:44:00 +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; Tue, 01 Mar 2011 15:43:58 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 43D3E46CDA for ; Tue, 1 Mar 2011 15:43:37 +0000 (UTC) Date: Tue, 1 Mar 2011 15:43:37 +0000 (UTC) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: <1040827359.5241.1298994217274.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2011509568.5144.1298991217145.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Updated: (LUCENE-2944) BytesRef reuse bugs in QueryParser and analysis.jsp 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-2944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Muir updated LUCENE-2944: -------------------------------- Attachment: LUCENE-2944_option2.patch here's the alternative patch, also adding documentation that you *must* make a new copy of the byte[] for each term. > BytesRef reuse bugs in QueryParser and analysis.jsp > --------------------------------------------------- > > Key: LUCENE-2944 > URL: https://issues.apache.org/jira/browse/LUCENE-2944 > Project: Lucene - Java > Issue Type: Bug > Reporter: Robert Muir > Assignee: Robert Muir > Fix For: 4.0 > > Attachments: LUCENE-2944.patch, LUCENE-2944.patch, LUCENE-2944_option2.patch > > > Some code uses BytesRef as if it were a "String", in this case consumers of TermToBytesRefAttribute. > The thing is, while our general implementation works on char[] and then populates the consumers BytesRef, > not all TermToBytesRefAttribute implementations do this, specifically ICU collation, it reuses the bytes and simply sets the pointers: > {noformat} > @Override > public int toBytesRef(BytesRef target) { > collator.getRawCollationKey(toString(), key); > target.bytes = key.bytes; > target.offset = 0; > target.length = key.size; > return target.hashCode(); > } > {noformat} > Most of the blame falls on me as I added this to the queryparser in LUCENE-2514. > Attached is a patch so that these consumers re-use a 'spare' and copy the bytes when they are going to make a long lasting object such as a Term. -- This message is automatically generated by JIRA. - 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