Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-157

Calling the add() method with a multi-value attribute and a null value throws an NPE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-M21
    • Labels:
      None

      Description

      The code that causes the problem would be something like:

      entry.add("mail", null);

      Alternately this code works:

      entry.add("mail", new String[0]);

      The stack trace from the failing code is as follows:

      Caused by: java.lang.NullPointerException
      at org.apache.directory.api.ldap.model.entry.DefaultAttribute.add(DefaultAttribute.java:1006) [api-all-1.0.0-M20.jar:1.0.0-M20]
      at org.apache.directory.api.ldap.model.entry.DefaultAttribute.<init>(DefaultAttribute.java:353) [api-all-1.0.0-M20.jar:1.0.0-M20]
      at org.apache.directory.api.ldap.model.entry.DefaultEntry.put(DefaultEntry.java:1415) [api-all-1.0.0-M20.jar:1.0.0-M20]

        Activity

        Hide
        elecharny Emmanuel Lecharny added a comment -

        Closing the resolved issues.

        Show
        elecharny Emmanuel Lecharny added a comment - Closing the resolved issues.
        Hide
        akiran Kiran Ayyagari added a comment -

        Fixed by the commit[1] related to allowing empty values.

        [1] http://svn.apache.org/r1527456

        Show
        akiran Kiran Ayyagari added a comment - Fixed by the commit [1] related to allowing empty values. [1] http://svn.apache.org/r1527456
        Hide
        elecharny Emmanuel Lecharny added a comment -

        The fact that we use ellipsis in the add() method causes a pb when one add a null value with something like entry.add( "mail", null), as we iterate on the list of values (which is null).

        It has to be fixed.

        Show
        elecharny Emmanuel Lecharny added a comment - The fact that we use ellipsis in the add() method causes a pb when one add a null value with something like entry.add( "mail", null), as we iterate on the list of values (which is null). It has to be fixed.

          People

          • Assignee:
            elecharny Emmanuel Lecharny
            Reporter:
            smoyer1 Steve Moyer
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development