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

Warning Message when Calling removeAll() on an Empty List

XMLWordPrintable

    • 1.3
    • sparc
    • solaris_7

      When List.removeAll() is called on an empty java.awt.List, the following message
      is generated:

      Warning:
          Name: slist
          Class: XmList
          Item(s) to be deleted are not present in the list.

      The problem does not occur on the win32 JDK.

      Below is a test case. Click on the "remove all" button once to remove the list.
      Clicking a second time will then produce the warning message.

      --------------------------------------------------------------------------------

      import java.awt.*;
      import java.awt.event.*;

      class Main extends Frame implements ActionListener {
          List l = new List(10,
              false);
          Button b;

          Main() {
              super("removeAll Example");

              for (int i = 0; i < 10; i++) {
                  l.addItem("item "+i);
              }

          b = new Button("Remove All " + l.getRows() + " Rows");
              add(l, BorderLayout.CENTER);
              add(b, BorderLayout.SOUTH);
              b.addActionListener(this);
              pack();
              show();
          }

          static public void main(String[] args) {
              new Main();
          }

          public void actionPerformed(ActionEvent evt) {
              l.removeAll();
          }
      }

            herrick Andy Herrick (Inactive)
            nrodinsunw Nick Rodin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: