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

Collections.rotate() incorrectly raises ArithmeticException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs



      Name: auR10023 Date: 01/03/2001



      java.util.Collections.rotate(List,int) incorrectly raises ArithmeticException
      with an empty list.

      Here is the example:

      ------t.java-----
      import java.util.*;

      public class t {
          public static void main(String[] args){
              Vector v = new Vector();
              Collections.rotate(v,1);
          }
      }

      ----output:----

      Exception in thread "main" java.lang.ArithmeticException: / by zero
              at java.util.Collections.rotate1(Collections.java:719)
              at java.util.Collections.rotate(Collections.java:712)
              at t.main(t.java:6)

      ======================================================================

            jjb Josh Bloch
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: