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

REGRESSION: Two JCK1.4a-runtime api/java_awt/Choice tests fail

XMLWordPrintable

    • generic
    • generic



      Name: iaR10016 Date: 06/11/2003


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b08
                         (passes with JDK1.5.0-b07, JDK1.4.2-b25, JDK1.4.1-b21)
      JCK : JCK1.4a-runtime
      Platform[s] : all
      switch/Mode : default
      JCK test owner : http://javaweb.eng/jck/usr/owners.jto
      Falling test[s]:
                api/java_awt/Choice/descriptions.html#AddRemoveInsertGet [Choice0117, Choice0119]
                api/java_awt/Choice/descriptions.html#SelectGet [Choice0126]

      Two api/java_awt/Choice tests fail with JDK1.5.0-b08.

      Java TM 2 Platform Std. Ed. v1.5.0 Specification reads about java.awt.Choice.insert(String, int) method:
      ...
      public void insert(String item, int index)

      Inserts the item into this choice at the specified position. Existing items at an index greater than or equal
      to index are shifted up by one to accommodate the new item. If index is greater than or equal to the number of
      items in this choice, item is added to the end of this choice.

      If the item is the first one being added to the choice, then the item becomes selected. Otherwise, if the
      selected item was one of the items shifted, the first item in the choice becomes the selected item. If the
      selected item was no among those shifted, it remains the selected item.

      Parameters:
           item - the non-null item to be inserted
           index - the position at which the item should be inserted
      ...

      The following test example demonstrates the bug:

      --------- test.java ---------
      import java.awt.*;

      public class test {
         public static void main(String[] args) {

            Choice ch = new Choice();
            ch.add("Item 1");
            ch.add("Item 2");
            ch.add("Item 3");
            ch.select("Item 2");
            System.out.println("Index selected: " + ch.getSelectedIndex());
            System.out.println("Item selected: " + ch.getSelectedItem());

            System.out.println("------------------------------------------------------------");
            ch.insert("New item 1", 1);
            System.out.println("Index selected: " + ch.getSelectedIndex() + " (0 expected)");
            System.out.println("Item selected: " + ch.getSelectedItem() + " ('Item 1' expected)");

            System.out.println("------------------------------------------------------------");
            ch.select("Item 2");
            ch.insert("New item 2", 0);
            System.out.println("Index selected: " + ch.getSelectedIndex() + " (0 expected)");
            System.out.println("Item selected: " + ch.getSelectedItem() + " ('New Item 2' expected)");
          }
      }
      -----------------------------

      Sample output is:
      ...
      $ /net/linux-15/export/home/java/jdk1.5.0/linux/bin/java -showversion test
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b08)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b08, mixed mode)

      Index selected: 1
      Item selected: Item 2
      ------------------------------------------------------------
      Index selected: 1 (0 expected)
      Item selected: New item 1 ('Item 1' expected)
      ------------------------------------------------------------
      Index selected: 2 (0 expected)
      Item selected: New item 1 ('New Item 2' expected)
      $
      ...

      Please, note that this test works correctly with previous JDKs, for example with JDK1.4.2-b25
      the test sample output is:
      ...
      $ /net/linux-15/export/home/java/jdk1.4.2/linux/bin/java -showversion test
      java version "1.4.2-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b25)
      Java HotSpot(TM) Client VM (build 1.4.2-rc-b25, mixed mode)

      Index selected: 1
      Item selected: Item 2
      ------------------------------------------------------------
      Index selected: 0 (0 expected)
      Item selected: Item 1 ('Item 1' expected)
      ------------------------------------------------------------
      Index selected: 0 (0 expected)
      Item selected: New item 2 ('New Item 2' expected)
      $
      ...

      Test source location:
      =====================
      /java/re/jck/1.4a/archive/fcs/binaries/JCK-runtime-14a/tests/api/java_awt/Choice/AddRemoveInsertGetTests.java
      /java/re/jck/1.4a/archive/fcs/binaries/JCK-runtime-14a/tests/api/java_awt/Choice/SelectGetTests.java

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results/tiger/b08/jck14a/sparc/sol10_sparc_cdeclient_incgc_linux-8/workDir/api/java_awt/Choice/descriptions_AddRemoveInsertGet.jtr
      /net/jtgb4u4c.sfbay/export/sail15/results/tiger/b08/jck14a/sparc/sol10_sparc_cdeclient_incgc_linux-8/workDir/api/java_awt/Choice/descriptions_SelectGet.jtr

      How to reproduce:
      =================
      Run the following script (you may need to change it's JCK and JDK variables):
      --- script start ---
      #!/bin/bash
      JCK="/java/re/jck/1.4a/archive/fcs/binaries/JCK-runtime-14a"
      JDK="/net/jdk/export/disk8/local.java/jdk1.5/linux-i386"
      export CLASSPATH="$JCK/classes:$JCK/lib/javatest.jar"
      $JDK/bin/java javasoft.sqe.tests.api.java.awt.Choice.AddRemoveInsertGetTests -TestCaseID Choice0117 Choice0119
      echo =======================================================================================
      $JDK/bin/java javasoft.sqe.tests.api.java.awt.Choice.SelectGetTests -TestCaseID Choice0126
      --- script end ---

      Test output:
      ============
      Choice0117: Failed. Choice0117 failed
      Choice0119: Failed. Choice0119 failed
      ====== Choice0117 ======
      1
      New Item
      ====== Choice0119 ======
      1
      Item 1
      STATUS:Failed.test cases: 2; all failed; first test case failure: Choice0117
      =======================================================================================
      Choice0126: Failed. Choice0126 failed
      ====== Choice0126 ======
      STATUS:Failed.test cases: 1; all failed; first test case failure: Choice0126

      Specific machine info:
      ======================
      Hostname: linux-8
      OS: Solaris 10 (sparc) (CDE)

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

            ssisunw Ssi Ssi (Inactive)
            irasunw Ira Ira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: