Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-95

Level.CompareTo() may result a wrong Value -> sorting of Levels does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.10
    • 1.2.11
    • Core
    • None
    • VS2005 C#

    Description

      I want to show a sorted list of available Levels.
      The sort routine uses Level.Compare(Level l, Level r).
      The result might be wrong when comparing ALL to another Level, because there is an overflow when just subtracting the m_levelValue.

      try to call the integer compare method:
      Level.cs:
      public static int Compare(Level l, Level r)

      { ... //orig: return l.m_levelValue - r.m_levelValue; -> bug when int overflow return l.m_levelValue.CompareTo(r.m_levelValue); }

      hope this helps.

      best regards, Bernd.

      Attachments

        Activity

          People

            ron Ron Grabowski
            berndk Bernd Klaiber
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: