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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.10
    • Fix Version/s: 1.2.11
    • Component/s: Core
    • Labels:
      None
    • Environment:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: