Project

General

Profile

« Previous | Next » 

Revision 6037

Added by Matt Jones over 13 years ago

Changed AuthLDAP to deal with cases where getAttributes encounters non-string
attributes (which used to cause a ClassCastException). Now, if an attribute
value can not be cast to string, we catch the class cast exception and just
skip this value. This only typically occurs when an LDAP server is set to send
back userPassword which is binary and can't be cast to String.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
986 986
				String attName = att.getID();
987 987
				NamingEnumeration attvalues = att.getAll();
988 988
				while (attvalues.hasMore()) {
989
					String value = (String) attvalues.next();
990
					values.add(value);
989
				    try {
990
				        String value = (String) attvalues.next();
991
				        values.add(value);
992
				    } catch (ClassCastException cce) {
993
				        logMetacat.debug("Could not cast LDAP attribute (" +
994
				                attName + ") to a String value, so skipping.");
995
				    }
991 996
				}
992 997
				attributes.put(attName, values);
993 998
			}

Also available in: Unified diff