Lucene.Net
  1. Lucene.Net
  2. LUCENENET-472

Operator == on Parameter does not check for null arguments

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Lucene.Net 2.9.4g
    • Fix Version/s: Lucene.Net 3.0.3
    • Component/s: Lucene.Net Core
    • Labels:
      None

      Description

      The operator == and operator != of Parameter does not check for null arguments. This means that the following construct throws an NullReferenceException:

      if (store == null)
      throw new ArgumentNullException("store");

      Work around is to write the above as:

      if ((object)store == null)
      throw new ArgumentNullException("store");

        Activity

        Hide
        Christopher Currens added a comment -

        Equals wasn't checking for null either. I've added the equality operators to Parameter and fixed equals. However, this class is barely used anymore, since Lucene moved to enum. The only class that uses it BooleanClause, because of the overridden ToString(), which can't be emulated with enums in .NET.

        Show
        Christopher Currens added a comment - Equals wasn't checking for null either. I've added the equality operators to Parameter and fixed equals. However, this class is barely used anymore, since Lucene moved to enum. The only class that uses it BooleanClause, because of the overridden ToString(), which can't be emulated with enums in .NET.

          People

          • Assignee:
            Unassigned
            Reporter:
            Pieter van Ginkel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development