Return-Path: X-Original-To: apmail-directory-api-archive@minotaur.apache.org Delivered-To: apmail-directory-api-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B14D617DDC for ; Mon, 2 Feb 2015 22:23:53 +0000 (UTC) Received: (qmail 52570 invoked by uid 500); 2 Feb 2015 22:23:51 -0000 Delivered-To: apmail-directory-api-archive@directory.apache.org Received: (qmail 52530 invoked by uid 500); 2 Feb 2015 22:23:51 -0000 Mailing-List: contact api-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: api@directory.apache.org Delivered-To: mailing list api@directory.apache.org Received: (qmail 52518 invoked by uid 99); 2 Feb 2015 22:23:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2015 22:23:51 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of elecharny@gmail.com designates 74.125.82.181 as permitted sender) Received: from [74.125.82.181] (HELO mail-we0-f181.google.com) (74.125.82.181) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2015 22:23:44 +0000 Received: by mail-we0-f181.google.com with SMTP id k48so41776408wev.12 for ; Mon, 02 Feb 2015 14:21:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=sjc9WGxBASPT2k+5tQPzgX+oJw5oC6daWXKCO06u3vE=; b=jI/0qpnky4bLrlN0QZzOoZa22LJaubIWfxlYaiNx4ZVG5VD8CueRB2kfslA5at6ZTL UcMeIP2+fl7kW/72+1SEtR9Vx5HBiohvyTahDeQa+cMnzy98XJTI+1w3BgsuC3v8j09F bdj1q4s+OK7LiS0EYMzIe4rzkN8vEZWHbKMVQUU/GCBEG2Z4tEl4MhA+1daisb9yo99j kfNW9eGuTZWlkMr4r3yl4nuf/CqBZByUYn36Fn2Ql5jYnARKri1/qniaJ6VLRtKptjjm QXFR4vM81T67C/5z79pawlmopuadtkn9a1yCRq/MSQinEu6f45jGqjz+BffNGYfaN70J OBkQ== X-Received: by 10.194.108.9 with SMTP id hg9mr47627775wjb.68.1422915713652; Mon, 02 Feb 2015 14:21:53 -0800 (PST) Received: from [192.168.1.22] (AMontsouris-651-1-103-211.w82-123.abo.wanadoo.fr. [82.123.246.211]) by mx.google.com with ESMTPSA id x6sm29755367wjf.24.2015.02.02.14.21.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 14:21:52 -0800 (PST) Message-ID: <54CFF87F.8060007@gmail.com> Date: Mon, 02 Feb 2015 23:21:51 +0100 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: api@directory.apache.org Subject: Re: Proper use of LdapConnectionPool References: <9BD825F3554FD04AAB3B8BCBA96F192F5D0CCA44@CO1PRD9201MB011.026d.mgd.msft.net> <54C74AD9.6090302@gmail.com> <9BD825F3554FD04AAB3B8BCBA96F192F5D0CDD97@CO1PRD9201MB011.026d.mgd.msft.net> <54C82271.5000409@gmail.com> <9BD825F3554FD04AAB3B8BCBA96F192F5D0CE26B@CO1PRD9201MB011.026d.mgd.msft.net> <9BD825F3554FD04AAB3B8BCBA96F192F5D0CE341@CO1PRD9201MB011.026d.mgd.msft.net> <54C831F9.30100@gmail.com> <9BD825F3554FD04AAB3B8BCBA96F192F5D0DF521@BN1PRD9201MB007.026d.mgd.msft.net> In-Reply-To: <9BD825F3554FD04AAB3B8BCBA96F192F5D0DF521@BN1PRD9201MB007.026d.mgd.msft.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Le 02/02/15 21:28, Harris, Christopher P a =C3=A9crit : > Hi, Emmanuel. > > Do you have any updates on this issue? Sorry, was busy the last few days... Here are my findings : Basically, it works. I have used a slightly different version of the code= : public void searchLdapUsingHybridApproach() { SearchCursor cursor =3D new SearchCursorImpl( null, 30000, TimeUnit.SECONDS ); Entry entry =3D null; try { SearchRequest sr =3D new SearchRequestImpl(); sr.setBase( new Dn( "ou=3Dsystem" ) ); sr.setFilter( "(ObjectClass=3D*)" ); sr.setScope( SearchScope.SUBTREE ); cursor =3D connection.search( sr ); Response response; while ( cursor.next() && cursor.isEntry() ) { response =3D cursor.get(); System.out.println( ( ( SearchResultEntry ) response ).getEntry() ); entry =3D cursor.getEntry(); } } catch ( LdapException ex ) { ex.printStackTrace(); } catch ( CursorException ex ) { ex.printStackTrace(); } finally { cursor.close(); try { connection.close(); } catch ( IOException ex ) { ex.printStackTrace(); } } } just to check that ther API returns the correct entries in the various cases (OBJECT, ONELEVEL and SUBTREE). It does. So now, here is my hypothesys : there is a bug in the EntryMapper. When I run the code using the EntryMapper, I get a NPE because the EntryMapper tries to do that : public Person map( Entry entry ) throws LdapException { try { return new Person.Builder() .setDistinguishedName( entry.getDn().getName(= ) ) .setFirstName( entry.get( "givenName" ).getString() ) <---- NPE here because I have no givenName in the entry I'm reading .setLastName( entry.get( "sn" ).getString() )= .setTitle( entry.get( "title" ).getString() )= .setDepartment( entry.get( "department" ).getString() ) .setDivision( entry.get( "extensionAttribute14" ).getString() ) .setCity( entry.get( "l" ).getString() ) .setCountry( entry.get( "co" ).getString() ) .setEmail( ( entry.get( "mail" ) !=3D null ) = ? entry.get( "mail" ).getString() : "" ) .setDeskLocation( entry.get( "postOfficeBox" ).getString() ) .setOfficePhone( ( entry.get( "telephoneNumber" ) !=3D nul= l ) ? entry.get( "telephoneNumber" ).getString() : "" ) .setDirectReports( entry.get( "directreports" ) ) .build(); So my guess is that in your case your entry is missing some of the expected attribute, and this is why you get no result. Can you chack that by printing the entry just hafter having pulled it from the LDAP server ? Thanks !