PDA

View Full Version : Error casting ldap userPassword to String



minakari
Oct 5th, 2007, 02:15 AM
I am using springldap framework in my application,but there is a problem I can't cast it to String what can I do?


String userPassword = (String) attributes.get("userPassword").get();
if (userPassword != null)
contactDTO.setUserPassword(userPassword);


and the ERROR is :

java.lang.ClassCastException

rasky
Oct 5th, 2007, 02:55 AM
Well, if it's not a String you can't cast it to a String. My guess is that it is hashed in the LDAP entry and will be returned back to you as a byte array (of course, this means that returning the password back to the client is essentially useless, as there is no way of getting the actual password, just the hash).