Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8336240

Test com/sun/crypto/provider/Cipher/DES/PerformanceTest.java fails with java.lang.ArithmeticException

XMLWordPrintable

        The manual test Cipher/DES/PerformanceTest.java fails because in the following lines end - start could be zero, and then that value is used in division:

        ''
        start = System.currentTimeMillis();
        //operations
        end = System.currentTimeMillis();
        int speed = (int)((data.length * count)/(end - start));
        ''

        Error thrown:

        (1).Failed Automatically and thrown java.lang.ArithmeticException.
        (2)Exception:
        java.lang.ArithmeticException:
        at PerformanceTest.runTest(PerformanceTest.java:187)
        at PerformanceTest.run(PerformanceTest.java:126)
        at PerformanceTest.main(PerformanceTest.java:77)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        atsun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:484)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
        at java.lang.Thread.run(Thread.java:744)
        JavaTest Message: Test threw exception: java.lang.ArithmeticException: / by zero
        JavaTest Message: shutting down test
        STATUS:Failed.`main' threw exception: java.lang.ArithmeticException: / by zero
        result: Failed. Execution failed: `main' threw exception: java.lang.ArithmeticException: / by zero

              fguallini Fernando Guallini
              fguallini Fernando Guallini
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: