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

java.awt.swing.ViewportLayout.preferredLayoutSize throws NullPointerException

XMLWordPrintable

    • swing0.7
    • sparc
    • solaris_2.5
    • Verified



      Name: asC58863 Date: 12/24/97


      java.awt.swing.ViewportLayout.preferredLayoutSize(parent) throws
      undocumented NullPointerException in case parent.getView() returns null.

      Here is the test demonstrating the bug:
      -----------------Test.java------------------------
      import java.awt.swing.*;

      class Test {
        public static void main(String[] argv) {
          ViewportLayout layout = new ViewportLayout();
          JViewport parent = new JViewport();
          parent.setView( null);
          try {
            layout.preferredLayoutSize(parent);
            System.out.println(" OKAY ");
          } catch(NullPointerException e) {
            System.out.println(" FAILED : "+e+" has been thrown");
          }
          System.exit(0);
        }
      }

      ---------Output from the test---------------------

        FAILED : java.lang.NullPointerException has been thrown

      --------------------------------------------------
         
      ======================================================================

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            asemidetsunw Alexei Semidetnov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: