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

The method SwingUtilities.calculateInnerArea works incorrectly

XMLWordPrintable



      Name: ssR10000 Date: 03/21/2001



      The method SwingUtilities.calculateInnerArea(JComponent c, Rectangle r) throws NullPointerException when first arg is null.
      But javadoc says:
      Parameters:
                  c - the JComponent in question; if null, this method returns null
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  r - the Rectangle instance to be modified; may be null

      Example:
      -------------- Example ----
      import javax.swing.*;
      import java.awt.*;

      public class Test {

          public static void main(String argv[]) {

              try {
                  Rectangle res = SwingUtilities.calculateInnerArea(null, null);
              } catch (NullPointerException npe) {
                  npe.printStackTrace();
              }

              System.exit(0);
          }
      }
      -------------- Output -----
      <ssw@archer(pts/9).263> java -fullversion
      java full version "1.4.0-beta-b55"
      <ssw@archer(pts/9).264> java Test
      java.lang.NullPointerException
              at javax.swing.SwingUtilities.calculateInnerArea(SwingUtilities.java:1724)
              at Test.main(Test.java:9)

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

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

            Unassigned Unassigned
            sswsunw Ssw Ssw (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: