Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6395

[classlib][luni] Arrays.sort(double []) will result in StackOverflowError for specific arrays input

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0M11
    • 5.0M13
    • Classlib
    • None
    • Patch Available

    Description

      There is a simple testcase as below. You can see StackOverflowError if run this testcase. This is a defect of Arrays.sort(double []), I have attached a fix for it.

      import java.util.Arrays;

      public class SortTest {
      public static void main(String[] args) {
      double[] array =

      { Double.NaN, 1.0, 2.0, Double.NaN, Double.NaN, 3.0, 4.0 }

      ;
      displayArray(array);
      Arrays.sort(array);
      displayArray(array);

      System.out.println();
      }

      private static void displayArray(double[] array)

      { for (double d : array) System.out.print(d + " "); System.out.println(); }

      }

      Attachments

        1. harmony-6395-2.patch
          5 kB
          Tim Ellison
        2. HARMONY-6395.diff
          3 kB
          Jim Yu

        Activity

          People

            qiuxiaox Sean Qiu
            junjie0122 Jim Yu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: