Apache Directory Project - ClassCastException in rename()

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > September 2007 > ClassCastException in rename()





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ClassCastException in rename()
jdemic

2007-09-30, 7:11 pm


Hey All,

I'm encountering a ClassCastException in the rename() method of
ServerContext. I'm not sure if I'm doing something wrong, but the code works
with OpenLDAP but not with ApacheDS. Here's the relevant lines from
ServerContext:

public void rename( Name oldName, Name newName ) throws NamingException
{
LdapDN oldDn = buildTarget( oldName );
LdapDN newDn = buildTarget( newName );

if ( oldDn.size() == 0 )
{
throw new LdapNoPermissionException( "can't rename the rootDSE"
);
}

// calculate parents
LdapDN oldBase = ( LdapDN ) oldName.clone(); <<<<
ClassCastException

My client code is passing in
org.springframework.ldap.support.DistinguishedName objects. I could be
mistaken, but it seems like the clone() should be on oldDn and not oldName.

Any help is appreciated,
-jd

--
View this message in context: http://www.nabble.com/ClassCastExce....html#a12970503
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Emmanuel Lecharny

2007-09-30, 7:11 pm

Hi,

as you can see, the two DN are supposed to be LdapDN objects. If you pass s=
ome
org.springframework.ldap.support.DistinguishedName objects, you will
certainly get some ClasscastException, for sure...

On 9/30/07, jdemic <john.demic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hey All,
>
> I'm encountering a ClassCastException in the rename() method of
> ServerContext. I'm not sure if I'm doing something wrong, but the code wo=

rks
> with OpenLDAP but not with ApacheDS. Here's the relevant lines from
> ServerContext:
>
> public void rename( Name oldName, Name newName ) throws NamingException
> {
> LdapDN oldDn =3D buildTarget( oldName );
> LdapDN newDn =3D buildTarget( newName );
>
> if ( oldDn.size() =3D=3D 0 )
> {
> throw new LdapNoPermissionException( "can't rename the rootDS=

E"
> );
> }
>
> // calculate parents
> LdapDN oldBase =3D ( LdapDN ) oldName.clone(); <<<<
> ClassCastException
>
> My client code is passing in
> org.springframework.ldap.support.DistinguishedName objects. I could be
> mistaken, but it seems like the clone() should be on oldDn and not oldNam=

e.
>
> Any help is appreciated,
> -jd
>
> --
> View this message in context: http://www.nabble.com/ClassCastException-in=

-rename%28%29-tf4545255.html#a12970503
> Sent from the Apache Directory Project mailing list archive at Nabble.com=

..
>
>



--=20
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com

jdemic

2007-09-30, 7:11 pm



Hmmm...shouldnt the method signature take LdapDN instances then instead of
instances of Name?


Emmanuel Lecharny-3 wrote:
>=20
> Hi,
>=20
> as you can see, the two DN are supposed to be LdapDN objects. If you pass
> some
> org.springframework.ldap.support.DistinguishedName objects, you will
> certainly get some ClasscastException, for sure...
>=20
> On 9/30/07, jdemic <john.demic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
a12970503[vbcol=seagreen]
>=20
>=20
> --=20
> Regards,
> Cordialement,
> Emmanuel L=C3=A9charny
> www.iktek.com
>=20
>=20


--=20
View this message in context: http://www.nabble.com/ClassCastException-in-r=
ename%28%29-tf4545255.html#a12970672
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Emmanuel Lecharny

2007-09-30, 7:11 pm

yes, for sure.

But we are just in the middle of a big cleanup, to get rid of such
horrible things ...

On 9/30/07, jdemic <john.demic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
> Hmmm...shouldnt the method signature take LdapDN instances then instead o=

f
> instances of Name?
>
>
> Emmanuel Lecharny-3 wrote:
ss[vbcol=seagreen]
on[vbcol=seagreen]
e[vbcol=seagreen]
l#a12970503[vbcol=seagreen]
>
> --
> View this message in context: http://www.nabble.com/ClassCastException-in=

-rename%28%29-tf4545255.html#a12970672
> Sent from the Apache Directory Project mailing list archive at Nabble.com=

..
>
>



--=20
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com