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

UIDefaults Map interface is broken

XMLWordPrintable



      Name: jk109818 Date: 02/05/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Win XP

      A DESCRIPTION OF THE PROBLEM :
      UIDefaults Map interface is broken.

      UIManager.getDefaults().size() should return the number of
      entries in the map. It probably does. But,
      UIManager.getDefaults().entrySet().size() returns 0. My
      understanding is that both numbers should be the same.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the provided program. Which calls size() and
      entrySet().size() on an instance of UIDefaults obtained from
      UIManager.getDefaults()




      Because an empty entry set and/or key set is returned it is
      impossible to iterate through the properties. Perhaps I am
      misunderstanding the implementation?


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      566
      something is in there
      566
      566


      Actual:
      566
      something is in there
      0
      0


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class test {


      public static void main(String[] args) {


      UIDefaults uid = UIManager.getDefaults();
      System.out.println( uid.size() );
      System.out.println( uid.isEmpty() ? "empty" :"something is in there" );
      System.out.println( uid.entrySet().size() );
      System.out.println( uid.keySet().size() );

      }

      }


      ---------- END SOURCE ----------
      (Review ID: 178748)
      ======================================================================

            trebari Tejpal Rebari (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: