Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-M13
    • Component/s: None
    • Labels:
      None

      Description

      It seems there is an incorrect condition in if statement "else if ( filterList != null || !filterList.isEmpty() )". (still existing in the current snapshot, 1bf525559583e7469149038fa58adeffb2b5a246). If filterList is null, it would cause NPE.

      256     public LdapFilter getFilter( int offset )
      257     {
      258         if ( startToken != null && startToken.getOffset() == offset )
      259         {
      260             return parent;
      261         }
      262         else if ( filterList != null || !filterList.isEmpty() )
      263         {
      264             for ( Iterator<LdapFilter> it = filterList.iterator(); it.hasNext(); )
      265             {
      266                 LdapFilter filter = it.next();
      267                 if ( filter != null && filter.getFilter( offset ) != null )
      268                 {
      269                     return filter.getFilter( offset );
      270                 }
      271             }
      272             return null;
      273         }
      274         else
      275         {
      276             return null;
      277         }
      278     }
      

      The indented code was this?

      262         else if ( filterList != null && !filterList.isEmpty() )
      

        Activity

        Hide
        seelmann Stefan Seelmann added a comment -

        Good catch, that condition doesn't makes sense.

        The reason why no NPE happened is that filterList is never null. So I just removed the null check and made it final (plus some other changes): http://svn.apache.org/viewvc?rev=1776025&view=rev

        Show
        seelmann Stefan Seelmann added a comment - Good catch, that condition doesn't makes sense. The reason why no NPE happened is that filterList is never null. So I just removed the null check and made it final (plus some other changes): http://svn.apache.org/viewvc?rev=1776025&view=rev

          People

          • Assignee:
            Unassigned
            Reporter:
            lifove JC
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development