Details

      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

      { attribute = attributes.get(id); }

      catch (NullPointerException npe)

      { return defaultValue; }

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 28 weeks, 4 days ago