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

JCK1.4: api/javax_swing/JPopupMenu/descriptions.html#set_isXXX, headless

XMLWordPrintable



      Name: iaR10016 Date: 06/05/2001


      JDK : JDK1.4.0 beta-b66
      JCK : JCK1.4
      Platform[s] : RedHat Linux 6.2
      switch/Mode : -Djava.awt.headless=true
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test : api/javax_swing/JPopupMenu/descriptions.html#set_isXXX [TestCaseID JPopupMenu2015]

      Here is the code fragment from the JCK1.4 api/javax_swing/JPopupMenu/descriptions.html#set_isXXX
      test source:

      --------- tests/api/javax_swing/JPopupMenu/set_isXXXTests.java ---------
      ...
      089> public Status JPopupMenu2015() {
      090> try {
      091> JPopupMenu c = new JPopupMenu(); // Create JPopupMenu object
      092> boolean[] state = { true, false};
      093> for(int i=0;i<state.length;i++) {
      094> c.setVisible(state[i]);
      095> if(!(
      096> ( c.isVisible() && state[i] )
      097> || ( !c.isVisible() && !state[i] )
      098> ))
      099> return Status.failed("public void setVisible(boolean) Test Failed");
      100> }
      101> } catch(Throwable e) {
      102> return Status.failed( "Unexpected "+e+" thrown" );
      103> }
      104> return Status.passed( "OKAY" );
      105> }
      ...
      ------------------------------------------------------------------------

      When the test is executed in headless mode, JPopupMenu.setVisible(Boolean) method throws
      NullPointerException in the line 094 and the test fails due to this reason.

      The following test example demonstrates the bug:

      ------------------ test.java ------------------
      import javax.swing.*;
      public class test {
          public static void main(String argv[]) {
              (new JPopupMenu()).setVisible(true);
          }
      }
      -----------------------------------------------

      Sample output is:
      ...
      $ /net/linux-15/export/home/jdk1.4.0/linux/bin/java -Djava.awt.headless=true test
      Exception in thread "main" java.lang.NullPointerException
              at javax.swing.JPopupMenu.getPopup(JPopupMenu.java:750)
              at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:700)
              at test.main(test.java:4)
      ...

      Test source location:
      =====================
      /net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/javax_swing/JPopupMenu/set_isXXXTests.java

      jtr file location:
      ==================
      /net/jtgb4u4c.eng/export/sail16/results/merlin/b66/jck14/linux/redhat6.2_single_kde_client_headless_linux-12/workDir/api/javax_swing/descriptions_set_isXXX.jtr

      How to reproduce:
      ====================
      Run the following script under RedHat Linux 6.2 (probably, you need to change JCK and JAVA_HOME paths):
      --------Script START---------------------
      #!/bin/sh
      JAVA_HOME=/net/jdk/export/disk8/local.java/jdk1.4/linux-i386
      JCK=/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14
      export CLASSPATH="$JCK/classes:$JCK/javatest.jar"
      executeClass="javasoft.sqe.tests.api.javax.swing.JPopupMenu.set_isXXXTests -TestCaseID JPopupMenu2015"
      $JAVA_HOME/bin/java -Djava.awt.headless=true ${executeClass}
      ---------Script END----------------------

      Test output:
      =============
      JPopupMenu2015: Failed. Unexpected java.lang.NullPointerException thrown
      STATUS:Failed.tests: 1; failed: 1; first test case failure: JPopupMenu2015

      Specific Machine Info:
      =====================
      Hostname: linux-14
      OS: RedHat Linux 6.2

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

            peterz Peter Zhelezniakov
            irasunw Ira Ira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: