Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 70541 invoked from network); 14 Mar 2011 18:39:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Mar 2011 18:39:52 -0000 Received: (qmail 93341 invoked by uid 500); 14 Mar 2011 18:39:51 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 93278 invoked by uid 500); 14 Mar 2011 18:39:51 -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 93271 invoked by uid 99); 14 Mar 2011 18:39:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Mar 2011 18:39:51 +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; Mon, 14 Mar 2011 18:39:50 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E8A793A93AA for ; Mon, 14 Mar 2011 18:39:29 +0000 (UTC) Date: Mon, 14 Mar 2011 18:39:29 +0000 (UTC) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: <1115104899.1488.1300127969949.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 [ 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.patch i agree guys, here's the updated patch. > 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.patch, 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