Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-40999

Errors sorting announcements with null values in date attributes

    Details

    • 19 status:
      Resolved
    • 12 status:
      Resolved
    • Test Plan:
      Hide

      Please add a Test Plan here.

      Show
      Please add a Test Plan here.

      Description

      There is a problem with the compare method for dates in "AnnouncementWrapperComparator".

      When two dates are equal or null, in both cases the method should return "0" but it doesn't.

       

      Although I haven't been able to reproduce the error in the nightlies, I attach the stacktrace of the error produce in our University. In our case, the problem only occurs when we try to order more than 31 announcements. Searching the web I have found this issue:

      https://bugs.openjdk.java.net/browse/JDK-8192410

      There it's specifically mentioned that "For inputs of size < 32, TimSort uses insertion sort, and the exception is never thrown. For inputs of size >= 32, TimSort uses a merge sort. If certain circumstances occur during merging, TimSort can detect the error with the comparison method and will throw the exception." This is exactly our case.

      That "certain circumstances" are the 2 mentioned at the beggining of this description since the method doesn't ensure wich is stated in the documentation of Oracle for compare methods:

      https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html#compareTo-T-

       

       

       

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  adrianmticarum Adrian Martinez
                  Reporter:
                  adrianmticarum Adrian Martinez
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code