Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4137C17F4F for ; Tue, 5 May 2015 20:09:01 +0000 (UTC) Received: (qmail 73830 invoked by uid 500); 5 May 2015 20:09:01 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 73790 invoked by uid 500); 5 May 2015 20:09:01 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 73731 invoked by uid 99); 5 May 2015 20:09:01 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2015 20:09:01 +0000 Date: Tue, 5 May 2015 20:09:01 +0000 (UTC) From: "Jordan Zimmerman (JIRA)" To: dev@curator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (CURATOR-211) Fix InterProcessReadWriteLock#readLockPredicate() index validation issue 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/CURATOR-211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jordan Zimmerman reassigned CURATOR-211: ---------------------------------------- Assignee: Jordan Zimmerman > Fix InterProcessReadWriteLock#readLockPredicate() index validation issue > ------------------------------------------------------------------------ > > Key: CURATOR-211 > URL: https://issues.apache.org/jira/browse/CURATOR-211 > Project: Apache Curator > Issue Type: Bug > Components: Recipes > Affects Versions: awaiting-response > Environment: All platforms > Reporter: Alexander Makarenko > Assignee: Jordan Zimmerman > Labels: easyfix, patch > Fix For: 2.8.0 > > > Hello, guys! I noticed a small bug in {{InterProcessReadWriteLock#readLockPredicate()}} method: > {code:title=InterProcessReadWriteLock.java, lines 196-211|borderStyle=solid} > int ourIndex = Integer.MAX_VALUE; > for ( String node : children ) > { > if ( node.contains(WRITE_LOCK_NAME) ) > { > firstWriteIndex = Math.min(index, firstWriteIndex); > } > else if ( node.startsWith(sequenceNodeName) ) > { > ourIndex = index; > break; > } > ++index; > } > StandardLockInternalsDriver.validateOurIndex(sequenceNodeName, ourIndex); > {code} > In case if {{sequenceNodeName}} is not in {{children}} list, {{StandardLockInternalsDriver.validateOurIndex()}} won't throw exception, because {{ourIndex}} in this case equals to {{Integer.MAX_VALUE}}. > I'm creating pull request on Github to fix this issue. > I know it's a very rare case, but why not fix it anyways? -- This message was sent by Atlassian JIRA (v6.3.4#6332)