Details
-
Type:
Technical Task
-
Status: Closed
-
Priority:
Critical
-
Resolution: No Longer Reproducible
-
Affects Version/s: --Sprint 12/11
-
Fix Version/s: --Sprint 12/11, 6.1.0 CE RC1
-
Component/s: Application Security > LDAP, Portal Services
-
Environment:!!! ATTENTION !!!
this bug is on trunk (revision 93339) not on beta3
Description
Hello,
with trunk (in fact since revision changes 92262 committed on Nov. 2nd) there is a problem with the LDAP import if there are fields that are not mapped. Prior to this, you could e.g. leave the Middle Name field unmapped and the LDAP import would work. Since this revision, you get a NPE on the LDAP import.
The problem is related to the code redesign in the following method:
public static String getAttributeString(
Attributes attributes, String id, String defaultValue)
throws NamingException {
Attribute attribute = attributes.get(id);
if (attribute == null)
{ return defaultValue; }Object object = attribute.get();
if (object == null) { return defaultValue; }
return object.toString();
}
the method call Attribute attribute = attributes.get(id); can throw a NPE and that exception is not catched in the code.
Prior to this change the code looked like this:
public static Object getAttributeValueAsObject(
Attributes attributes, String id, Object defaultValue)
throws NamingException {
try
{ Attribute attribute = attributes.get(id); Object obj = attribute.get(); return obj; }catch (NullPointerException npe)
{ return defaultValue; }}
here the method call Attribute attribute = attributes.get(id); took place within the try catch statement and the NPE was explicitly catched.
So simply changing the code like this should solve the problem:
Attribut attribute = null;
try
catch (NullPointerException npe)
{ return defaultValue; }