directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DIRAPI-53) Method getAttributeTypes() from the org.apache.directory.shared.ldap.model.entry.DefaultEntry does not return values
Date Fri, 20 Jan 2012 08:18:41 GMT

     [ https://issues.apache.org/jira/browse/DIRAPI-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Lecharny updated DIRAPI-53:
------------------------------------

    Fix Version/s: 1.0.0-M9
    
> Method getAttributeTypes() from the org.apache.directory.shared.ldap.model.entry.DefaultEntry
does not return values
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRAPI-53
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-53
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M8
>         Environment: Win7 64bit, RAM 8Gb, ApacheDS 1.5, LDAP API 1.0.0-M8, JBoss Developer
Studio 4, JDK 1.6.0_u27 64bit
>            Reporter: Valery Maslau
>             Fix For: 1.0.0-M9
>
>
> There is the code:
> public class LDAP_01 {
>       public static void main(String[] args) {
>         System.out.println("Started.");
>         LdapConnection connection = new LdapNetworkConnection("localhost", 10389);
>         connection.setTimeOut(30000);
>         Dn dn;
>         try {
>             dn = new Dn("uid=admin,ou=system");
>             BindRequest brq = new BindRequestImpl();
>             brq.setName(dn);
>             brq.setCredentials("somepassword");
>             BindResponse br = connection.bind(brq);
>             if (connection.isConnected()) {
>                 System.out.println("Connected.");
>                 if (connection.isAuthenticated()) {
>                     if (ResultCodeEnum.SUCCESS == br.getLdapResult().getResultCode())
{
>                         System.out.println("Yeah! Binded...");
>                         dn = new Dn("uid=mvn,o=ipgo");
>                         SearchRequest sr = new SearchRequestImpl();
>                         sr.setBase(dn);
>                         sr.setFilter("(cn=mvnval)");
>                         sr.setScope(SearchScope.SUBTREE);
>                         SearchCursor scr = connection.search(sr);
>                         scr.next();
>                         Response rsp = scr.get();
>                         if (rsp != null) {
>                             if (rsp instanceof SearchResultEntry) {
>                                 SearchResultEntry sre = (SearchResultEntry) rsp;
>                                 Entry entr = sre.getEntry();
>                                 System.out.println("#### " + entr.toString());
>                                 Set<AttributeType> attrs = entr.getAttributeTypes();
>                                 if (attrs.isEmpty()) {
>                                     System.out.println("#### Empty Attributes!");
>                                 }
>                                 for (AttributeType item : attrs) {
>                                     System.out.println("#### " + item.toString());
>                                 }
>                             }
>                         }
>                     }
>                 }
>             }
>         } catch (LdapException e1) {
>             e1.printStackTrace();
>             System.exit(0);
>         } catch (IOException e1) {
>             e1.printStackTrace();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>         try {
>             connection.close();
>             System.out.println("#### Connection closed");
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
>         System.out.println("Yeah! Finished.");
>     }
> }
> There is the console output:
> Connected.
> Yeah! Binded...
> #### Entry
>     dn: uid=mvn,o=ipgo
>     objectClass: organizationalPerson
>     objectClass: person
>     objectClass: inetOrgPerson
>     objectClass: top
>     uid: mvn
>     userPassword: ****************************
>     sn: m
>     title: cn=SEM,ou=Roles,o=ipgo
>     title: cn=Software Engineering Manager,ou=Roles,o=ipgo
>     cn: mvnval
> #### Empty Attributes!
> #### Connection closed
> Yeah! Finished.
> So, the method getAttributeTypes returns the empty Set ever; however it can be noticed
that the data is present into the Entry object, but can be retrieved only using toString()
method. 
> The method from the DefaultEntry.class ever returns empty attributeTypes: 
> public final class DefaultEntry implements Entry
> ......
> public Set<AttributeType> getAttributeTypes()
>     {
>         Set<AttributeType> attributeTypes = new HashSet<AttributeType>();
>         for ( Attribute attribute : attributes.values() )
>         {
>             if ( attribute.getAttributeType() != null )
>             {
>                 attributeTypes.add( attribute.getAttributeType() );
>             }
>         }
>         return attributeTypes;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message