Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 92418 invoked from network); 1 Jul 2006 01:16:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Jul 2006 01:16:12 -0000 Received: (qmail 44827 invoked by uid 500); 1 Jul 2006 01:16:11 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 44772 invoked by uid 500); 1 Jul 2006 01:16:10 -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 44761 invoked by uid 99); 1 Jul 2006 01:16:10 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jun 2006 18:16:10 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jun 2006 18:16:09 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3298C410348 for ; Sat, 1 Jul 2006 01:14:30 +0000 (GMT) Message-ID: <9815292.1151716470204.JavaMail.jira@brutus> Date: Sat, 1 Jul 2006 01:14:30 +0000 (GMT+00:00) From: "Emmanuel Lecharny (JIRA)" To: dev@directory.apache.org Subject: [jira] Commented: (DIRSERVER-658) ClassCast exception when fetching DNs from root DES In-Reply-To: <13952402.1151714129769.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DIRSERVER-658?page=comments#action_12418748 ] Emmanuel Lecharny commented on DIRSERVER-658: --------------------------------------------- I think that a patch like this one could solve the problem : Index: apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java =================================================================== --- apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java (revision 416873) +++ apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java (working copy) @@ -428,7 +428,7 @@ partitions.put( partition.getSuffix().toString(), partition ); Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); - namingContexts.add( partition.getUpSuffix() ); + namingContexts.add( partition.getUpSuffix().toString() ); } @@ -442,7 +442,7 @@ } Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); - namingContexts.remove( partition.getUpSuffix() ); + namingContexts.remove( partition.getUpSuffix().toString() ); partitions.remove( key ); partition.sync(); Alex, is this ok with you ? > ClassCast exception when fetching DNs from root DES > --------------------------------------------------- > > Key: DIRSERVER-658 > URL: http://issues.apache.org/jira/browse/DIRSERVER-658 > Project: Directory ApacheDS > Type: Bug > Versions: 1.0-RC4 > Reporter: Emmanuel Lecharny > Assignee: Emmanuel Lecharny > > When fetching for DNs in LdapBrowser, you get an exception while encoding the SearchResultEntry : > ... > Caused by: java.lang.ClassCastException: org.apache.directory.shared.ldap.name.LdapDN > at org.apache.directory.shared.ldap.codec.search.SearchResultEntry.computeLength(SearchResultEntry.java:240) > at org.apache.directory.shared.ldap.codec.LdapMessage.computeLength(LdapMessage.java:530) > at org.apache.directory.shared.ldap.codec.LdapMessage.encode(LdapMessage.java:602) > at org.apache.directory.shared.ldap.codec.TwixEncoder.encodeBlocking(TwixEncoder.java:121) > at org.apache.directory.shared.ldap.codec.TwixEncoder.encode(TwixEncoder.java:200) > at org.apache.directory.shared.ldap.message.MessageEncoder.encode(MessageEncoder.java:131) > at org.apache.mina.filter.codec.asn1.Asn1CodecEncoder.encode(Asn1CodecEncoder.java:55) > at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:226) > ... 22 more > The problem is that when encoding a SearchResultEntry, the values are supposed to be Strings or byte arrays, not LdapDNs. When you fetch for DNs in the root DSE, the result is stored in the SearchResultEntry as LdapDN objects, not Strings, and it's allowad, as the method which set the value accept an Object. > We have to fix two problems : > - first, check that the Object is either a String or a byte[], nothing else (defensive programming) > - second, avoid storing LdapDN objects where String or byte[] are expected :) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira