Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-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 6F600D321 for ; Thu, 23 May 2013 17:56:22 +0000 (UTC) Received: (qmail 62918 invoked by uid 500); 23 May 2013 17:56:22 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 62787 invoked by uid 500); 23 May 2013 17:56:22 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 62734 invoked by uid 99); 23 May 2013 17:56:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 17:56:22 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ayyagarikiran@gmail.com designates 209.85.215.50 as permitted sender) Received: from [209.85.215.50] (HELO mail-la0-f50.google.com) (209.85.215.50) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 17:56:17 +0000 Received: by mail-la0-f50.google.com with SMTP id ed20so3504242lab.23 for ; Thu, 23 May 2013 10:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=cr3GgucJ9uNCvr8Fid7e0PuhFIN6S3vxfNo/ovE/cGE=; b=vrWHYT771Z1+pO89tDf2PKEH4r4405ewhpo3g6CobAPykjJ0noG5vtA7mw3FXlKyTJ VHC7qOlYnxt5tS0nfZKe6PcwPGheGgot2dM6RY+i+OGmD/g05PTzpHtX4JDYF89S//Mw GAm3kTGZbGgjjOcca3ZR0YEBRoxiPiLSo8jpPLAfDzNLvuDT5YvwlG/2KZkeQkoKSMSe iHThBU46gltgJIJ2Nre4sHnmZJYUcwB2acdGFirsD4Ob9GRurTooc5astiCTRQi31pP+ iV2wt66Yl83S92qKJcVQgzdAIyzBhA7SUKjhFL4iO/dWEZn5a1EFKCddElt9Fe+R3Uhq o6jg== MIME-Version: 1.0 X-Received: by 10.112.19.9 with SMTP id a9mr7005384lbe.80.1369331756241; Thu, 23 May 2013 10:55:56 -0700 (PDT) Sender: ayyagarikiran@gmail.com Received: by 10.114.19.212 with HTTP; Thu, 23 May 2013 10:55:56 -0700 (PDT) In-Reply-To: <519E1CB0.3080507@gmail.com> References: <519E1CB0.3080507@gmail.com> Date: Thu, 23 May 2013 23:25:56 +0530 X-Google-Sender-Auth: 3q6ueUS8cB7kYMTsKodHg55td4Y Message-ID: Subject: Re: Suspicius code in SyncReplRequestHandler From: Kiran Ayyagari To: Apache Directory Developers List Content-Type: multipart/alternative; boundary=14dae94734f3e91ab904dd666438 X-Virus-Checked: Checked by ClamAV on apache.org --14dae94734f3e91ab904dd666438 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2013 at 7:12 PM, Emmanuel L=E9charny w= rote: > Hi Kiran, > > while looking at Sonar reports > (https://analysis.apache.org/drilldown/violations), I found a weird > piece of code, which is likely ot be an error in SyncReplRequestHandler : > > private void sendContentFromLog( LdapSession session, SearchRequest > req, ReplicaEventLog clientMsgLog, > String fromCsn ) > throws Exception > { > ... > switch ( event ) > { > case ADD: > syncStateType =3D SyncStateTypeEnum.ADD; > break; > > case MODIFY: > syncStateType =3D SyncStateTypeEnum.MODIFY; > break; > > case MODDN: > syncStateType =3D SyncStateTypeEnum.MODDN; > <<<<--------------- No break, so the syncStateType will switch to DELETE > > case DELETE: > syncStateType =3D SyncStateTypeEnum.DELETE; > break; > } > > Am I correct to think that we must add a break ? > > yes, this is clearly a big mistake (which I guess might have resulted fro= m a merge from keydap source) thanks for finding > -- > Regards, > Cordialement, > Emmanuel L=E9charny > www.iktek.com > > --=20 Kiran Ayyagari http://keydap.com --14dae94734f3e91ab904dd666438 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Thu, May 23, 2013 at 7:12 PM, Emmanuel L=E9charny <elecharny@= gmail.com> wrote:
Hi Kiran,

while looking at Sonar reports
(https://analysis.apache.org/drilldown/violations), I found a weird=
piece of code, which is likely ot be an error in SyncReplRequestHandler :
=A0 =A0 private void sendContentFromLog( LdapSession session, SearchRequest=
req, ReplicaEventLog clientMsgLog,
=A0 =A0 =A0 =A0 String fromCsn )
=A0 =A0 =A0 =A0 throws Exception
=A0 =A0 {
=A0 =A0 ...
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch ( event )
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case ADD:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 syncStateType =3D SyncState= TypeEnum.ADD;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case MODIFY:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 syncStateType =3D SyncState= TypeEnum.MODIFY;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case MODDN:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 syncStateType =3D SyncState= TypeEnum.MODDN;
<<<<--------------- No break, so the syncStateType will switch = to DELETE

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case DELETE:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 syncStateType =3D SyncState= TypeEnum.DELETE;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }

Am I correct to think that we must add a break ?

yes, this is clearly a big mistake (which I guess might have result= ed from a merge from keydap source)
thanks for finding
--
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com




--
Kiran Ayy= agari
http://keydap.com<= /a>
--14dae94734f3e91ab904dd666438--